From ff6e424cf8279f53bcc1439b5f34d234b2180b7f Mon Sep 17 00:00:00 2001 From: Xiaobing Zhu <71206407+ZhuXiaoBing-cn@users.noreply.github.com> Date: Tue, 1 Jun 2021 15:57:02 +0800 Subject: [PATCH 01/53] Use different connection strings for Spring ServiceBus binders integration tests. (#21966) --- .../binder/EventHubBinderBatchModeIT.java | 24 ++- .../binder/EventHubBinderManualModeIT.java | 30 ++-- .../binder/EventHubBinderRecordModeIT.java | 25 +-- .../binder/EventHubBinderSyncModeIT.java | 25 +-- ...MultiServiceBusQueueAndTopicBinderIT.java} | 36 ++-- ...SingleServiceBusQueueAndTopicBinderIT.java | 109 ++++++++++++ ...{application.yml => application-multi.yml} | 4 +- .../src/test/resources/application-single.yml | 36 ++++ .../test-resources.json | 160 ++++++++++++++++-- 9 files changed, 376 insertions(+), 73 deletions(-) rename sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/java/com/azure/spring/sample/servicebus/binder/{ServiceBusQueueAndTopicBinderIT.java => MultiServiceBusQueueAndTopicBinderIT.java} (73%) create mode 100644 sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/java/com/azure/spring/sample/servicebus/binder/SingleServiceBusQueueAndTopicBinderIT.java rename sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/resources/{application.yml => application-multi.yml} (83%) create mode 100644 sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/resources/application-single.yml diff --git a/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderBatchModeIT.java b/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderBatchModeIT.java index 8b708eff5ded..65c3680f5283 100644 --- a/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderBatchModeIT.java +++ b/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderBatchModeIT.java @@ -3,7 +3,6 @@ package com.azure.spring.test.eventhubs.stream.binder; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -18,10 +17,13 @@ import reactor.core.publisher.Sinks; import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.function.Supplier; +import static org.assertj.core.api.Assertions.assertThat; + @SpringBootTest(classes = EventHubBinderBatchModeIT.TestConfig.class) @TestPropertySource(properties = { @@ -35,7 +37,8 @@ public class EventHubBinderBatchModeIT { private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderBatchModeIT.class); private static String message = UUID.randomUUID().toString(); - private static final AtomicInteger count = new AtomicInteger(0); + + private static CountDownLatch latch = new CountDownLatch(1); @Autowired private Sinks.Many> many; @@ -58,18 +61,21 @@ public Supplier>> supply(Sinks.Many> many) @Bean public Consumer> consume() { return message -> { - LOGGER.info("New message received: '{}'", message.getPayload()); - Assertions.assertEquals(message.getPayload(), EventHubBinderBatchModeIT.message); - count.addAndGet(1); + LOGGER.info("EventHubBinderBatchModeIT: New message received: '{}'", message.getPayload()); + if (message.getPayload().equals(EventHubBinderBatchModeIT.message)) { + latch.countDown(); + } }; } } @Test public void testSendAndReceiveMessage() throws InterruptedException { - Thread.sleep(15000); + LOGGER.info("EventHubBinderBatchModeIT begin."); + EventHubBinderBatchModeIT.latch.await(15, TimeUnit.SECONDS); + LOGGER.info("Send a message:" + message + "."); many.emitNext(new GenericMessage<>(message), Sinks.EmitFailureHandler.FAIL_FAST); - Thread.sleep(6000); - Assertions.assertEquals(1, count.get()); + assertThat(EventHubBinderBatchModeIT.latch.await(15, TimeUnit.SECONDS)).isTrue(); + LOGGER.info("EventHubBinderBatchModeIT end."); } } diff --git a/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderManualModeIT.java b/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderManualModeIT.java index 8d7e3eb48819..ccc3cb405281 100644 --- a/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderManualModeIT.java +++ b/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderManualModeIT.java @@ -20,10 +20,13 @@ import reactor.core.publisher.Sinks; import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.function.Supplier; +import static org.assertj.core.api.Assertions.assertThat; + @SpringBootTest(classes = EventHubBinderManualModeIT.TestConfig.class) @TestPropertySource(properties = { @@ -36,7 +39,7 @@ public class EventHubBinderManualModeIT { private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderManualModeIT.class); private static String message = UUID.randomUUID().toString(); - private static final AtomicInteger count = new AtomicInteger(0); + private static CountDownLatch latch = new CountDownLatch(1); @Autowired private Sinks.Many> many; @@ -59,22 +62,25 @@ public Supplier>> supply(Sinks.Many> many) @Bean public Consumer> consume() { return message -> { - LOGGER.info("New message received: '{}'", message.getPayload()); - Assertions.assertEquals(message.getPayload(), EventHubBinderManualModeIT.message); - Checkpointer checkpointer = (Checkpointer) message.getHeaders().get(AzureHeaders.CHECKPOINTER); - checkpointer.success().handle((r, ex) -> { - Assertions.assertNull(ex); - }); - count.addAndGet(1); + LOGGER.info("EventHubBinderManualModeIT: New message received: '{}'", message.getPayload()); + if (message.getPayload().equals(EventHubBinderManualModeIT.message)) { + Checkpointer checkpointer = (Checkpointer) message.getHeaders().get(AzureHeaders.CHECKPOINTER); + checkpointer.success().handle((r, ex) -> { + Assertions.assertNull(ex); + }); + latch.countDown(); + } }; } } @Test public void testSendAndReceiveMessage() throws InterruptedException { - Thread.sleep(15000); + LOGGER.info("EventHubBinderManualModeIT begin."); + EventHubBinderManualModeIT.latch.await(15, TimeUnit.SECONDS); + LOGGER.info("Send a message:" + message + "."); many.emitNext(new GenericMessage<>(message), Sinks.EmitFailureHandler.FAIL_FAST); - Thread.sleep(6000); - Assertions.assertEquals(1, count.get()); + assertThat(EventHubBinderManualModeIT.latch.await(15, TimeUnit.SECONDS)).isTrue(); + LOGGER.info("EventHubBinderManualModeIT end."); } } diff --git a/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderRecordModeIT.java b/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderRecordModeIT.java index 75f5df4fa593..65cf7e07bcb8 100644 --- a/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderRecordModeIT.java +++ b/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderRecordModeIT.java @@ -3,7 +3,6 @@ package com.azure.spring.test.eventhubs.stream.binder; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -18,10 +17,13 @@ import reactor.core.publisher.Sinks; import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.function.Supplier; +import static org.assertj.core.api.Assertions.assertThat; + @SpringBootTest(classes = EventHubBinderRecordModeIT.TestConfig.class) @TestPropertySource(properties = { @@ -32,9 +34,9 @@ }) public class EventHubBinderRecordModeIT { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderManualModeIT.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderRecordModeIT.class); private static String message = UUID.randomUUID().toString(); - private static final AtomicInteger count = new AtomicInteger(0); + private static CountDownLatch latch = new CountDownLatch(1); @Autowired private Sinks.Many> many; @@ -57,18 +59,21 @@ public Supplier>> supply(Sinks.Many> many) @Bean public Consumer> consume() { return message -> { - LOGGER.info("New message received: '{}'", message.getPayload()); - Assertions.assertEquals(message.getPayload(), EventHubBinderRecordModeIT.message); - count.addAndGet(1); + LOGGER.info("EventHubBinderRecordModeIT: New message received: '{}'", message.getPayload()); + if (message.getPayload().equals(EventHubBinderRecordModeIT.message)) { + latch.countDown(); + } }; } } @Test public void testSendAndReceiveMessage() throws InterruptedException { - Thread.sleep(15000); + LOGGER.info("EventHubBinderRecordModeIT begin."); + EventHubBinderRecordModeIT.latch.await(15, TimeUnit.SECONDS); + LOGGER.info("Send a message:" + message + "."); many.emitNext(new GenericMessage<>(message), Sinks.EmitFailureHandler.FAIL_FAST); - Thread.sleep(6000); - Assertions.assertEquals(1, count.get()); + assertThat(EventHubBinderRecordModeIT.latch.await(15, TimeUnit.SECONDS)).isTrue(); + LOGGER.info("EventHubBinderRecordModeIT end."); } } diff --git a/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderSyncModeIT.java b/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderSyncModeIT.java index c76b91822bcc..04beabae4cd9 100644 --- a/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderSyncModeIT.java +++ b/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderSyncModeIT.java @@ -4,7 +4,6 @@ package com.azure.spring.test.eventhubs.stream.binder; import org.junit.Rule; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,10 +19,13 @@ import reactor.core.publisher.Sinks; import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.function.Supplier; +import static org.assertj.core.api.Assertions.assertThat; + @SpringBootTest(classes = EventHubBinderSyncModeIT.TestConfig.class) @TestPropertySource(properties = { @@ -34,7 +36,7 @@ }) public class EventHubBinderSyncModeIT { - private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderManualModeIT.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubBinderSyncModeIT.class); private static String message = UUID.randomUUID().toString(); @Autowired @@ -43,7 +45,7 @@ public class EventHubBinderSyncModeIT { @Rule public OutputCaptureRule capture = new OutputCaptureRule(); - private static final AtomicInteger count = new AtomicInteger(0); + private static CountDownLatch latch = new CountDownLatch(1); @EnableAutoConfiguration public static class TestConfig { @@ -63,18 +65,21 @@ public Supplier>> supply(Sinks.Many> many) @Bean public Consumer> consume() { return message -> { - LOGGER.info("New message received: '{}'", message.getPayload()); - Assertions.assertEquals(message.getPayload(), EventHubBinderSyncModeIT.message); - count.addAndGet(1); + LOGGER.info("EventHubBinderRecordModeIT: New message received: '{}'", message.getPayload()); + if (message.getPayload().equals(EventHubBinderSyncModeIT.message)) { + latch.countDown(); + } }; } } @Test public void testSendAndReceiveMessage() throws InterruptedException { - Thread.sleep(15000); + LOGGER.info("EventHubBinderSyncModeIT begin."); + EventHubBinderSyncModeIT.latch.await(15, TimeUnit.SECONDS); + LOGGER.info("Send a message:" + message + "."); many.emitNext(new GenericMessage<>(message), Sinks.EmitFailureHandler.FAIL_FAST); - Thread.sleep(6000); - Assertions.assertEquals(1, count.get()); + assertThat(EventHubBinderSyncModeIT.latch.await(15, TimeUnit.SECONDS)).isTrue(); + LOGGER.info("EventHubBinderSyncModeIT end."); } } diff --git a/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/java/com/azure/spring/sample/servicebus/binder/ServiceBusQueueAndTopicBinderIT.java b/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/java/com/azure/spring/sample/servicebus/binder/MultiServiceBusQueueAndTopicBinderIT.java similarity index 73% rename from sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/java/com/azure/spring/sample/servicebus/binder/ServiceBusQueueAndTopicBinderIT.java rename to sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/java/com/azure/spring/sample/servicebus/binder/MultiServiceBusQueueAndTopicBinderIT.java index 15ec1a5ad87c..ce651f7e87cd 100644 --- a/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/java/com/azure/spring/sample/servicebus/binder/ServiceBusQueueAndTopicBinderIT.java +++ b/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/java/com/azure/spring/sample/servicebus/binder/MultiServiceBusQueueAndTopicBinderIT.java @@ -2,7 +2,6 @@ // Licensed under the MIT License. package com.azure.spring.sample.servicebus.binder; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -12,7 +11,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; -import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.ActiveProfiles; import reactor.core.publisher.Flux; import reactor.core.publisher.Sinks; @@ -24,12 +23,12 @@ import static org.assertj.core.api.Assertions.assertThat; -@SpringBootTest(classes = { ServiceBusQueueAndTopicBinderIT.TestQueueConfig.class, - ServiceBusQueueAndTopicBinderIT.TestTopicConfig.class }) -@TestPropertySource(locations = "classpath:application.yml") -public class ServiceBusQueueAndTopicBinderIT { +@SpringBootTest(classes = { MultiServiceBusQueueAndTopicBinderIT.TestQueueConfig.class, + MultiServiceBusQueueAndTopicBinderIT.TestTopicConfig.class }) +@ActiveProfiles("multi") +public class MultiServiceBusQueueAndTopicBinderIT { - private static final Logger LOGGER = LoggerFactory.getLogger(ServiceBusQueueAndTopicBinderIT.class); + private static final Logger LOGGER = LoggerFactory.getLogger(MultiServiceBusQueueAndTopicBinderIT.class); private static String message = UUID.randomUUID().toString(); @@ -60,8 +59,9 @@ public Supplier>> queueSupply(Sinks.Many> m public Consumer> queueConsume() { return message -> { LOGGER.info("Test queue new message received: '{}'", message); - Assertions.assertEquals(message.getPayload(), ServiceBusQueueAndTopicBinderIT.message); - latch.countDown(); + if (message.getPayload().equals(MultiServiceBusQueueAndTopicBinderIT.message)) { + latch.countDown(); + } }; } } @@ -85,23 +85,25 @@ public Supplier>> topicSupply(Sinks.Many> m public Consumer> topicConsume() { return message -> { LOGGER.info("Test topic new message received: '{}'", message); - Assertions.assertEquals(message.getPayload(), ServiceBusQueueAndTopicBinderIT.message); - latch.countDown(); + if (message.getPayload().equals(MultiServiceBusQueueAndTopicBinderIT.message)) { + latch.countDown(); + } }; } } @Test - public void testSendAndReceiveMessage() throws InterruptedException { - LOGGER.info("testSendAndReceiveMessage begin."); + public void testMultiServiceBusSendAndReceiveMessage() throws InterruptedException { + LOGGER.info("MultiServiceBusQueueAndTopicBinderIT begin."); GenericMessage genericMessage = new GenericMessage<>(message); - LOGGER.info("Send a message to the queue."); + + LOGGER.info("Send a message:" + message + " to the queue."); manyQueue.emitNext(genericMessage, Sinks.EmitFailureHandler.FAIL_FAST); - LOGGER.info("Send a message to the topic."); + LOGGER.info("Send a message:" + message + " to the topic."); manyTopic.emitNext(genericMessage, Sinks.EmitFailureHandler.FAIL_FAST); - assertThat(ServiceBusQueueAndTopicBinderIT.latch.await(10, TimeUnit.SECONDS)).isTrue(); - LOGGER.info("testSendAndReceiveMessage end."); + assertThat(MultiServiceBusQueueAndTopicBinderIT.latch.await(15, TimeUnit.SECONDS)).isTrue(); + LOGGER.info("MultiServiceBusQueueAndTopicBinderIT end."); } } diff --git a/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/java/com/azure/spring/sample/servicebus/binder/SingleServiceBusQueueAndTopicBinderIT.java b/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/java/com/azure/spring/sample/servicebus/binder/SingleServiceBusQueueAndTopicBinderIT.java new file mode 100644 index 000000000000..68f9d6ded6d9 --- /dev/null +++ b/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/java/com/azure/spring/sample/servicebus/binder/SingleServiceBusQueueAndTopicBinderIT.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.spring.sample.servicebus.binder; + +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Bean; +import org.springframework.messaging.Message; +import org.springframework.messaging.support.GenericMessage; +import org.springframework.test.context.ActiveProfiles; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Sinks; + +import java.util.UUID; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; +import java.util.function.Supplier; + +import static org.assertj.core.api.Assertions.assertThat; + +@SpringBootTest(classes = { SingleServiceBusQueueAndTopicBinderIT.TestQueueConfig.class, + SingleServiceBusQueueAndTopicBinderIT.TestTopicConfig.class }) +@ActiveProfiles("single") +public class SingleServiceBusQueueAndTopicBinderIT { + + private static final Logger LOGGER = LoggerFactory.getLogger(SingleServiceBusQueueAndTopicBinderIT.class); + + private static String message = UUID.randomUUID().toString(); + + private static CountDownLatch latch = new CountDownLatch(2); + + @Autowired + private Sinks.Many> manyQueue; + + @Autowired + private Sinks.Many> manyTopic; + + @EnableAutoConfiguration + public static class TestQueueConfig { + + @Bean + public Sinks.Many> manyQueue() { + return Sinks.many().unicast().onBackpressureBuffer(); + } + + @Bean + public Supplier>> queueSupply(Sinks.Many> manyQueue) { + return () -> manyQueue.asFlux() + .doOnNext(m -> LOGGER.info("Manually sending message {}", m)) + .doOnError(t -> LOGGER.error("Error encountered", t)); + } + + @Bean + public Consumer> queueConsume() { + return message -> { + LOGGER.info("---Test queue new message received: '{}'", message); + if (message.getPayload().equals(SingleServiceBusQueueAndTopicBinderIT.message)) { + latch.countDown(); + } + }; + } + } + + @EnableAutoConfiguration + public static class TestTopicConfig { + + @Bean + public Sinks.Many> manyTopic() { + return Sinks.many().unicast().onBackpressureBuffer(); + } + + @Bean + public Supplier>> topicSupply(Sinks.Many> manyTopic) { + return () -> manyTopic.asFlux() + .doOnNext(m -> LOGGER.info("Manually sending message {}", m)) + .doOnError(t -> LOGGER.error("Error encountered", t)); + } + + @Bean + public Consumer> topicConsume() { + return message -> { + LOGGER.info("---Test topic new message received: '{}'", message); + if (message.getPayload().equals(SingleServiceBusQueueAndTopicBinderIT.message)) { + latch.countDown(); + } + }; + } + } + + @Test + public void testSingleServiceBusSendAndReceiveMessage() throws InterruptedException { + LOGGER.info("SingleServiceBusQueueAndTopicBinderIT begin."); + GenericMessage genericMessage = new GenericMessage<>(message); + + LOGGER.info("Send a message:" + message + " to the queue."); + manyQueue.emitNext(genericMessage, Sinks.EmitFailureHandler.FAIL_FAST); + LOGGER.info("Send a message:" + message + " to the topic."); + manyTopic.emitNext(genericMessage, Sinks.EmitFailureHandler.FAIL_FAST); + + assertThat(SingleServiceBusQueueAndTopicBinderIT.latch.await(15, TimeUnit.SECONDS)).isTrue(); + LOGGER.info("SingleServiceBusQueueAndTopicBinderIT end."); + } + +} diff --git a/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/resources/application.yml b/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/resources/application-multi.yml similarity index 83% rename from sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/resources/application.yml rename to sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/resources/application-multi.yml index 627ca960926f..a763ba333f63 100644 --- a/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/resources/application.yml +++ b/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/resources/application-multi.yml @@ -24,7 +24,7 @@ spring: cloud: azure: servicebus: - connection-string: ${SERVICEBUS_BINDER_TEST_CONNECTION_STRING} + connection-string: ${SERVICEBUS2_BINDER_TEST_CONNECTION_STRING} servicebus-2: type: servicebus-queue default-candidate: false @@ -33,4 +33,4 @@ spring: cloud: azure: servicebus: - connection-string: ${SERVICEBUS_BINDER_TEST_CONNECTION_STRING} + connection-string: ${SERVICEBUS3_BINDER_TEST_CONNECTION_STRING} diff --git a/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/resources/application-single.yml b/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/resources/application-single.yml new file mode 100644 index 000000000000..324e10a0f1f9 --- /dev/null +++ b/sdk/spring/azure-spring-cloud-test-servicebus-binder/src/test/resources/application-single.yml @@ -0,0 +1,36 @@ +spring: + cloud: + stream: + function: + definition: queueConsume;queueSupply;topicConsume;topicSupply; + bindings: + topicConsume-in-0: + destination: topic1 + group: topicSub + topicSupply-out-0: + destination: topic1 + queueConsume-in-0: + binder: servicebus-2 + destination: queue1 + queueSupply-out-0: + binder: servicebus-2 + destination: queue1 + binders: + servicebus-1: + type: servicebus-topic + default-candidate: true + environment: + spring: + cloud: + azure: + servicebus: + connection-string: ${SERVICEBUS1_BINDER_TEST_CONNECTION_STRING} + servicebus-2: + type: servicebus-queue + default-candidate: false + environment: + spring: + cloud: + azure: + servicebus: + connection-string: ${SERVICEBUS1_BINDER_TEST_CONNECTION_STRING} diff --git a/sdk/spring/azure-spring-cloud-test-servicebus-binder/test-resources.json b/sdk/spring/azure-spring-cloud-test-servicebus-binder/test-resources.json index 79140cc89aa9..07a38beee537 100644 --- a/sdk/spring/azure-spring-cloud-test-servicebus-binder/test-resources.json +++ b/sdk/spring/azure-spring-cloud-test-servicebus-binder/test-resources.json @@ -8,14 +8,16 @@ } }, "variables": { - "namespaces_name_standard": "[concat(parameters('baseName'), '-Standard')]", + "namespaces_name_standard_1": "[concat(parameters('baseName'), '-Standard-1')]", + "namespaces_name_standard_2": "[concat(parameters('baseName'), '-Standard-2')]", + "namespaces_name_standard_3": "[concat(parameters('baseName'), '-Standard-3')]", "location": "[resourceGroup().location]" }, "resources": [ { "type": "Microsoft.ServiceBus/namespaces", "apiVersion": "2018-01-01-preview", - "name": "[variables('namespaces_name_standard')]", + "name": "[variables('namespaces_name_standard_1')]", "location": "[variables('location')]", "sku": { "name": "Standard", @@ -25,13 +27,71 @@ "zoneRedundant": false } }, + { + "type": "Microsoft.ServiceBus/namespaces", + "apiVersion": "2018-01-01-preview", + "name": "[variables('namespaces_name_standard_2')]", + "location": "[variables('location')]", + "sku": { + "name": "Standard", + "tier": "Standard" + }, + "properties": { + "zoneRedundant": false + } + }, + { + "type": "Microsoft.ServiceBus/namespaces", + "apiVersion": "2018-01-01-preview", + "name": "[variables('namespaces_name_standard_3')]", + "location": "[variables('location')]", + "sku": { + "name": "Standard", + "tier": "Standard" + }, + "properties": { + "zoneRedundant": false + } + }, + { + "type": "Microsoft.ServiceBus/namespaces/AuthorizationRules", + "apiVersion": "2017-04-01", + "name": "[concat(variables('namespaces_name_standard_1'), '/RootManageSharedAccessKey')]", + "location": "[variables('location')]", + "dependsOn": [ + "[resourceId('Microsoft.ServiceBus/namespaces', variables('namespaces_name_standard_1'))]" + ], + "properties": { + "rights": [ + "Listen", + "Manage", + "Send" + ] + } + }, { "type": "Microsoft.ServiceBus/namespaces/AuthorizationRules", "apiVersion": "2017-04-01", - "name": "[concat(variables('namespaces_name_standard'), '/RootManageSharedAccessKey')]", + "name": "[concat(variables('namespaces_name_standard_2'), '/RootManageSharedAccessKey')]", "location": "[variables('location')]", "dependsOn": [ - "[resourceId('Microsoft.ServiceBus/namespaces', variables('namespaces_name_standard'))]" + "[resourceId('Microsoft.ServiceBus/namespaces', variables('namespaces_name_standard_2'))]" + ], + "properties": { + "rights": [ + "Listen", + "Manage", + "Send" + ] + } + }, + { + "type": "Microsoft.ServiceBus/namespaces/AuthorizationRules", + "apiVersion": "2017-04-01", + "name": "[concat(variables('namespaces_name_standard_3'), '/RootManageSharedAccessKey')]", + "location": "[variables('location')]", + "dependsOn": [ + "[resourceId('Microsoft.ServiceBus/namespaces', variables('namespaces_name_standard_3'))]" ], "properties": { "rights": [ @@ -44,10 +104,34 @@ { "type": "Microsoft.ServiceBus/namespaces/queues", "apiVersion": "2017-04-01", - "name": "[concat(variables('namespaces_name_standard'), '/queue1')]", + "name": "[concat(variables('namespaces_name_standard_1'), '/queue1')]", "location": "[variables('location')]", "dependsOn": [ - "[resourceId('Microsoft.ServiceBus/namespaces', variables('namespaces_name_standard'))]" + "[resourceId('Microsoft.ServiceBus/namespaces', variables('namespaces_name_standard_1'))]" + ], + "properties": { + "lockDuration": "PT30S", + "maxSizeInMegabytes": 1024, + "requiresDuplicateDetection": false, + "requiresSession": false, + "defaultMessageTimeToLive": "P14D", + "deadLetteringOnMessageExpiration": false, + "enableBatchedOperations": true, + "duplicateDetectionHistoryTimeWindow": "PT10M", + "maxDeliveryCount": 10, + "status": "Active", + "autoDeleteOnIdle": "P10675199DT2H48M5.4775807S", + "enablePartitioning": false, + "enableExpress": false + } + }, + { + "type": "Microsoft.ServiceBus/namespaces/queues", + "apiVersion": "2017-04-01", + "name": "[concat(variables('namespaces_name_standard_3'), '/queue1')]", + "location": "[variables('location')]", + "dependsOn": [ + "[resourceId('Microsoft.ServiceBus/namespaces', variables('namespaces_name_standard_3'))]" ], "properties": { "lockDuration": "PT30S", @@ -68,10 +152,10 @@ { "type": "Microsoft.ServiceBus/namespaces/topics", "apiVersion": "2017-04-01", - "name": "[concat(variables('namespaces_name_standard'), '/topic1')]", + "name": "[concat(variables('namespaces_name_standard_1'), '/topic1')]", "location": "[variables('location')]", "dependsOn": [ - "[resourceId('Microsoft.ServiceBus/namespaces', variables('namespaces_name_standard'))]" + "[resourceId('Microsoft.ServiceBus/namespaces', variables('namespaces_name_standard_1'))]" ], "properties": { "defaultMessageTimeToLive": "P14D", @@ -86,14 +170,56 @@ "enableExpress": false } }, + { + "type": "Microsoft.ServiceBus/namespaces/topics", + "apiVersion": "2017-04-01", + "name": "[concat(variables('namespaces_name_standard_2'), '/topic1')]", + "location": "[variables('location')]", + "dependsOn": [ + "[resourceId('Microsoft.ServiceBus/namespaces', variables('namespaces_name_standard_2'))]" + ], + "properties": { + "defaultMessageTimeToLive": "P14D", + "maxSizeInMegabytes": 1024, + "requiresDuplicateDetection": false, + "duplicateDetectionHistoryTimeWindow": "PT10M", + "enableBatchedOperations": true, + "status": "Active", + "supportOrdering": true, + "autoDeleteOnIdle": "P10675199DT2H48M5.4775807S", + "enablePartitioning": false, + "enableExpress": false + } + }, + { + "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions", + "apiVersion": "2018-01-01-preview", + "name": "[concat(variables('namespaces_name_standard_1'), '/topic1/topicSub')]", + "location": "[variables('location')]", + "dependsOn": [ + "[resourceId('Microsoft.ServiceBus/namespaces/topics', variables('namespaces_name_standard_1'), 'topic1')]", + "[resourceId('Microsoft.ServiceBus/namespaces', variables('namespaces_name_standard_1'))]" + ], + "properties": { + "lockDuration": "PT30S", + "requiresSession": false, + "defaultMessageTimeToLive": "P14D", + "deadLetteringOnMessageExpiration": false, + "deadLetteringOnFilterEvaluationExceptions": false, + "maxDeliveryCount": 1, + "status": "Active", + "enableBatchedOperations": true, + "autoDeleteOnIdle": "P14D" + } + }, { "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions", "apiVersion": "2018-01-01-preview", - "name": "[concat(variables('namespaces_name_standard'), '/topic1/topicSub')]", + "name": "[concat(variables('namespaces_name_standard_2'), '/topic1/topicSub')]", "location": "[variables('location')]", "dependsOn": [ - "[resourceId('Microsoft.ServiceBus/namespaces/topics', variables('namespaces_name_standard'), 'topic1')]", - "[resourceId('Microsoft.ServiceBus/namespaces', variables('namespaces_name_standard'))]" + "[resourceId('Microsoft.ServiceBus/namespaces/topics', variables('namespaces_name_standard_2'), 'topic1')]", + "[resourceId('Microsoft.ServiceBus/namespaces', variables('namespaces_name_standard_2'))]" ], "properties": { "lockDuration": "PT30S", @@ -109,9 +235,17 @@ } ], "outputs": { - "SERVICEBUS_BINDER_TEST_CONNECTION_STRING": { + "SERVICEBUS1_BINDER_TEST_CONNECTION_STRING": { + "type": "string", + "value": "[listKeys(resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', variables('namespaces_name_standard_1'), 'RootManageSharedAccessKey'), '2017-04-01').primaryConnectionString]" + }, + "SERVICEBUS2_BINDER_TEST_CONNECTION_STRING": { + "type": "string", + "value": "[listKeys(resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', variables('namespaces_name_standard_2'), 'RootManageSharedAccessKey'), '2017-04-01').primaryConnectionString]" + }, + "SERVICEBUS3_BINDER_TEST_CONNECTION_STRING": { "type": "string", - "value": "[listKeys(resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', variables('namespaces_name_standard'), 'RootManageSharedAccessKey'), '2017-04-01').primaryConnectionString]" + "value": "[listKeys(resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', variables('namespaces_name_standard_3'), 'RootManageSharedAccessKey'), '2017-04-01').primaryConnectionString]" } } } From bbe22558b4ca92a98e1a2b3dc1ee0e088c20b822 Mon Sep 17 00:00:00 2001 From: zhihaoguo Date: Tue, 1 Jun 2021 17:58:57 +0800 Subject: [PATCH 02/53] update changelog (#21427) * update changelog for 3.5.0 entry --- .../README.md | 2 +- .../CHANGELOG.md | 17 ++++++++++++++++- .../azure-spring-boot-starter/CHANGELOG.md | 19 +++++++++++++++++-- sdk/spring/azure-spring-boot/CHANGELOG.md | 19 ++++++++++++++++--- 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/README.md b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/README.md index 2a1f49eed6b7..efbedf239533 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/README.md +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/README.md @@ -95,7 +95,7 @@ azure: # scopes: # - /Obo.WebApiA.ExampleScope -# enable-full-list is used to control whether to list all group id, default is false +# enable-full-list is used to control whether to list all group ids, default is false # It's suggested the logged in user should at least belong to one of the above groups # If not, the logged in user will not be able to access any authorization controller rest APIs diff --git a/sdk/spring/azure-spring-boot-starter-active-directory/CHANGELOG.md b/sdk/spring/azure-spring-boot-starter-active-directory/CHANGELOG.md index 555ed2534676..d5b665c1ef00 100644 --- a/sdk/spring/azure-spring-boot-starter-active-directory/CHANGELOG.md +++ b/sdk/spring/azure-spring-boot-starter-active-directory/CHANGELOG.md @@ -5,11 +5,26 @@ ## 3.5.0 (2021-05-24) ### New Features +- Add `AADB2CTrustedIssuerRepository` to manage the trusted issuer in AAD B2C. - Upgrade to [spring-boot-dependencies:2.4.5](https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.4.5/spring-boot-dependencies-2.4.5.pom). - Upgrade to [spring-cloud-dependencies:2020.0.2](https://repo.maven.apache.org/maven2/org/springframework/cloud/spring-cloud-dependencies/2020.0.2/spring-cloud-dependencies-2020.0.2.pom). - Enable property azure.activedirectory.redirect-uri-template.([#21116](https://github.com/Azure/azure-sdk-for-java/issues/21116)) +- Support creating `GrantedAuthority` by groupId and groupName for web application.([#20218](https://github.com/Azure/azure-sdk-for-java/issues/20218)) + ```yaml + user-group: + allowed-group-names: group1,group2 + allowed-group-ids: , + enable-full-list: false + ``` + | Parameter | Description | + | ------------------- | ------------------------------------------------------------ | + | allowed-group-names | if `enable-full-list` is `false`, create `GrantedAuthority` with groupNames which belong to user and `allowed-group-names` | + | allowed-group-ids | if `enable-full-list` is `false`, create `GrantedAuthority` with groupIds which belong to user and `allowed-group-ids` | + | enable-full-list | default is `false`.
if the value is `true`, create `GrantedAuthority` only with user's all groupIds, ignore group names| - +### Key Bug Fixes +- Fix issue that where the AAD B2C starter cannot fetch the OpenID Connect metadata document via issuer. [#21036](https://github.com/Azure/azure-sdk-for-java/issues/21036) +- Deprecate *addB2CIssuer*, *addB2CUserFlowIssuers*, *createB2CUserFlowIssuer* methods in `AADTrustedIssuerRepository`. ## 3.4.0 (2021-04-19) ### Key Bug Fixes diff --git a/sdk/spring/azure-spring-boot-starter/CHANGELOG.md b/sdk/spring/azure-spring-boot-starter/CHANGELOG.md index fb3c155108f8..6ffc34375be2 100644 --- a/sdk/spring/azure-spring-boot-starter/CHANGELOG.md +++ b/sdk/spring/azure-spring-boot-starter/CHANGELOG.md @@ -5,10 +5,26 @@ ## 3.5.0 (2021-05-24) ### New Features +- Add `AADB2CTrustedIssuerRepository` to manage the trusted issuer in AAD B2C. - Upgrade to [spring-boot-dependencies:2.4.5](https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.4.5/spring-boot-dependencies-2.4.5.pom). - Upgrade to [spring-cloud-dependencies:2020.0.2](https://repo.maven.apache.org/maven2/org/springframework/cloud/spring-cloud-dependencies/2020.0.2/spring-cloud-dependencies-2020.0.2.pom). +- Enable property azure.activedirectory.redirect-uri-template.([#21116](https://github.com/Azure/azure-sdk-for-java/issues/21116)) +- Support creating `GrantedAuthority` by groupId and groupName for web application.([#20218](https://github.com/Azure/azure-sdk-for-java/issues/20218)) + ```yaml + user-group: + allowed-group-names: group1,group2 + allowed-group-ids: , + enable-full-list: false + ``` + | Parameter | Description | + | ------------------- | ------------------------------------------------------------ | + | allowed-group-names | if `enable-full-list` is `false`, create `GrantedAuthority` with groupNames which belong to user and `allowed-group-names` | + | allowed-group-ids | if `enable-full-list` is `false`, create `GrantedAuthority` with groupIds which belong to user and `allowed-group-ids` | + | enable-full-list | default is `false`.
if the value is `true`, create `GrantedAuthority` only with user's all groupIds, ignore group names| - +### Key Bug Fixes +- Fix issue that where the AAD B2C starter cannot fetch the OpenID Connect metadata document via issuer. [#21036](https://github.com/Azure/azure-sdk-for-java/issues/21036) +- Deprecate *addB2CIssuer*, *addB2CUserFlowIssuers*, *createB2CUserFlowIssuer* methods in `AADTrustedIssuerRepository`. ## 3.4.0 (2021-04-19) ### Key Bug Fixes @@ -93,4 +109,3 @@ ### Key Bug Fixes - Address CVEs and cleaned up all warnings at build time. - diff --git a/sdk/spring/azure-spring-boot/CHANGELOG.md b/sdk/spring/azure-spring-boot/CHANGELOG.md index 52f55b1055c3..c01299e98334 100644 --- a/sdk/spring/azure-spring-boot/CHANGELOG.md +++ b/sdk/spring/azure-spring-boot/CHANGELOG.md @@ -6,10 +6,24 @@ ## 3.5.0 (2021-05-24) ### New Features - Add `AADB2CTrustedIssuerRepository` to manage the trusted issuer in AAD B2C. -- Enable property azure.activedirectory.redirect-uri-template. ([#21116](https://github.com/Azure/azure-sdk-for-java/issues/21116)) +- Upgrade to [spring-boot-dependencies:2.4.5](https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.4.5/spring-boot-dependencies-2.4.5.pom). +- Upgrade to [spring-cloud-dependencies:2020.0.2](https://repo.maven.apache.org/maven2/org/springframework/cloud/spring-cloud-dependencies/2020.0.2/spring-cloud-dependencies-2020.0.2.pom). +- Enable property azure.activedirectory.redirect-uri-template.([#21116](https://github.com/Azure/azure-sdk-for-java/issues/21116)) +- Support creating `GrantedAuthority` by groupId and groupName for web application.([#20218](https://github.com/Azure/azure-sdk-for-java/issues/20218)) + ```yaml + user-group: + allowed-group-names: group1,group2 + allowed-group-ids: , + enable-full-list: false + ``` + | Parameter | Description | + | ------------------- | ------------------------------------------------------------ | + | allowed-group-names | if `enable-full-list` is `false`, create `GrantedAuthority` with groupNames which belong to user and `allowed-group-names` | + | allowed-group-ids | if `enable-full-list` is `false`, create `GrantedAuthority` with groupIds which belong to user and `allowed-group-ids` | + | enable-full-list | default is `false`.
if the value is `true`, create `GrantedAuthority` only with user's all groupIds, ignore group names| ### Key Bug Fixes -- Fix the issue [#21036](https://github.com/Azure/azure-sdk-for-java/issues/21036) where the AAD B2C starter cannot fetch the OpenID Connect metadata document via issuer. +- Fix issue that where the AAD B2C starter cannot fetch the OpenID Connect metadata document via issuer. [#21036](https://github.com/Azure/azure-sdk-for-java/issues/21036) - Deprecate *addB2CIssuer*, *addB2CUserFlowIssuers*, *createB2CUserFlowIssuer* methods in `AADTrustedIssuerRepository`. ## 3.4.0 (2021-04-19) @@ -117,4 +131,3 @@ Updated to `Spring Boot` [2.4.3](https://github.com/spring-projects/spring-boot/ ### Key Bug Fixes - Address CVEs and cleaned up all warnings at build time. - From 0a4321ade9c947add4ff6cc3a5a9b09c0f13fa07 Mon Sep 17 00:00:00 2001 From: Xiaobing Zhu <71206407+ZhuXiaoBing-cn@users.noreply.github.com> Date: Tue, 1 Jun 2021 18:56:10 +0800 Subject: [PATCH 03/53] Upgrade Spring UTs/ITs to use JUnit 5. (#21670) --- sdk/spring/azure-identity-spring/pom.xml | 26 +--- .../pom.xml | 27 ---- .../pom.xml | 27 ---- .../azure-appconfiguration-sample/pom.xml | 27 ---- .../pom.xml | 11 -- .../pom.xml | 18 +-- .../ServiceBusJMSQueueApplicationIT.java | 19 ++- .../pom.xml | 18 +-- .../ServiceBusJMSTopicApplicationIT.java | 20 ++- .../azure-spring-cloud-sample-cache/pom.xml | 18 +-- .../sample/cache/CacheApplicationIT.java | 12 +- .../pom.xml | 35 +----- .../pom.xml | 35 +----- .../pom.xml | 23 +--- .../EventHubMultiBindersApplicationIT.java | 22 ++-- .../pom.xml | 23 +--- .../EventHubOperationApplicationIT.java | 16 ++- .../pom.xml | 27 ---- .../pom.xml | 27 ---- .../pom.xml | 23 +--- .../ServiceBusOperationApplicationIT.java | 26 ++-- .../pom.xml | 23 +--- .../ServiceBusQueueBinderApplicationIT.java | 16 ++- .../pom.xml | 23 +--- ...viceBusQueueMultiBindersApplicationIT.java | 19 ++- .../pom.xml | 23 +--- .../ServiceBusTopicBinderApplicationIT.java | 16 ++- .../pom.xml | 23 +--- .../StorageQueueOperationApplicationIT.java | 14 +-- .../pom.xml | 23 +--- .../EventHubOperationApplicationIT.java | 17 ++- .../pom.xml | 23 +--- .../ServiceBusIntegrationApplicationIT.java | 26 ++-- .../pom.xml | 23 +--- .../StorageQueueIntegrationApplicationIT.java | 18 ++- .../feature-management-sample/pom.xml | 27 ---- .../feature-management-web-sample/pom.xml | 27 ---- .../pom.xml | 2 + .../azure-spring-boot-test-aad-b2c/pom.xml | 8 +- sdk/spring/azure-spring-boot-test-aad/pom.xml | 1 + .../pom.xml | 1 + .../azure-spring-boot-test-core/pom.xml | 7 -- .../spring/test/EnvironmentVariable.java | 1 + .../aad/ropc/AADOauth2ROPCGrantClientIT.java | 16 +-- .../azure-spring-boot-test-cosmos/pom.xml | 12 +- .../azure/test/cosmos/CosmosActuatorIT.java | 6 +- .../java/com/azure/test/cosmos/CosmosIT.java | 32 ++--- .../pom-reactive.xml | 23 +--- .../azure-spring-boot-test-keyvault/pom.xml | 23 +--- .../test/keyvault/KeyVaultActuatorIT.java | 2 +- .../test/keyvault/KeyVaultSecretValueIT.java | 98 ++++++++------- .../test-resources.json | 2 +- .../pom.xml | 8 +- .../azure-spring-boot-test-storage/pom.xml | 17 +-- sdk/spring/azure-spring-boot/pom.xml | 12 -- ...earerTokenAuthenticationConverterTest.java | 6 +- ...ResourceServerClientConfigurationTest.java | 17 +-- .../AADResourceServerConfigurationTest.java | 2 +- .../AADJwtAudienceValidatorTest.java | 16 +-- .../validator/AADJwtIssuerValidatorTest.java | 2 +- ...ADAccessTokenGroupRolesExtractionTest.java | 117 +++++++++++++----- .../webapp/AADIdTokenRolesExtractionTest.java | 2 +- .../webapp/AADWebAppConfigurationTest.java | 56 +++++---- .../AADAppRoleAuthenticationFilterTest.java | 32 ++--- ...AADAuthenticationFilterPropertiesTest.java | 22 ++-- .../aad/AADAuthenticationFilterTest.java | 10 +- .../aad/AzureADGraphClientTest.java | 9 +- .../autoconfigure/aad/MembershipTest.java | 14 +-- .../aad/ResourceRetrieverTest.java | 2 +- .../aad/UserPrincipalAzureADGraphTest.java | 37 ++++-- .../aad/UserPrincipalManagerAudienceTest.java | 6 +- .../aad/UserPrincipalManagerTest.java | 54 ++++---- .../aad/UserPrincipalMicrosoftGraphTest.java | 42 ++++--- .../cosmos/CosmosAutoConfigurationTest.java | 12 +- .../cosmos/CosmosPropertiesTest.java | 9 +- ...RepositoriesAutoConfigurationUnitTest.java | 30 +++-- .../jms/ConnectionStringResolverTest.java | 11 +- ...iumServiceBusJMSAutoConfigurationTest.java | 20 +-- ...iumServiceBusJMSAutoConfigurationTest.java | 9 +- ...ureStorageResourcePatternResolverTest.java | 24 +++- .../storage/StorageAutoConfigurationTest.java | 16 +-- .../BlobStorageHealthIndicatorTest.java | 18 +-- .../FileStorageHealthIndicatorTest.java | 20 +-- .../resource/AzureBlobStorageTests.java | 45 ++++--- ...ureCloudFoundryServiceApplicationTest.java | 11 +- .../keyvault/CaseSensitiveKeyVaultTest.java | 31 +++-- .../spring/keyvault/InitializerTest.java | 17 +-- .../KeyVaultEnvironmentPostProcessorTest.java | 18 +-- .../keyvault/KeyVaultOperationUnitTest.java | 21 +++- .../KeyVaultPropertySourceUnitTest.java | 24 +++- .../azure-spring-cloud-autoconfigure/pom.xml | 29 +---- .../AzureRedisAutoConfigurationTest.java | 21 ++-- ...dFoundryEnvironmentPostProcessorTests.java | 2 +- .../AzureEventHubAutoConfigurationTest.java | 8 +- ...ureEventHubKafkaAutoConfigurationTest.java | 12 +- .../AzureServiceBusAutoConfigurationTest.java | 8 +- ...eServiceBusQueueAutoConfigurationTest.java | 34 +++-- ...eServiceBusTopicAutoConfigurationTest.java | 27 +++- .../servicebus/ServiceBusUtilsTest.java | 8 +- sdk/spring/azure-spring-cloud-context/pom.xml | 12 -- .../AzureContextAutoConfigurationTest.java | 22 ++-- .../AzureEnvironmentConfigurationTest.java | 2 +- .../cloud/context/core/ApplicationIdTest.java | 6 +- .../cloud/context/core/MemoizerTest.java | 24 ++-- .../azure-spring-cloud-messaging/pom.xml | 35 ++---- ...ctAzureMessagingAnnotationDrivenTests.java | 87 ++++++------- ...tenerAnnotationBeanPostProcessorTests.java | 40 +++--- .../AzureListenerEndpointRegistrarTests.java | 32 +++-- .../AzureListenerEndpointRegistryTests.java | 24 ++-- .../config/EnableAzureMessagingTests.java | 76 ++++++------ .../pom.xml | 1 - sdk/spring/azure-spring-cloud-storage/pom.xml | 28 ----- ...zureStorageQueueAutoConfigurationTest.java | 12 +- .../EventHubBinderHealthIndicatorTest.java | 10 +- .../EventHubMessageChannelBinderTest.java | 6 +- .../binder/EventHubPartitionBinderTests.java | 23 ++-- .../ServiceBusQueuePartitionBinderTests.java | 1 + .../ServiceBusTopicPartitionBinderTests.java | 2 + .../azure-spring-cloud-telemetry/pom.xml | 6 - .../TelemetryAutoConfigurationTest.java | 2 +- .../azure-spring-cloud-test-eventhubs/pom.xml | 18 --- .../DefaultEventHubClientFactoryTest.java | 16 ++- .../EventHubOperationSendSubscribeTest.java | 27 ++-- .../EventHubRxOperationSendSubscribeTest.java | 23 ++-- .../eventhub/EventHubTemplateSendTest.java | 26 ++-- .../EventHubTemplateSubscribeTest.java | 24 +++- .../EventHubMessageConverterTest.java | 8 +- .../inbound/EventHubInboundAdapterTest.java | 19 ++- .../outbound/EventHubMessageHandlerTest.java | 18 ++- .../ServiceBusMessageHandlerTest.java | 20 ++- .../ServiceBusTemplateSendTest.java | 4 +- .../ServiceBusMessageConverterTest.java | 63 ++++++---- .../queue/QueueTemplateSendTest.java | 19 ++- .../queue/QueueTemplateSubscribeTest.java | 18 ++- .../ServiceBusQueueInboundAdapterTest.java | 15 ++- ...eBusQueueOperationDeadLetterQueueTest.java | 20 ++- ...iceBusQueueOperationSendSubscribeTest.java | 36 +++--- .../ServiceBusTopicInboundAdapterTest.java | 14 ++- ...iceBusTopicOperationSendSubscribeTest.java | 34 ++--- .../topic/TopicTemplateSendTest.java | 17 ++- .../topic/TopicTemplateSubscribeTest.java | 19 +-- .../queue/StorageQueueMessageSourceTest.java | 34 +++-- .../StorageQueueTemplateReceiveTest.java | 35 ++++-- .../queue/StorageQueueTemplateSendTest.java | 34 +++-- .../azure-spring-integration-test/pom.xml | 5 - .../support/InboundChannelAdapterTest.java | 12 +- .../test/support/MessageHandlerTest.java | 10 +- .../test/support/SendOperationTest.java | 20 ++- .../support/SendSubscribeOperationTest.java | 12 +- .../SubscribeByGroupOperationTest.java | 6 +- .../test/support/SubscribeOperationTest.java | 6 +- .../UnaryAzureMessageConverterTest.java | 10 +- .../support/reactor/MessageHandlerTest.java | 20 ++- .../support/reactor/SendOperationTest.java | 18 +-- .../reactor/SendSubscribeOperationTest.java | 13 +- .../rx/RxSendSubscribeOperationTest.java | 6 +- 156 files changed, 1411 insertions(+), 1762 deletions(-) diff --git a/sdk/spring/azure-identity-spring/pom.xml b/sdk/spring/azure-identity-spring/pom.xml index 5f2c71058d68..2a6d39cb9f6e 100644 --- a/sdk/spring/azure-identity-spring/pom.xml +++ b/sdk/spring/azure-identity-spring/pom.xml @@ -41,29 +41,13 @@ azure-identity 1.3.0 + + - org.junit.jupiter - junit-jupiter-api - 5.7.2 - test - - - org.junit.jupiter - junit-jupiter-params - 5.7.2 - test - - - org.junit.jupiter - junit-jupiter-engine - 5.7.2 - test - - - junit - junit + org.springframework.boot + spring-boot-starter-test + 2.5.0 test - 4.13.2 diff --git a/sdk/spring/azure-spring-boot-samples/azure-appconfiguration-conversion-sample-complete/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-appconfiguration-conversion-sample-complete/pom.xml index b20f724d48bf..e8265edb3898 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-appconfiguration-conversion-sample-complete/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-appconfiguration-conversion-sample-complete/pom.xml @@ -45,36 +45,9 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator - - org.springframework.boot - spring-boot-starter-test - test - diff --git a/sdk/spring/azure-spring-boot-samples/azure-appconfiguration-conversion-sample-initial/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-appconfiguration-conversion-sample-initial/pom.xml index 7fc087c3c189..d367bafb9b3f 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-appconfiguration-conversion-sample-initial/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-appconfiguration-conversion-sample-initial/pom.xml @@ -41,36 +41,9 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator - - org.springframework.boot - spring-boot-starter-test - test - diff --git a/sdk/spring/azure-spring-boot-samples/azure-appconfiguration-sample/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-appconfiguration-sample/pom.xml index a3eaadd49f3e..690564e04004 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-appconfiguration-sample/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-appconfiguration-sample/pom.xml @@ -38,36 +38,9 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator - - org.springframework.boot - spring-boot-starter-test - test - diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-keyvault-certificates-server-side/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-keyvault-certificates-server-side/pom.xml index 076ca691f01b..25810e73cfa7 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-keyvault-certificates-server-side/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-keyvault-certificates-server-side/pom.xml @@ -84,17 +84,6 @@ --> - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - com.azure.spring azure-spring-boot-starter-keyvault-certificates diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue/pom.xml index 4d3e7ea6be67..e9cd55f30ecc 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue/pom.xml @@ -41,24 +41,10 @@ 3.6.0-beta.1 - - junit - junit - test - + org.springframework.boot - spring-boot-test-autoconfigure - test - - - org.springframework - spring-test - test - - - org.assertj - assertj-core + spring-boot-starter-test test diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue/src/test/java/com/azure/spring/sample/jms/queue/ServiceBusJMSQueueApplicationIT.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue/src/test/java/com/azure/spring/sample/jms/queue/ServiceBusJMSQueueApplicationIT.java index a6b2b8a19613..45ab1b798072 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue/src/test/java/com/azure/spring/sample/jms/queue/ServiceBusJMSQueueApplicationIT.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue/src/test/java/com/azure/spring/sample/jms/queue/ServiceBusJMSQueueApplicationIT.java @@ -3,15 +3,15 @@ package com.azure.spring.sample.jms.queue; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.system.OutputCaptureRule; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.UUID; @@ -21,20 +21,17 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) @SpringBootTest(classes = ServiceBusJMSQueueApplication.class) @AutoConfigureMockMvc @TestPropertySource(locations = "classpath:application-test.properties") +@ExtendWith({ OutputCaptureExtension.class, MockitoExtension.class }) public class ServiceBusJMSQueueApplicationIT { @Autowired private MockMvc mvc; - @Rule - public OutputCaptureRule outputCaptureRule = new OutputCaptureRule(); - @Test - public void testQueueSendAndReceiveMessage() throws Exception { + public void testQueueSendAndReceiveMessage(CapturedOutput capture) throws Exception { final String message = UUID.randomUUID().toString(); mvc.perform(post("/queue?message=" + message)).andExpect(status().isOk()) @@ -45,7 +42,7 @@ public void testQueueSendAndReceiveMessage() throws Exception { boolean messageReceived = false; for (int i = 0; i < 100; i++) { - final String output = outputCaptureRule.toString(); + final String output = capture.toString(); if (!messageReceived && output.contains(messageReceivedLog)) { messageReceived = true; } diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic/pom.xml index 1b1bc3a8db71..bdcedb81baab 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic/pom.xml @@ -41,24 +41,10 @@ 3.6.0-beta.1 - - junit - junit - test - + org.springframework.boot - spring-boot-test-autoconfigure - test - - - org.springframework - spring-test - test - - - org.assertj - assertj-core + spring-boot-starter-test test diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic/src/test/java/com/azure/spring/sample/jms/topic/ServiceBusJMSTopicApplicationIT.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic/src/test/java/com/azure/spring/sample/jms/topic/ServiceBusJMSTopicApplicationIT.java index 574622d2eb53..268199672135 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic/src/test/java/com/azure/spring/sample/jms/topic/ServiceBusJMSTopicApplicationIT.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic/src/test/java/com/azure/spring/sample/jms/topic/ServiceBusJMSTopicApplicationIT.java @@ -3,15 +3,16 @@ package com.azure.spring.sample.jms.topic; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.boot.test.system.OutputCaptureRule; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.UUID; @@ -21,31 +22,28 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) @SpringBootTest(classes = ServiceBusJMSTopicApplication.class) @AutoConfigureMockMvc @TestPropertySource(locations = "classpath:application-test.properties") +@ExtendWith({ OutputCaptureExtension.class, MockitoExtension.class }) public class ServiceBusJMSTopicApplicationIT { @Autowired private MockMvc mvc; - @Rule - public OutputCaptureRule outputCaptureRule = new OutputCaptureRule(); - @Test - public void testTopicSendAndReceiveMessage() throws Exception { + public void testTopicSendAndReceiveMessage(CapturedOutput capture) throws Exception { final String message = UUID.randomUUID().toString(); mvc.perform(post("/topic?message=" + message)).andExpect(status().isOk()) - .andExpect(content().string(message)); + .andExpect(content().string(message)); final String messageReceivedLog = String.format("Received message from topic: %s", message); boolean messageReceived = false; for (int i = 0; i < 100; i++) { - final String output = outputCaptureRule.toString(); + final String output = capture.toString(); if (!messageReceived && output.contains(messageReceivedLog)) { messageReceived = true; } diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-cache/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-cache/pom.xml index 76341fc73b13..1ec43d311127 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-cache/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-cache/pom.xml @@ -45,32 +45,16 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - org.mockito mockito-core test - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-cache/src/test/java/com/azure/spring/sample/cache/CacheApplicationIT.java b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-cache/src/test/java/com/azure/spring/sample/cache/CacheApplicationIT.java index 56015c070902..22c4f780bd9d 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-cache/src/test/java/com/azure/spring/sample/cache/CacheApplicationIT.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-cache/src/test/java/com/azure/spring/sample/cache/CacheApplicationIT.java @@ -3,14 +3,14 @@ package com.azure.spring.sample.cache; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.UUID; @@ -19,11 +19,11 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) @SpringBootTest(classes = CacheApplication.class) @AutoConfigureMockMvc @TestPropertySource( locations = "classpath:application-test.properties") +@ExtendWith({ MockitoExtension.class }) public class CacheApplicationIT { @Autowired @@ -35,7 +35,7 @@ public void testGetSuccess() String key = "key" + UUID.randomUUID(); mvc.perform(get("/" + key) .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string("Hello " + key)); + .andExpect(status().isOk()) + .andExpect(content().string("Hello " + key)); } } diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-binder/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-binder/pom.xml index b97fd3f08766..216478b1e2c6 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-binder/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-binder/pom.xml @@ -54,49 +54,16 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator + org.springframework.boot spring-boot-starter-test test - - org.junit.jupiter - junit-jupiter-engine - 5.7.2 - test - - - org.junit.vintage - junit-vintage-engine - 5.7.2 - test - diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-kafka/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-kafka/pom.xml index 13c62686f68f..7bdd5af8de0c 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-kafka/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-kafka/pom.xml @@ -54,49 +54,16 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator + org.springframework.boot spring-boot-starter-test test - - org.junit.jupiter - junit-jupiter-engine - 5.7.2 - test - - - org.junit.vintage - junit-vintage-engine - 5.7.2 - test - diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-multibinders/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-multibinders/pom.xml index 50c6aacedf0e..1ca839391544 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-multibinders/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-multibinders/pom.xml @@ -46,32 +46,11 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-multibinders/src/test/java/com/azure/spring/sample/eventhubs/multibinders/EventHubMultiBindersApplicationIT.java b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-multibinders/src/test/java/com/azure/spring/sample/eventhubs/multibinders/EventHubMultiBindersApplicationIT.java index 78e667a979c5..2c31088f06dc 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-multibinders/src/test/java/com/azure/spring/sample/eventhubs/multibinders/EventHubMultiBindersApplicationIT.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-multibinders/src/test/java/com/azure/spring/sample/eventhubs/multibinders/EventHubMultiBindersApplicationIT.java @@ -3,15 +3,15 @@ package com.azure.spring.sample.eventhubs.multibinders; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.system.OutputCaptureRule; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.UUID; @@ -21,23 +21,21 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) @SpringBootTest(classes = EventHubMultiBindersApplication.class) @AutoConfigureMockMvc @TestPropertySource(locations = "classpath:application-test.properties") +@ExtendWith({ OutputCaptureExtension.class, MockitoExtension.class }) public class EventHubMultiBindersApplicationIT { - @Rule - public OutputCaptureRule capture = new OutputCaptureRule(); @Autowired private MockMvc mvc; @Test - public void testSendAndReceiveMessage() throws Exception { + public void testSendAndReceiveMessage(CapturedOutput capture) throws Exception { String message = UUID.randomUUID().toString(); mvc.perform(post("/messages?message=" + message)).andExpect(status().isOk()) - .andExpect(content().string(message)); + .andExpect(content().string(message)); String messageReceivedLog = String.format("[1] New message received: '%s'", message); String messageCheckpointedLog = String.format("[1] Message '%s' successfully checkpointed", message); @@ -64,11 +62,11 @@ public void testSendAndReceiveMessage() throws Exception { } @Test - public void testSendAndReceiveMessage_2() throws Exception { + public void testSendAndReceiveMessage_2(CapturedOutput capture) throws Exception { String message = UUID.randomUUID().toString(); mvc.perform(post("/messages1?message=" + message)).andExpect(status().isOk()) - .andExpect(content().string(message)); + .andExpect(content().string(message)); String messageReceivedLog = String.format("[2] New message received: '%s'", message); String messageCheckpointedLog = String.format("[2] Message '%s' successfully checkpointed", message); diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-operation/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-operation/pom.xml index e8a3aae8543d..ba5a286c70bb 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-operation/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-operation/pom.xml @@ -45,32 +45,11 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-operation/src/test/java/com/azure/spring/sample/eventhubs/operation/EventHubOperationApplicationIT.java b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-operation/src/test/java/com/azure/spring/sample/eventhubs/operation/EventHubOperationApplicationIT.java index 848c1ab950ac..2cc8e1f4d1e6 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-operation/src/test/java/com/azure/spring/sample/eventhubs/operation/EventHubOperationApplicationIT.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-operation/src/test/java/com/azure/spring/sample/eventhubs/operation/EventHubOperationApplicationIT.java @@ -3,15 +3,15 @@ package com.azure.spring.sample.eventhubs.operation; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.system.OutputCaptureRule; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.UUID; @@ -21,19 +21,17 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) @SpringBootTest(classes = EventHubOperationApplication.class) @AutoConfigureMockMvc @TestPropertySource(locations = "classpath:application-test.properties") +@ExtendWith({ OutputCaptureExtension.class, MockitoExtension.class }) public class EventHubOperationApplicationIT { - @Rule - public OutputCaptureRule capture = new OutputCaptureRule(); @Autowired private MockMvc mvc; @Test - public void testSendAndReceiveMessage() throws Exception { + public void testSendAndReceiveMessage(CapturedOutput capture) throws Exception { String message = UUID.randomUUID().toString(); mvc.perform(post("/messages?message=" + message)).andExpect(status().isOk()) diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-messaging-eventhubs/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-messaging-eventhubs/pom.xml index 02c4542e24f6..896c6e967c2b 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-messaging-eventhubs/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-messaging-eventhubs/pom.xml @@ -49,37 +49,10 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator - - org.springframework.boot - spring-boot-starter-test - test - diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-messaging-servicebus/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-messaging-servicebus/pom.xml index 2da8a29b54d3..e51329fa2bc8 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-messaging-servicebus/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-messaging-servicebus/pom.xml @@ -36,37 +36,10 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator - - org.springframework.boot - spring-boot-starter-test - test - diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-operation/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-operation/pom.xml index c0f906e78f04..454c79f2f95d 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-operation/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-operation/pom.xml @@ -45,32 +45,11 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-operation/src/test/java/com/azure/spring/sample/servicebus/operation/ServiceBusOperationApplicationIT.java b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-operation/src/test/java/com/azure/spring/sample/servicebus/operation/ServiceBusOperationApplicationIT.java index 87c2c3895148..8520a2f5fcc1 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-operation/src/test/java/com/azure/spring/sample/servicebus/operation/ServiceBusOperationApplicationIT.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-operation/src/test/java/com/azure/spring/sample/servicebus/operation/ServiceBusOperationApplicationIT.java @@ -3,15 +3,15 @@ package com.azure.spring.sample.servicebus.operation; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.system.OutputCaptureRule; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.UUID; @@ -21,34 +21,32 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) @SpringBootTest(classes = ServiceBusOperationApplication.class) @AutoConfigureMockMvc @TestPropertySource(locations = "classpath:application-test.properties") +@ExtendWith({ OutputCaptureExtension.class, MockitoExtension.class }) public class ServiceBusOperationApplicationIT { - @Rule - public OutputCaptureRule capture = new OutputCaptureRule(); @Autowired private MockMvc mvc; @Test - public void testQueueSendAndReceiveMessage() throws Exception { - testSendAndReceiveMessage("queues"); + public void testQueueSendAndReceiveMessage(CapturedOutput capture) throws Exception { + testSendAndReceiveMessage("queues", capture); } @Test - public void testTopicSendAndReceiveMessage() throws Exception { - testSendAndReceiveMessage("topics"); + public void testTopicSendAndReceiveMessage(CapturedOutput capture) throws Exception { + testSendAndReceiveMessage("topics", capture); } - private void testSendAndReceiveMessage(String url) throws Exception { + private void testSendAndReceiveMessage(String url, CapturedOutput capture) throws Exception { String message = UUID.randomUUID().toString(); String urlTemplate = String.format("/%s?message=%s", url, message); mvc.perform(post(urlTemplate)).andExpect(status().isOk()) - .andExpect(content().string(message)); + .andExpect(content().string(message)); String messageReceivedLog = String.format("New message received: '%s'", message); String messageCheckpointedLog = String.format("Message '%s' successfully checkpointed", message); diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-binder/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-binder/pom.xml index 67e32c99f6a1..6c6d0f6d709f 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-binder/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-binder/pom.xml @@ -45,32 +45,11 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-binder/src/test/java/com/azure/spring/sample/servicebus/queue/binder/ServiceBusQueueBinderApplicationIT.java b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-binder/src/test/java/com/azure/spring/sample/servicebus/queue/binder/ServiceBusQueueBinderApplicationIT.java index f23b162a46a7..df69f0cc9298 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-binder/src/test/java/com/azure/spring/sample/servicebus/queue/binder/ServiceBusQueueBinderApplicationIT.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-binder/src/test/java/com/azure/spring/sample/servicebus/queue/binder/ServiceBusQueueBinderApplicationIT.java @@ -3,15 +3,15 @@ package com.azure.spring.sample.servicebus.queue.binder; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.system.OutputCaptureRule; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.UUID; @@ -21,19 +21,17 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) @SpringBootTest(classes = ServiceBusQueueBinderApplication.class) @AutoConfigureMockMvc @TestPropertySource(locations = "classpath:application-test.properties") +@ExtendWith({ OutputCaptureExtension.class, MockitoExtension.class }) public class ServiceBusQueueBinderApplicationIT { - @Rule - public OutputCaptureRule capture = new OutputCaptureRule(); @Autowired private MockMvc mvc; @Test - public void testSendAndReceiveMessage() throws Exception { + public void testSendAndReceiveMessage(CapturedOutput capture) throws Exception { String message = UUID.randomUUID().toString(); mvc.perform(post("/messages?message=" + message)).andExpect(status().isOk()) diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-multibinders/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-multibinders/pom.xml index 5135fdda1773..7fb06e4ecba8 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-multibinders/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-multibinders/pom.xml @@ -45,32 +45,11 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-multibinders/src/test/java/com/azure/spring/sample/servicebus/queue/multibinders/ServiceBusQueueMultiBindersApplicationIT.java b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-multibinders/src/test/java/com/azure/spring/sample/servicebus/queue/multibinders/ServiceBusQueueMultiBindersApplicationIT.java index a7a336ba19c4..4f10e03bc4f0 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-multibinders/src/test/java/com/azure/spring/sample/servicebus/queue/multibinders/ServiceBusQueueMultiBindersApplicationIT.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-queue-multibinders/src/test/java/com/azure/spring/sample/servicebus/queue/multibinders/ServiceBusQueueMultiBindersApplicationIT.java @@ -3,15 +3,15 @@ package com.azure.spring.sample.servicebus.queue.multibinders; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.system.OutputCaptureRule; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.UUID; @@ -21,19 +21,18 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) + @SpringBootTest(classes = ServiceBusQueueMultiBindersApplication.class) @AutoConfigureMockMvc @TestPropertySource(locations = "classpath:application-test.properties") +@ExtendWith({ OutputCaptureExtension.class, MockitoExtension.class }) public class ServiceBusQueueMultiBindersApplicationIT { - @Rule - public OutputCaptureRule capture = new OutputCaptureRule(); @Autowired private MockMvc mvc; @Test - public void testSendAndReceiveMessage() throws Exception { + public void testSendAndReceiveMessage(CapturedOutput capture) throws Exception { String message = UUID.randomUUID().toString(); mvc.perform(post("/messages?message=" + message)).andExpect(status().isOk()) @@ -64,7 +63,7 @@ public void testSendAndReceiveMessage() throws Exception { } @Test - public void testSendAndReceiveMessage_2() throws Exception { + public void testSendAndReceiveMessage_2(CapturedOutput capture) throws Exception { String message = UUID.randomUUID().toString(); mvc.perform(post("/messages1?message=" + message)).andExpect(status().isOk()) diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-topic-binder/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-topic-binder/pom.xml index 35c7b8fd3c2d..6de18cb00d45 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-topic-binder/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-topic-binder/pom.xml @@ -45,32 +45,11 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-topic-binder/src/test/java/com/azure/spring/sample/servicebus/topic/binder/ServiceBusTopicBinderApplicationIT.java b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-topic-binder/src/test/java/com/azure/spring/sample/servicebus/topic/binder/ServiceBusTopicBinderApplicationIT.java index 75ac29d38cb0..3dbb2b4ebc16 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-topic-binder/src/test/java/com/azure/spring/sample/servicebus/topic/binder/ServiceBusTopicBinderApplicationIT.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-servicebus-topic-binder/src/test/java/com/azure/spring/sample/servicebus/topic/binder/ServiceBusTopicBinderApplicationIT.java @@ -3,15 +3,15 @@ package com.azure.spring.sample.servicebus.topic.binder; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.system.OutputCaptureRule; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.UUID; @@ -21,19 +21,17 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) @SpringBootTest(classes = ServiceBusTopicBinderApplication.class) @AutoConfigureMockMvc @TestPropertySource(locations = "classpath:application-test.properties") +@ExtendWith({ OutputCaptureExtension.class, MockitoExtension.class }) public class ServiceBusTopicBinderApplicationIT { - @Rule - public OutputCaptureRule capture = new OutputCaptureRule(); @Autowired private MockMvc mvc; @Test - public void testSendAndReceiveMessage() throws Exception { + public void testSendAndReceiveMessage(CapturedOutput capture) throws Exception { String message = UUID.randomUUID().toString(); mvc.perform(post("/messages?message=" + message)).andExpect(status().isOk()) diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-storage-queue-operation/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-storage-queue-operation/pom.xml index 7654dd0c6b81..25d97a781602 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-storage-queue-operation/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-storage-queue-operation/pom.xml @@ -45,32 +45,11 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-storage-queue-operation/src/test/java/com/azure/spring/sample/storage/queue/operation/StorageQueueOperationApplicationIT.java b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-storage-queue-operation/src/test/java/com/azure/spring/sample/storage/queue/operation/StorageQueueOperationApplicationIT.java index f3c023459e80..ac89d08b43f1 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-storage-queue-operation/src/test/java/com/azure/spring/sample/storage/queue/operation/StorageQueueOperationApplicationIT.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-cloud-sample-storage-queue-operation/src/test/java/com/azure/spring/sample/storage/queue/operation/StorageQueueOperationApplicationIT.java @@ -3,14 +3,14 @@ package com.azure.spring.sample.storage.queue.operation; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.UUID; @@ -20,10 +20,10 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) @SpringBootTest(classes = StorageQueueOperationApplication.class) @AutoConfigureMockMvc @TestPropertySource(locations = "classpath:application-test.properties") +@ExtendWith({ MockitoExtension.class }) public class StorageQueueOperationApplicationIT { @Autowired @@ -34,13 +34,13 @@ public void testSendAndReceiveMessage() throws Exception { String message = UUID.randomUUID().toString(); mvc.perform(post("/messages?message=" + message)).andExpect(status().isOk()) - .andExpect(content().string(message)); + .andExpect(content().string(message)); Thread.sleep(1_000L); mvc.perform(get("/messages") .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(message)); + .andExpect(status().isOk()) + .andExpect(content().string(message)); } } diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-eventhubs/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-eventhubs/pom.xml index 742b6ef9939a..74cb2908e99f 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-eventhubs/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-eventhubs/pom.xml @@ -45,32 +45,11 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-eventhubs/src/test/java/com/azure/spring/sample/eventhubs/EventHubOperationApplicationIT.java b/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-eventhubs/src/test/java/com/azure/spring/sample/eventhubs/EventHubOperationApplicationIT.java index 279d08c3e139..2aae44471f5c 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-eventhubs/src/test/java/com/azure/spring/sample/eventhubs/EventHubOperationApplicationIT.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-eventhubs/src/test/java/com/azure/spring/sample/eventhubs/EventHubOperationApplicationIT.java @@ -3,15 +3,15 @@ package com.azure.spring.sample.eventhubs; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.system.OutputCaptureRule; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.UUID; @@ -21,19 +21,18 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) + @SpringBootTest(classes = EventHubIntegrationApplication.class) @AutoConfigureMockMvc @TestPropertySource(locations = "classpath:application-test.properties") +@ExtendWith({ OutputCaptureExtension.class, MockitoExtension.class }) public class EventHubOperationApplicationIT { - @Rule - public OutputCaptureRule capture = new OutputCaptureRule(); @Autowired private MockMvc mvc; @Test - public void testSendAndReceiveMessage() throws Exception { + public void testSendAndReceiveMessage(CapturedOutput capture) throws Exception { String message = UUID.randomUUID().toString(); mvc.perform(post("/messages?message=" + message)).andExpect(status().isOk()) diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-servicebus/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-servicebus/pom.xml index 10dbde49b77d..722c114e48a8 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-servicebus/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-servicebus/pom.xml @@ -45,32 +45,11 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-servicebus/src/test/java/com/azure/spring/sample/servicebus/ServiceBusIntegrationApplicationIT.java b/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-servicebus/src/test/java/com/azure/spring/sample/servicebus/ServiceBusIntegrationApplicationIT.java index d9de40f6c8bd..1adeac613d84 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-servicebus/src/test/java/com/azure/spring/sample/servicebus/ServiceBusIntegrationApplicationIT.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-servicebus/src/test/java/com/azure/spring/sample/servicebus/ServiceBusIntegrationApplicationIT.java @@ -3,15 +3,15 @@ package com.azure.spring.sample.servicebus; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.system.OutputCaptureRule; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.UUID; @@ -21,34 +21,32 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) @SpringBootTest(classes = ServiceBusIntegrationApplication.class) @AutoConfigureMockMvc @TestPropertySource(locations = "classpath:application-test.properties") +@ExtendWith({ OutputCaptureExtension.class, MockitoExtension.class }) public class ServiceBusIntegrationApplicationIT { - @Rule - public OutputCaptureRule capture = new OutputCaptureRule(); @Autowired private MockMvc mvc; @Test - public void testQueueSendAndReceiveMessage() throws Exception { - testSendAndReceiveMessage("queues"); + public void testQueueSendAndReceiveMessage(CapturedOutput capture) throws Exception { + testSendAndReceiveMessage("queues", capture); } @Test - public void testTopicSendAndReceiveMessage() throws Exception { - testSendAndReceiveMessage("topics"); + public void testTopicSendAndReceiveMessage(CapturedOutput capture) throws Exception { + testSendAndReceiveMessage("topics", capture); } - private void testSendAndReceiveMessage(String url) throws Exception { + private void testSendAndReceiveMessage(String url, CapturedOutput capture) throws Exception { String message = UUID.randomUUID().toString(); String urlTemplate = String.format("/%s?message=%s", url, message); mvc.perform(post(urlTemplate)).andExpect(status().isOk()) - .andExpect(content().string(message)); + .andExpect(content().string(message)); String messageReceivedLog = String.format("New message received: '%s'", message); String messageCheckpointedLog = String.format("Message '%s' successfully checkpointed", message); diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-storage-queue/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-storage-queue/pom.xml index c76fe0ca5ebb..afce41995a0c 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-storage-queue/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-storage-queue/pom.xml @@ -49,32 +49,11 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-storage-queue/src/test/java/com/azure/spring/sample/storage/queue/StorageQueueIntegrationApplicationIT.java b/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-storage-queue/src/test/java/com/azure/spring/sample/storage/queue/StorageQueueIntegrationApplicationIT.java index 90627a46c3db..7659cdab9d56 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-storage-queue/src/test/java/com/azure/spring/sample/storage/queue/StorageQueueIntegrationApplicationIT.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-integration-sample-storage-queue/src/test/java/com/azure/spring/sample/storage/queue/StorageQueueIntegrationApplicationIT.java @@ -3,15 +3,15 @@ package com.azure.spring.sample.storage.queue; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.system.OutputCaptureRule; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.util.UUID; @@ -21,23 +21,21 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@RunWith(SpringRunner.class) @SpringBootTest(classes = StorageQueueIntegrationApplication.class) @AutoConfigureMockMvc @TestPropertySource(locations = "classpath:application-test.properties") +@ExtendWith({ OutputCaptureExtension.class, MockitoExtension.class }) public class StorageQueueIntegrationApplicationIT { - @Rule - public OutputCaptureRule capture = new OutputCaptureRule(); @Autowired private MockMvc mvc; @Test - public void testSendAndReceiveMessage() throws Exception { + public void testSendAndReceiveMessage(CapturedOutput capture) throws Exception { String message = UUID.randomUUID().toString(); mvc.perform(post("/messages?message=" + message)).andExpect(status().isOk()) - .andExpect(content().string(message)); + .andExpect(content().string(message)); String messageReceivedLog = String.format("New message received: '%s'", message); String messageCheckpointedLog = String.format("Message '%s' successfully checkpointed", message); diff --git a/sdk/spring/azure-spring-boot-samples/feature-management-sample/pom.xml b/sdk/spring/azure-spring-boot-samples/feature-management-sample/pom.xml index 361ab9bc8e03..5d078edfe7d6 100644 --- a/sdk/spring/azure-spring-boot-samples/feature-management-sample/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/feature-management-sample/pom.xml @@ -38,36 +38,9 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator - - org.springframework.boot - spring-boot-starter-test - test - diff --git a/sdk/spring/azure-spring-boot-samples/feature-management-web-sample/pom.xml b/sdk/spring/azure-spring-boot-samples/feature-management-web-sample/pom.xml index 8b1c80fb8ee6..5853edd70d4e 100644 --- a/sdk/spring/azure-spring-boot-samples/feature-management-web-sample/pom.xml +++ b/sdk/spring/azure-spring-boot-samples/feature-management-web-sample/pom.xml @@ -51,36 +51,9 @@ org.springframework.boot spring-boot-starter-logging - - junit - junit - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - org.hibernate.validator hibernate-validator - - org.springframework.boot - spring-boot-starter-test - test - diff --git a/sdk/spring/azure-spring-boot-starter-keyvault-certificates/pom.xml b/sdk/spring/azure-spring-boot-starter-keyvault-certificates/pom.xml index 3b82cb8a43e7..dbf3a5120f8f 100644 --- a/sdk/spring/azure-spring-boot-starter-keyvault-certificates/pom.xml +++ b/sdk/spring/azure-spring-boot-starter-keyvault-certificates/pom.xml @@ -46,6 +46,8 @@ 2.5.0 true + + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-test-aad-b2c/pom.xml b/sdk/spring/azure-spring-boot-test-aad-b2c/pom.xml index 496df274b630..786ad4194074 100644 --- a/sdk/spring/azure-spring-boot-test-aad-b2c/pom.xml +++ b/sdk/spring/azure-spring-boot-test-aad-b2c/pom.xml @@ -52,6 +52,7 @@ 1.0.0 test + ch.qos.logback logback-core @@ -64,13 +65,6 @@ ch.qos.logback logback-classic - - - junit - junit - 4.13.2 - test - \ No newline at end of file diff --git a/sdk/spring/azure-spring-boot-test-aad/pom.xml b/sdk/spring/azure-spring-boot-test-aad/pom.xml index 6395e861d8d9..745c0634f767 100644 --- a/sdk/spring/azure-spring-boot-test-aad/pom.xml +++ b/sdk/spring/azure-spring-boot-test-aad/pom.xml @@ -33,6 +33,7 @@ spring-boot-starter-oauth2-client + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-test-application/pom.xml b/sdk/spring/azure-spring-boot-test-application/pom.xml index c1eb25fade0f..690f22c153c5 100644 --- a/sdk/spring/azure-spring-boot-test-application/pom.xml +++ b/sdk/spring/azure-spring-boot-test-application/pom.xml @@ -27,6 +27,7 @@ org.springframework.boot spring-boot-starter-web + org.springframework.boot spring-boot-starter-test diff --git a/sdk/spring/azure-spring-boot-test-core/pom.xml b/sdk/spring/azure-spring-boot-test-core/pom.xml index 40147c305502..ff10e2536370 100644 --- a/sdk/spring/azure-spring-boot-test-core/pom.xml +++ b/sdk/spring/azure-spring-boot-test-core/pom.xml @@ -80,12 +80,5 @@ spring-boot-starter-test test - - - junit - junit - 4.13.2 - test - diff --git a/sdk/spring/azure-spring-boot-test-core/src/main/java/com/azure/spring/test/EnvironmentVariable.java b/sdk/spring/azure-spring-boot-test-core/src/main/java/com/azure/spring/test/EnvironmentVariable.java index 3c2217e498b5..b57f2929379a 100644 --- a/sdk/spring/azure-spring-boot-test-core/src/main/java/com/azure/spring/test/EnvironmentVariable.java +++ b/sdk/spring/azure-spring-boot-test-core/src/main/java/com/azure/spring/test/EnvironmentVariable.java @@ -44,6 +44,7 @@ public class EnvironmentVariable { public static final String SPRING_CLIENT_ID = System.getenv("SPRING_CLIENT_ID"); public static final String SPRING_CLIENT_SECRET = System.getenv("SPRING_CLIENT_SECRET"); public static final String SPRING_RESOURCE_GROUP = System.getenv("SPRING_RESOURCE_GROUP"); + public static final String KEY_VAULT_SPRING_RESOURCE_GROUP = System.getenv("KEY_VAULT_SPRING_RESOURCE_GROUP"); public static final String SPRING_SUBSCRIPTION_ID = System.getenv("SPRING_SUBSCRIPTION_ID"); public static final String SPRING_TENANT_ID = System.getenv("SPRING_TENANT_ID"); public static final String SPRING_JMS_STANDARD_SERVICEBUS_CONNECTION_STRING = System.getenv("SPRING_JMS_STANDARD_SERVICEBUS_CONNECTION_STRING"); diff --git a/sdk/spring/azure-spring-boot-test-core/src/test/java/com/azure/spring/test/aad/ropc/AADOauth2ROPCGrantClientIT.java b/sdk/spring/azure-spring-boot-test-core/src/test/java/com/azure/spring/test/aad/ropc/AADOauth2ROPCGrantClientIT.java index 8d520e97d7a9..10923faf6dd8 100644 --- a/sdk/spring/azure-spring-boot-test-core/src/test/java/com/azure/spring/test/aad/ropc/AADOauth2ROPCGrantClientIT.java +++ b/sdk/spring/azure-spring-boot-test-core/src/test/java/com/azure/spring/test/aad/ropc/AADOauth2ROPCGrantClientIT.java @@ -3,7 +3,7 @@ package com.azure.spring.test.aad.ropc; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static com.azure.spring.test.Constant.MULTI_TENANT_SCOPE_GRAPH_READ; import static com.azure.spring.test.EnvironmentVariable.AAD_MULTI_TENANT_CLIENT_ID; @@ -11,7 +11,7 @@ import static com.azure.spring.test.EnvironmentVariable.AAD_TENANT_ID_1; import static com.azure.spring.test.EnvironmentVariable.AAD_USER_NAME_1; import static com.azure.spring.test.EnvironmentVariable.AAD_USER_PASSWORD_1; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; public class AADOauth2ROPCGrantClientIT { @@ -19,12 +19,12 @@ public class AADOauth2ROPCGrantClientIT { public void getOAuth2ROPCResponseByROPCGrantTest() { AADOauth2ROPCGrantClient.OAuth2ROPCResponse oAuth2ROPCResponse = AADOauth2ROPCGrantClient.getOAuth2ROPCResponseByROPCGrant( - AAD_TENANT_ID_1, - AAD_MULTI_TENANT_CLIENT_ID, - AAD_MULTI_TENANT_CLIENT_SECRET, - AAD_USER_NAME_1, - AAD_USER_PASSWORD_1, - MULTI_TENANT_SCOPE_GRAPH_READ); + AAD_TENANT_ID_1, + AAD_MULTI_TENANT_CLIENT_ID, + AAD_MULTI_TENANT_CLIENT_SECRET, + AAD_USER_NAME_1, + AAD_USER_PASSWORD_1, + MULTI_TENANT_SCOPE_GRAPH_READ); assertNotNull(oAuth2ROPCResponse); } } diff --git a/sdk/spring/azure-spring-boot-test-cosmos/pom.xml b/sdk/spring/azure-spring-boot-test-cosmos/pom.xml index 8df1fd7c6338..8db133663d8c 100644 --- a/sdk/spring/azure-spring-boot-test-cosmos/pom.xml +++ b/sdk/spring/azure-spring-boot-test-cosmos/pom.xml @@ -27,11 +27,6 @@ azure-spring-boot-test-core 1.0.0 - - org.springframework.boot - spring-boot-starter-test - test - org.springframework.boot spring-boot-starter-actuator @@ -44,11 +39,10 @@ io.projectreactor.netty reactor-netty - + - junit - junit - 4.13.2 + org.springframework.boot + spring-boot-starter-test test diff --git a/sdk/spring/azure-spring-boot-test-cosmos/src/test/java/com/azure/test/cosmos/CosmosActuatorIT.java b/sdk/spring/azure-spring-boot-test-cosmos/src/test/java/com/azure/test/cosmos/CosmosActuatorIT.java index ed5b5eec7415..e17f80f51532 100644 --- a/sdk/spring/azure-spring-boot-test-cosmos/src/test/java/com/azure/test/cosmos/CosmosActuatorIT.java +++ b/sdk/spring/azure-spring-boot-test-cosmos/src/test/java/com/azure/test/cosmos/CosmosActuatorIT.java @@ -4,8 +4,8 @@ package com.azure.test.cosmos; import com.azure.spring.test.AppRunner; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.web.client.RestTemplate; public class CosmosActuatorIT { @@ -31,7 +31,7 @@ public void testCosmosSpringBootActuatorHealth() { final String response = REST_TEMPLATE.getForObject( "http://localhost:" + app.port() + "/actuator/health/cosmos", String.class); - Assert.assertTrue(response != null && response.contains("\"status\":\"UP\"")); + Assertions.assertTrue(response != null && response.contains("\"status\":\"UP\"")); } } } diff --git a/sdk/spring/azure-spring-boot-test-cosmos/src/test/java/com/azure/test/cosmos/CosmosIT.java b/sdk/spring/azure-spring-boot-test-cosmos/src/test/java/com/azure/test/cosmos/CosmosIT.java index 6a7292aeae1e..1f1eada24a57 100644 --- a/sdk/spring/azure-spring-boot-test-cosmos/src/test/java/com/azure/test/cosmos/CosmosIT.java +++ b/sdk/spring/azure-spring-boot-test-cosmos/src/test/java/com/azure/test/cosmos/CosmosIT.java @@ -5,9 +5,9 @@ import com.azure.spring.autoconfigure.aad.AADAuthenticationFilterAutoConfiguration; import com.azure.spring.test.AppRunner; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Disabled; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.NoSuchBeanDefinitionException; @@ -16,6 +16,8 @@ import java.util.Optional; +import static org.junit.jupiter.api.Assertions.assertThrows; + public class CosmosIT { private static final Logger LOGGER = LoggerFactory.getLogger(CosmosIT.class); @@ -23,8 +25,8 @@ public class CosmosIT { private static final String AZURE_COSMOS_ACCOUNT_KEY = System.getenv("AZURE_COSMOS_ACCOUNT_KEY"); private static final String AZURE_COSMOS_DATABASE_NAME = System.getenv("AZURE_COSMOS_DATABASE_NAME"); - @Test(expected = NoSuchBeanDefinitionException.class) - @Ignore + @Disabled + @Test public void testCosmosStarterIsolating() { try (AppRunner app = new AppRunner(DummyApp.class)) { //set properties @@ -35,7 +37,8 @@ public void testCosmosStarterIsolating() { //start app app.start(); - app.getBean(AADAuthenticationFilterAutoConfiguration.class); + assertThrows(NoSuchBeanDefinitionException.class, + () -> app.getBean(AADAuthenticationFilterAutoConfiguration.class)); } } @@ -73,21 +76,22 @@ public void testCosmosOperation() { // findById will not return the user as user is not present. final Mono findByIdMono = repository.findById(testUser.getId()); final User findByIdUser = findByIdMono.block(); - Assert.assertNull("User must be null", findByIdUser); + Assertions.assertNull(findByIdUser, "User must be null"); final User savedUser = saveUserMono.block(); - Assert.assertNotNull("Saved user must not be null", savedUser); - Assert.assertEquals("Saved user first name doesn't match", - testUser.getFirstName(), savedUser.getFirstName()); + Assertions.assertNotNull(savedUser, "Saved user must not be null"); + Assertions.assertEquals(testUser.getFirstName(), savedUser.getFirstName(), + "Saved user first name doesn't match"); firstNameUserFlux.collectList().block(); final Optional optionalUserResult = repository.findById(testUser.getId()).blockOptional(); - Assert.assertTrue("Cannot find user.", optionalUserResult.isPresent()); + Assertions.assertTrue(optionalUserResult.isPresent(), "Cannot find user."); final User result = optionalUserResult.get(); - Assert.assertEquals("query result firstName doesn't match!", - testUser.getFirstName(), result.getFirstName()); - Assert.assertEquals("query result lastName doesn't match!", testUser.getLastName(), result.getLastName()); + Assertions.assertEquals(testUser.getFirstName(), result.getFirstName(), + "query result firstName doesn't match!"); + Assertions.assertEquals(testUser.getLastName(), result.getLastName(), + "query result lastName doesn't match!"); LOGGER.info("findOne in User collection get result: {}", result.toString()); } diff --git a/sdk/spring/azure-spring-boot-test-keyvault/pom-reactive.xml b/sdk/spring/azure-spring-boot-test-keyvault/pom-reactive.xml index b918c999d9da..5a6e42fa0ff1 100644 --- a/sdk/spring/azure-spring-boot-test-keyvault/pom-reactive.xml +++ b/sdk/spring/azure-spring-boot-test-keyvault/pom-reactive.xml @@ -28,19 +28,9 @@ 1.0.0 - com.microsoft.azure - azure - 1.34.0 - - - com.fasterxml.jackson.core - jackson-core - - - com.google.code.gson - gson - - + com.azure.resourcemanager + azure-resourcemanager + 2.5.0 org.springframework.boot @@ -55,13 +45,6 @@ spring-boot-starter-test test - - - junit - junit - 4.13.2 - test - diff --git a/sdk/spring/azure-spring-boot-test-keyvault/pom.xml b/sdk/spring/azure-spring-boot-test-keyvault/pom.xml index a3c006dd515e..abecbb9e6d0d 100644 --- a/sdk/spring/azure-spring-boot-test-keyvault/pom.xml +++ b/sdk/spring/azure-spring-boot-test-keyvault/pom.xml @@ -28,19 +28,9 @@ 1.0.0 - com.microsoft.azure - azure - 1.34.0 - - - com.fasterxml.jackson.core - jackson-core - - - com.google.code.gson - gson - - + com.azure.resourcemanager + azure-resourcemanager + 2.5.0 org.springframework.boot @@ -55,13 +45,6 @@ spring-boot-starter-test test - - - junit - junit - 4.13.2 - test - diff --git a/sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/azure/spring/test/keyvault/KeyVaultActuatorIT.java b/sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/azure/spring/test/keyvault/KeyVaultActuatorIT.java index 827d8b7732e9..7c92abfb6f98 100644 --- a/sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/azure/spring/test/keyvault/KeyVaultActuatorIT.java +++ b/sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/azure/spring/test/keyvault/KeyVaultActuatorIT.java @@ -4,7 +4,7 @@ import com.azure.spring.test.AppRunner; import com.azure.spring.test.keyvault.app.DummyApp; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.client.RestTemplate; diff --git a/sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/azure/spring/test/keyvault/KeyVaultSecretValueIT.java b/sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/azure/spring/test/keyvault/KeyVaultSecretValueIT.java index 4ec69d2b51fa..bcaa3ba2da07 100644 --- a/sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/azure/spring/test/keyvault/KeyVaultSecretValueIT.java +++ b/sdk/spring/azure-spring-boot-test-keyvault/src/test/java/com/azure/spring/test/keyvault/KeyVaultSecretValueIT.java @@ -3,34 +3,21 @@ package com.azure.spring.test.keyvault; -import static com.azure.spring.test.EnvironmentVariable.AZURE_KEYVAULT_URI; -import static com.azure.spring.test.EnvironmentVariable.KEY_VAULT_SECRET_NAME; -import static com.azure.spring.test.EnvironmentVariable.KEY_VAULT_SECRET_VALUE; -import static com.azure.spring.test.EnvironmentVariable.SPRING_CLIENT_ID; -import static com.azure.spring.test.EnvironmentVariable.SPRING_CLIENT_SECRET; -import static com.azure.spring.test.EnvironmentVariable.SPRING_RESOURCE_GROUP; -import static com.azure.spring.test.EnvironmentVariable.SPRING_SUBSCRIPTION_ID; -import static com.azure.spring.test.EnvironmentVariable.SPRING_TENANT_ID; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import com.azure.spring.test.keyvault.app.DummyApp; -import com.microsoft.azure.AzureEnvironment; -import com.microsoft.azure.credentials.ApplicationTokenCredentials; -import com.microsoft.azure.credentials.AzureTokenCredentials; -import com.microsoft.azure.management.Azure; -import com.microsoft.azure.management.appservice.WebApp; -import com.microsoft.azure.management.compute.RunCommandInput; -import com.microsoft.azure.management.compute.VirtualMachine; -import com.microsoft.azure.management.resources.fluentcore.utils.SdkContext; +import com.azure.core.credential.TokenCredential; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.identity.ClientSecretCredentialBuilder; +import com.azure.resourcemanager.AzureResourceManager; +import com.azure.resourcemanager.appservice.models.WebApp; +import com.azure.resourcemanager.compute.models.RunCommandInput; +import com.azure.resourcemanager.compute.models.VirtualMachine; import com.azure.spring.test.AppRunner; import com.azure.spring.test.MavenBasedProject; -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -import org.junit.Ignore; -import org.junit.Test; +import com.azure.spring.test.keyvault.app.DummyApp; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ConfigurableApplicationContext; @@ -41,6 +28,22 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import static com.azure.spring.test.EnvironmentVariable.AZURE_KEYVAULT_URI; +import static com.azure.spring.test.EnvironmentVariable.KEY_VAULT_SECRET_NAME; +import static com.azure.spring.test.EnvironmentVariable.KEY_VAULT_SECRET_VALUE; +import static com.azure.spring.test.EnvironmentVariable.SPRING_CLIENT_ID; +import static com.azure.spring.test.EnvironmentVariable.SPRING_CLIENT_SECRET; +import static com.azure.spring.test.EnvironmentVariable.KEY_VAULT_SPRING_RESOURCE_GROUP; +import static com.azure.spring.test.EnvironmentVariable.SPRING_SUBSCRIPTION_ID; +import static com.azure.spring.test.EnvironmentVariable.SPRING_TENANT_ID; +import static org.junit.jupiter.api.Assertions.assertEquals; + +@TestMethodOrder(MethodOrderer.MethodName.class) public class KeyVaultSecretValueIT { private static final Logger LOGGER = LoggerFactory.getLogger(KeyVaultSecretValueIT.class); @@ -49,22 +52,23 @@ public class KeyVaultSecretValueIT { private static final String VM_USER_USERNAME = System.getenv("VM_USER_USERNAME"); private static final String VM_USER_PASSWORD = System.getenv("VM_USER_PASSWORD"); private static final int DEFAULT_MAX_RETRY_TIMES = 3; - private static final Azure AZURE; + private static final AzureResourceManager AZURE; private static final RestTemplate REST_TEMPLATE = new RestTemplate(); static { - AZURE = Azure.authenticate(credentials()) - .withSubscription(SPRING_SUBSCRIPTION_ID); + AzureProfile profile = new AzureProfile(SPRING_TENANT_ID, SPRING_SUBSCRIPTION_ID, AzureEnvironment.AZURE); + AZURE = AzureResourceManager.configure() + .authenticate(credentials(), profile) + .withDefaultSubscription(); } - - private static AzureTokenCredentials credentials() { - return new ApplicationTokenCredentials( - SPRING_CLIENT_ID, - SPRING_TENANT_ID, - SPRING_CLIENT_SECRET, - AzureEnvironment.AZURE); + private static TokenCredential credentials() { + return new ClientSecretCredentialBuilder() + .clientId(SPRING_CLIENT_ID) + .clientSecret(SPRING_CLIENT_SECRET) + .tenantId(SPRING_TENANT_ID) + .build(); } @Test @@ -100,7 +104,7 @@ public void keyVaultAsPropertySourceWithSpecificKeys() { app.property("azure.keyvault.client-key", SPRING_CLIENT_SECRET); app.property("azure.keyvault.tenant-id", SPRING_TENANT_ID); app.property("azure.keyvault.secret-keys", KEY_VAULT_SECRET_NAME); - LOGGER.info("====" + KEY_VAULT_SECRET_NAME ); + LOGGER.info("====" + KEY_VAULT_SECRET_NAME); app.start(); assertEquals(KEY_VAULT_SECRET_VALUE, app.getProperty(KEY_VAULT_SECRET_NAME)); } @@ -108,11 +112,11 @@ public void keyVaultAsPropertySourceWithSpecificKeys() { } @Test - public void keyVaultWithAppServiceMSI() { + public void keyVaultWithAppServiceMSI() throws InterruptedException { LOGGER.info("keyVaultWithAppServiceMSI begin."); final WebApp webApp = AZURE .webApps() - .getByResourceGroup(SPRING_RESOURCE_GROUP, APP_SERVICE_NAME); + .getByResourceGroup(KEY_VAULT_SPRING_RESOURCE_GROUP, APP_SERVICE_NAME); final MavenBasedProject app = new MavenBasedProject("../azure-spring-boot-test-application"); app.packageUp(); @@ -126,7 +130,7 @@ public void keyVaultWithAppServiceMSI() { retryCount += 1; try { webApp.zipDeploy(zipFile); - LOGGER.info(String.format("Deployed the artifact to https://%s", webApp.defaultHostName())); + LOGGER.info(String.format("Deployed the artifact to https://%s", webApp.defaultHostname())); break; } catch (Exception e) { LOGGER.error(String.format("Exception occurred when deploying the zip package: %s, " @@ -146,10 +150,10 @@ public void keyVaultWithAppServiceMSI() { } @Test - @Ignore("Block live test, ignore temporarily") - public void keyVaultWithVirtualMachineMSI() { + @Disabled("Block live test, ignore temporarily") + public void keyVaultWithVirtualMachineMSI() throws InterruptedException { LOGGER.info("keyVaultWithVirtualMachineMSI begin."); - final VirtualMachine vm = AZURE.virtualMachines().getByResourceGroup(SPRING_RESOURCE_GROUP, VM_NAME); + final VirtualMachine vm = AZURE.virtualMachines().getByResourceGroup(KEY_VAULT_SPRING_RESOURCE_GROUP, VM_NAME); final String host = vm.getPrimaryPublicIPAddress().ipAddress(); final List commands = new ArrayList<>(); commands.add(String.format("cd /home/%s", VM_USER_USERNAME)); @@ -187,15 +191,15 @@ public void keyVaultWithVirtualMachineMSI() { } private static ResponseEntity curlWithRetry(String resourceUrl, - final int retryTimes, - int sleepMills, - Class clazz) { + final int retryTimes, + int sleepMills, + Class clazz) throws InterruptedException { HttpStatus httpStatus = HttpStatus.BAD_REQUEST; ResponseEntity response = ResponseEntity.of(Optional.empty()); int rt = retryTimes; while (rt-- > 0 && httpStatus != HttpStatus.OK) { - SdkContext.sleep(sleepMills); + Thread.sleep(sleepMills); LOGGER.info("CURLing " + resourceUrl); diff --git a/sdk/spring/azure-spring-boot-test-keyvault/test-resources.json b/sdk/spring/azure-spring-boot-test-keyvault/test-resources.json index 8a93fb8c215c..fbd9757de7da 100644 --- a/sdk/spring/azure-spring-boot-test-keyvault/test-resources.json +++ b/sdk/spring/azure-spring-boot-test-keyvault/test-resources.json @@ -334,7 +334,7 @@ "type": "string", "value": "[parameters('testApplicationSecret')]" }, - "SPRING_RESOURCE_GROUP": { + "KEY_VAULT_SPRING_RESOURCE_GROUP": { "type": "string", "value": "[resourceGroup().name]" }, diff --git a/sdk/spring/azure-spring-boot-test-servicebus-jms/pom.xml b/sdk/spring/azure-spring-boot-test-servicebus-jms/pom.xml index d8e85a16d0e5..f32e28205ca1 100644 --- a/sdk/spring/azure-spring-boot-test-servicebus-jms/pom.xml +++ b/sdk/spring/azure-spring-boot-test-servicebus-jms/pom.xml @@ -21,17 +21,11 @@ azure-spring-boot-starter-servicebus-jms 3.6.0-beta.1 - + org.springframework.boot spring-boot-starter-test test - - - org.junit.vintage - junit-vintage-engine - - com.azure.spring diff --git a/sdk/spring/azure-spring-boot-test-storage/pom.xml b/sdk/spring/azure-spring-boot-test-storage/pom.xml index ef255a980772..982113be2717 100644 --- a/sdk/spring/azure-spring-boot-test-storage/pom.xml +++ b/sdk/spring/azure-spring-boot-test-storage/pom.xml @@ -22,17 +22,6 @@ azure-spring-boot-starter-storage 3.6.0-beta.1 - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - com.azure.spring azure-spring-boot-test-core @@ -46,6 +35,12 @@ org.springframework.boot spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + diff --git a/sdk/spring/azure-spring-boot/pom.xml b/sdk/spring/azure-spring-boot/pom.xml index 008c5c66c490..f2c1908bebec 100644 --- a/sdk/spring/azure-spring-boot/pom.xml +++ b/sdk/spring/azure-spring-boot/pom.xml @@ -274,18 +274,6 @@ 5.3.7 true - - org.junit.jupiter - junit-jupiter-engine - 5.7.2 - test - - - org.junit.vintage - junit-vintage-engine - 5.7.2 - test - org.apache.httpcomponents httpclient diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/AADJwtBearerTokenAuthenticationConverterTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/AADJwtBearerTokenAuthenticationConverterTest.java index 54583e376311..2d38b16f2583 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/AADJwtBearerTokenAuthenticationConverterTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/AADJwtBearerTokenAuthenticationConverterTest.java @@ -3,8 +3,8 @@ package com.azure.spring.aad.webapi; import net.minidev.json.JSONArray; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.oauth2.jwt.Jwt; @@ -23,7 +23,7 @@ public class AADJwtBearerTokenAuthenticationConverterTest { private Map headers = new HashMap<>(); private JSONArray jsonArray = new JSONArray().appendElement("User.read").appendElement("User.write"); - @Before + @BeforeEach public void init() { claims.put("iss", "fake-issuer"); claims.put("tid", "fake-tid"); diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/AADResourceServerClientConfigurationTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/AADResourceServerClientConfigurationTest.java index 76aabb7ac974..ae72c7d177d7 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/AADResourceServerClientConfigurationTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/AADResourceServerClientConfigurationTest.java @@ -4,7 +4,7 @@ package com.azure.spring.aad.webapi; import com.azure.spring.autoconfigure.aad.AADAuthenticationProperties; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration; import org.springframework.boot.test.context.FilteredClassLoader; @@ -22,6 +22,7 @@ import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; public class AADResourceServerClientConfigurationTest { @@ -51,7 +52,8 @@ public void testWithoutAnyPropertiesSet() { @Test public void testWithRequiredPropertiesSet() { new WebApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(WebOAuth2ClientApp.class, AADResourceServerClientConfiguration.class)) + .withConfiguration(AutoConfigurations.of(WebOAuth2ClientApp.class, + AADResourceServerClientConfiguration.class)) .withPropertyValues("azure.activedirectory.client-id=fake-client-id") .run(context -> { assertThat(context).hasSingleBean(AADAuthenticationProperties.class); @@ -79,7 +81,8 @@ public void testNotExistOAuth2LoginAuthenticationFilter() { @Test public void testOnlyGraphClient() { this.contextRunner - .withConfiguration(AutoConfigurations.of(WebOAuth2ClientApp.class, AADResourceServerClientConfiguration.class)) + .withConfiguration(AutoConfigurations.of(WebOAuth2ClientApp.class, + AADResourceServerClientConfiguration.class)) .withPropertyValues("azure.activedirectory.authorization-clients.graph.scopes=" + "https://graph.microsoft.com/User.Read") .run(context -> { @@ -98,18 +101,18 @@ public void testOnlyGraphClient() { }); } - @Test(expected = IllegalStateException.class) + @Test public void testGrantTypeIsAuthorizationCodeClient() { this.contextRunner .withUserConfiguration(AADResourceServerClientConfiguration.class) .withPropertyValues("azure.activedirectory.authorization-clients.graph.authorization-grant-type=" + "authorization_code") .run(context -> { - AADAuthenticationProperties properties = context.getBean(AADAuthenticationProperties.class); + assertThrows(IllegalStateException.class, () -> context.getBean(AADAuthenticationProperties.class)); }); } - @Test(expected = IllegalStateException.class) + @Test public void clientWhichGrantTypeIsOboButOnDemandExceptionTest() { this.contextRunner .withUserConfiguration(AADResourceServerClientConfiguration.class) @@ -117,7 +120,7 @@ public void clientWhichGrantTypeIsOboButOnDemandExceptionTest() { + "on-behalf-of") .withPropertyValues("azure.activedirectory.authorization-clients.graph.on-demand = true") .run(context -> { - AADAuthenticationProperties properties = context.getBean(AADAuthenticationProperties.class); + assertThrows(IllegalStateException.class, () -> context.getBean(AADAuthenticationProperties.class)); }); } diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/AADResourceServerConfigurationTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/AADResourceServerConfigurationTest.java index 9e23075e069b..9d09beaaa892 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/AADResourceServerConfigurationTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/AADResourceServerConfigurationTest.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. package com.azure.spring.aad.webapi; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/validator/AADJwtAudienceValidatorTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/validator/AADJwtAudienceValidatorTest.java index 2ef08f90a6e6..4a1f837ff9e9 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/validator/AADJwtAudienceValidatorTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/validator/AADJwtAudienceValidatorTest.java @@ -3,19 +3,19 @@ package com.azure.spring.aad.webapi.validator; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - import com.azure.spring.autoconfigure.aad.AADAuthenticationProperties; import com.azure.spring.autoconfigure.aad.AADTokenClaim; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.core.OAuth2TokenValidatorResult; import org.springframework.security.oauth2.jwt.Jwt; +import java.util.ArrayList; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + public class AADJwtAudienceValidatorTest { final AADAuthenticationProperties aadAuthenticationProperties = mock(AADAuthenticationProperties.class); diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/validator/AADJwtIssuerValidatorTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/validator/AADJwtIssuerValidatorTest.java index a6b19e390b7b..d44a58a11329 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/validator/AADJwtIssuerValidatorTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapi/validator/AADJwtIssuerValidatorTest.java @@ -5,7 +5,7 @@ import com.azure.spring.aad.AADTrustedIssuerRepository; import com.azure.spring.autoconfigure.aad.AADAuthenticationProperties; import com.azure.spring.autoconfigure.aad.AADTokenClaim; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.core.OAuth2TokenValidatorResult; import org.springframework.security.oauth2.jwt.Jwt; diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/AADAccessTokenGroupRolesExtractionTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/AADAccessTokenGroupRolesExtractionTest.java index 509f7a5e6508..76b58da9a1fb 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/AADAccessTokenGroupRolesExtractionTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/AADAccessTokenGroupRolesExtractionTest.java @@ -3,8 +3,14 @@ package com.azure.spring.aad.webapp; import com.azure.spring.autoconfigure.aad.AADAuthenticationProperties; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.security.oauth2.core.OAuth2AccessToken; import java.util.ArrayList; @@ -13,39 +19,46 @@ import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; +@ExtendWith(MockitoExtension.class) public class AADAccessTokenGroupRolesExtractionTest { - private AADAuthenticationProperties properties = spy(AADAuthenticationProperties.class); - private OAuth2AccessToken accessToken = mock(OAuth2AccessToken.class); + @Mock + private OAuth2AccessToken accessToken; + @Mock + private GraphClient graphClient; + + private AADAuthenticationProperties properties = new AADAuthenticationProperties(); private AADAuthenticationProperties.UserGroupProperties userGroup = - mock(AADAuthenticationProperties.UserGroupProperties.class); - private GraphClient graphClient = mock(GraphClient.class); - private AADOAuth2UserService userService = new AADOAuth2UserService(properties, graphClient); + new AADAuthenticationProperties.UserGroupProperties(); + private AADOAuth2UserService userService; + private AutoCloseable autoCloseable; @BeforeEach - private void setup() { - Set groups = new HashSet<>(); - groups.add("d07c0bd6-4aab-45ac-b87c-23e8d00194ab"); - groups.add("6eddcc22-a24a-4459-b036-b9d9fc0f0bc7"); - groups.add("group1"); - groups.add("group2"); - when(properties.allowedGroupNamesConfigured()).thenReturn(true); - when(properties.allowedGroupIdsConfigured()).thenReturn(true); - when(properties.getUserGroup()).thenReturn(userGroup); - when(properties.getGraphMembershipUri()).thenReturn("https://graph.microsoft.com/v1.0/me/memberOf"); - when(accessToken.getTokenValue()).thenReturn("fake-access-token"); - when(graphClient.getGroupsFromGraph(accessToken.getTokenValue())).thenReturn(groups); + public void setup() { + this.autoCloseable = MockitoAnnotations.openMocks(this); + properties.setUserGroup(userGroup); + properties.setGraphMembershipUri("https://graph.microsoft.com/v1.0/me/memberOf"); + Mockito.lenient().when(accessToken.getTokenValue()).thenReturn("fake-access-token"); + userService = new AADOAuth2UserService(properties, graphClient); + } + + @AfterEach + public void close() throws Exception { + this.autoCloseable.close(); } @Test public void testGroupsName() { - List allowedGroupNames = new ArrayList<>(); + Set allowedGroupNames = new HashSet<>(); allowedGroupNames.add("group1"); - when(userGroup.getAllowedGroupNames()).thenReturn(allowedGroupNames); + allowedGroupNames.add("group2"); + List customizeGroupName = new ArrayList<>(); + customizeGroupName.add("group1"); + + Mockito.lenient().when(graphClient.getGroupsFromGraph(accessToken.getTokenValue())) + .thenReturn(allowedGroupNames); + userGroup.setAllowedGroupNames(customizeGroupName); Set groupsName = userService.extractGroupRolesFromAccessToken(accessToken); assertThat(groupsName).contains("ROLE_group1"); @@ -57,9 +70,14 @@ public void testGroupsName() { public void testGroupsId() { Set allowedGroupIds = new HashSet<>(); allowedGroupIds.add("d07c0bd6-4aab-45ac-b87c-23e8d00194ab"); - when(userGroup.getAllowedGroupIds()).thenReturn(allowedGroupIds); + List customizeGroupId = new ArrayList<>(); + customizeGroupId.add("d07c0bd6-4aab-45ac-b87c-23e8d00194ab"); + Mockito.lenient().when(graphClient.getGroupsFromGraph(accessToken.getTokenValue())) + .thenReturn(allowedGroupIds); + userGroup.setAllowedGroupIds(allowedGroupIds); Set groupsName = userService.extractGroupRolesFromAccessToken(accessToken); + assertThat(groupsName).contains("ROLE_d07c0bd6-4aab-45ac-b87c-23e8d00194ab"); assertThat(groupsName).doesNotContain("ROLE_d07c0bd6-4aab-45ac-b87c-23e8d00194abaaa"); assertThat(groupsName).hasSize(1); @@ -67,12 +85,20 @@ public void testGroupsId() { @Test public void testGroupsNameAndGroupsId() { - Set allowedGroupIds = new HashSet<>(); - allowedGroupIds.add("d07c0bd6-4aab-45ac-b87c-23e8d00194ab"); - when(userGroup.getAllowedGroupIds()).thenReturn(allowedGroupIds); - List allowedGroupNames = new ArrayList<>(); - allowedGroupNames.add("group1"); - when(userGroup.getAllowedGroupNames()).thenReturn(allowedGroupNames); + Set allowedGroupIdsAndGroupNames = new HashSet<>(); + allowedGroupIdsAndGroupNames.add("d07c0bd6-4aab-45ac-b87c-23e8d00194ab"); + allowedGroupIdsAndGroupNames.add("group1"); + + Set customizeGroupIds = new HashSet<>(); + customizeGroupIds.add("d07c0bd6-4aab-45ac-b87c-23e8d00194ab"); + List customizeGroupName = new ArrayList<>(); + customizeGroupName.add("group1"); + + userGroup.setAllowedGroupIds(customizeGroupIds); + userGroup.setAllowedGroupNames(customizeGroupName); + + Mockito.lenient().when(graphClient.getGroupsFromGraph(accessToken.getTokenValue())) + .thenReturn(allowedGroupIdsAndGroupNames); Set groupsName = userService.extractGroupRolesFromAccessToken(accessToken); assertThat(groupsName).contains("ROLE_group1"); @@ -84,22 +110,47 @@ public void testGroupsNameAndGroupsId() { @Test public void testEnableFullList() { - when(properties.getUserGroup().getEnableFullList()).thenReturn(true); + Set allowedGroupIdsAndGroupNames = new HashSet<>(); + allowedGroupIdsAndGroupNames.add("d07c0bd6-4aab-45ac-b87c-23e8d00194ab"); + allowedGroupIdsAndGroupNames.add("6eddcc22-a24a-4459-b036-b9d9fc0f0bc7"); + allowedGroupIdsAndGroupNames.add("group1"); + allowedGroupIdsAndGroupNames.add("group2"); + + Set customizeGroupIds = new HashSet<>(); + customizeGroupIds.add("d07c0bd6-4aab-45ac-b87c-23e8d00194ab"); + List customizeGroupName = new ArrayList<>(); + customizeGroupName.add("group1"); + + userGroup.setAllowedGroupIds(customizeGroupIds); + userGroup.setAllowedGroupNames(customizeGroupName); + userGroup.setEnableFullList(true); + + Mockito.lenient().when(graphClient.getGroupsFromGraph(accessToken.getTokenValue())) + .thenReturn(allowedGroupIdsAndGroupNames); Set groupIds = userService.extractGroupRolesFromAccessToken(accessToken); assertThat(groupIds).hasSize(4); } @Test public void testDisableFullList() { - when(properties.getUserGroup().getEnableFullList()).thenReturn(false); + Set allowedGroupIdsAndGroupNames = new HashSet<>(); + allowedGroupIdsAndGroupNames.add("d07c0bd6-4aab-45ac-b87c-23e8d00194ab"); + allowedGroupIdsAndGroupNames.add("6eddcc22-a24a-4459-b036-b9d9fc0f0bc7"); + allowedGroupIdsAndGroupNames.add("group1"); + allowedGroupIdsAndGroupNames.add("group2"); + + userGroup.setEnableFullList(false); Set allowedGroupIds = new HashSet<>(); allowedGroupIds.add("d07c0bd6-4aab-45ac-b87c-23e8d00194ab"); - when(userGroup.getAllowedGroupIds()).thenReturn(allowedGroupIds); + userGroup.setAllowedGroupIds(allowedGroupIds); List allowedGroupNames = new ArrayList<>(); allowedGroupNames.add("group1"); - when(userGroup.getAllowedGroupNames()).thenReturn(allowedGroupNames); + userGroup.setAllowedGroupNames(allowedGroupNames); + Mockito.lenient().when(graphClient.getGroupsFromGraph(accessToken.getTokenValue())) + .thenReturn(allowedGroupIdsAndGroupNames); Set groupsName = userService.extractGroupRolesFromAccessToken(accessToken); + assertThat(groupsName).contains("ROLE_group1"); assertThat(groupsName).doesNotContain("ROLE_group5"); assertThat(groupsName).contains("ROLE_d07c0bd6-4aab-45ac-b87c-23e8d00194ab"); diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/AADIdTokenRolesExtractionTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/AADIdTokenRolesExtractionTest.java index 4063587ff3a4..c92b882dd06c 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/AADIdTokenRolesExtractionTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/AADIdTokenRolesExtractionTest.java @@ -4,7 +4,7 @@ import com.azure.spring.autoconfigure.aad.AADAuthenticationProperties; import net.minidev.json.JSONArray; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.core.oidc.OidcIdToken; import java.util.Arrays; diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/AADWebAppConfigurationTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/AADWebAppConfigurationTest.java index 0eaf0a66ad0b..6b4037d86dc7 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/AADWebAppConfigurationTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/AADWebAppConfigurationTest.java @@ -5,7 +5,7 @@ import com.azure.spring.aad.AADAuthorizationServerEndpoints; import com.azure.spring.autoconfigure.aad.AADAuthenticationProperties; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository; import org.springframework.security.oauth2.client.userinfo.OAuth2UserService; @@ -22,6 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; public class AADWebAppConfigurationTest { @@ -148,12 +149,14 @@ public void clientWithClientCredentialsPermissions() { ClientRegistration azure = repo.findByRegistrationId("azure"); ClientRegistration graph = repo.findByRegistrationId("graph"); - assertEquals(repo.findByRegistrationId("azure").getAuthorizationGrantType(), AuthorizationGrantType.AUTHORIZATION_CODE); - assertEquals(repo.findByRegistrationId("graph").getAuthorizationGrantType(), AuthorizationGrantType.CLIENT_CREDENTIALS); + assertEquals(repo.findByRegistrationId("azure").getAuthorizationGrantType(), + AuthorizationGrantType.AUTHORIZATION_CODE); + assertEquals(repo.findByRegistrationId("graph").getAuthorizationGrantType(), + AuthorizationGrantType.CLIENT_CREDENTIALS); }); } - @Test(expected = IllegalStateException.class) + @Test public void webAppWithOboWithExceptionTest() { WebApplicationContextRunnerUtils .getContextRunnerWithRequiredProperties() @@ -161,11 +164,11 @@ public void webAppWithOboWithExceptionTest() { "azure.activedirectory.authorization-clients.graph.authorizationGrantType = on-behalf-of" ) .run(context -> { - AADAuthenticationProperties properties = context.getBean(AADAuthenticationProperties.class); + assertThrows(IllegalStateException.class, () -> context.getBean(AADAuthenticationProperties.class)); }); } - @Test(expected = IllegalStateException.class) + @Test public void clientWhichIsNotAuthorizationCodeButOnDemandExceptionTest() { WebApplicationContextRunnerUtils .getContextRunnerWithRequiredProperties() @@ -174,7 +177,7 @@ public void clientWhichIsNotAuthorizationCodeButOnDemandExceptionTest() { "azure.activedirectory.authorization-clients.graph.on-demand = true" ) .run(context -> { - AADAuthenticationProperties properties = context.getBean(AADAuthenticationProperties.class); + assertThrows(IllegalStateException.class, () -> context.getBean(AADAuthenticationProperties.class)); }); } @@ -247,8 +250,7 @@ public void customizeUri() { public void defaultClientWithAuthzScope() { WebApplicationContextRunnerUtils .getContextRunnerWithRequiredProperties().withPropertyValues( - "azure.activedirectory.authorization-clients.azure.scopes = Calendars.Read" - ) + "azure.activedirectory.authorization-clients.azure.scopes = Calendars.Read") .run(context -> { AADWebAppClientRegistrationRepository clientRepo = context.getBean(AADWebAppClientRegistrationRepository.class); @@ -323,7 +325,7 @@ public void graphUriConfigurationTest() { }); } - @Test(expected = IllegalStateException.class) + @Test public void graphUriConfigurationWithExceptionTest() { WebApplicationContextRunnerUtils .getContextRunnerWithRequiredProperties() @@ -331,11 +333,11 @@ public void graphUriConfigurationWithExceptionTest() { "azure.activedirectory.graph-membership-uri=https://microsoftgraph.chinacloudapi.cn/v1.0/me/memberOf" ) .run(context -> { - AADAuthenticationProperties properties = context.getBean(AADAuthenticationProperties.class); + assertThrows(IllegalStateException.class, () -> context.getBean(AADAuthenticationProperties.class)); }); } - @Test(expected = IllegalStateException.class) + @Test public void multiTenantWithAllowedGroupsConfiguredTest1() { WebApplicationContextRunnerUtils .getContextRunnerWithRequiredProperties() @@ -344,11 +346,11 @@ public void multiTenantWithAllowedGroupsConfiguredTest1() { "azure.activedirectory.user-group.allowed-groups=group1,group2" ) .run(context -> { - AADAuthenticationProperties properties = context.getBean(AADAuthenticationProperties.class); + assertThrows(IllegalStateException.class, () -> context.getBean(AADAuthenticationProperties.class)); }); } - @Test(expected = IllegalStateException.class) + @Test public void multiTenantWithAllowedGroupsConfiguredTest2() { WebApplicationContextRunnerUtils .getContextRunnerWithRequiredProperties() @@ -357,11 +359,11 @@ public void multiTenantWithAllowedGroupsConfiguredTest2() { "azure.activedirectory.user-group.allowed-groups=group1,group2" ) .run(context -> { - AADAuthenticationProperties properties = context.getBean(AADAuthenticationProperties.class); + assertThrows(IllegalStateException.class, () -> context.getBean(AADAuthenticationProperties.class)); }); } - @Test(expected = IllegalStateException.class) + @Test public void multiTenantWithAllowedGroupsConfiguredTest3() { WebApplicationContextRunnerUtils .getContextRunnerWithRequiredProperties() @@ -370,11 +372,11 @@ public void multiTenantWithAllowedGroupsConfiguredTest3() { "azure.activedirectory.user-group.allowed-groups=group1,group2" ) .run(context -> { - AADAuthenticationProperties properties = context.getBean(AADAuthenticationProperties.class); + assertThrows(IllegalStateException.class, () -> context.getBean(AADAuthenticationProperties.class)); }); } - @Test(expected = IllegalStateException.class) + @Test public void multiTenantWithAllowedGroupsIdConfiguredTest1() { WebApplicationContextRunnerUtils .getContextRunnerWithRequiredProperties() @@ -384,11 +386,11 @@ public void multiTenantWithAllowedGroupsIdConfiguredTest1() { + "39087533-2593-4b5b-ad05-4a73a01ea6a9" ) .run(context -> { - AADAuthenticationProperties properties = context.getBean(AADAuthenticationProperties.class); + assertThrows(IllegalStateException.class, () -> context.getBean(AADAuthenticationProperties.class)); }); } - @Test(expected = IllegalStateException.class) + @Test public void multiTenantWithAllowedGroupsIdConfiguredTest2() { WebApplicationContextRunnerUtils .getContextRunnerWithRequiredProperties() @@ -398,11 +400,11 @@ public void multiTenantWithAllowedGroupsIdConfiguredTest2() { + "39087533-2593-4b5b-ad05-4a73a01ea6a9" ) .run(context -> { - AADAuthenticationProperties properties = context.getBean(AADAuthenticationProperties.class); + assertThrows(IllegalStateException.class, () -> context.getBean(AADAuthenticationProperties.class)); }); } - @Test(expected = IllegalStateException.class) + @Test public void multiTenantWithAllowedGroupsIdConfiguredTest3() { WebApplicationContextRunnerUtils .getContextRunnerWithRequiredProperties() @@ -412,11 +414,11 @@ public void multiTenantWithAllowedGroupsIdConfiguredTest3() { + "39087533-2593-4b5b-ad05-4a73a01ea6a9" ) .run(context -> { - AADAuthenticationProperties properties = context.getBean(AADAuthenticationProperties.class); + assertThrows(IllegalStateException.class, () -> context.getBean(AADAuthenticationProperties.class)); }); } - @Test(expected = IllegalStateException.class) + @Test public void multiTenantWithAllowedGroupsIdConfiguredTest4() { WebApplicationContextRunnerUtils .getContextRunnerWithRequiredProperties() @@ -426,11 +428,11 @@ public void multiTenantWithAllowedGroupsIdConfiguredTest4() { + "39087533-2593-4b5b-ad05-4a73a01ea6a9" ) .run(context -> { - AADAuthenticationProperties properties = context.getBean(AADAuthenticationProperties.class); + assertThrows(IllegalStateException.class, () -> context.getBean(AADAuthenticationProperties.class)); }); } - @Test(expected = IllegalStateException.class) + @Test public void multiTenantWithAllowedGroupsConfiguredTest4() { WebApplicationContextRunnerUtils .getContextRunnerWithRequiredProperties() @@ -439,7 +441,7 @@ public void multiTenantWithAllowedGroupsConfiguredTest4() { "azure.activedirectory.user-group.allowed-groups=group1,group2" ) .run(context -> { - AADAuthenticationProperties properties = context.getBean(AADAuthenticationProperties.class); + assertThrows(IllegalStateException.class, () -> context.getBean(AADAuthenticationProperties.class)); }); } diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AADAppRoleAuthenticationFilterTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AADAppRoleAuthenticationFilterTest.java index 9846822a6bda..4af630704750 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AADAppRoleAuthenticationFilterTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AADAppRoleAuthenticationFilterTest.java @@ -14,7 +14,7 @@ import com.nimbusds.jwt.proc.BadJWTException; import net.minidev.json.JSONArray; import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockHttpServletResponse; @@ -33,12 +33,12 @@ import java.util.Collections; import java.util.Set; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -96,19 +96,19 @@ public void testDoFilterGoodCase() assertNotNull(context); final Authentication authentication = context.getAuthentication(); assertNotNull(authentication); - assertTrue("User should be authenticated!", authentication.isAuthenticated()); + assertTrue(authentication.isAuthenticated(), "User should be authenticated!"); assertEquals(dummyPrincipal, authentication.getPrincipal()); - @SuppressWarnings("unchecked") - final Collection authorities = (Collection) authentication - .getAuthorities(); + @SuppressWarnings("unchecked") final Collection authorities = + (Collection) authentication + .getAuthorities(); Assertions.assertThat(authorities).containsExactlyInAnyOrder(roleAdmin, roleUser); }; filter.doFilterInternal(request, response, filterChain); verify(userPrincipalManager).buildUserPrincipal(TOKEN); - assertNull("Authentication has not been cleaned up!", SecurityContextHolder.getContext().getAuthentication()); + assertNull(SecurityContextHolder.getContext().getAuthentication(), "Authentication has not been cleaned up!"); } @Test @@ -139,19 +139,19 @@ public void testDoFilterAddsDefaultRole() assertNotNull(context); final Authentication authentication = context.getAuthentication(); assertNotNull(authentication); - assertTrue("User should be authenticated!", authentication.isAuthenticated()); + assertTrue(authentication.isAuthenticated(), "User should be authenticated!"); final SimpleGrantedAuthority expectedDefaultRole = new SimpleGrantedAuthority("ROLE_USER"); - @SuppressWarnings("unchecked") - final Collection authorities = (Collection) authentication - .getAuthorities(); + @SuppressWarnings("unchecked") final Collection authorities = + (Collection) authentication + .getAuthorities(); Assertions.assertThat(authorities).containsExactlyInAnyOrder(expectedDefaultRole); }; filter.doFilterInternal(request, response, filterChain); verify(userPrincipalManager).buildUserPrincipal(TOKEN); - assertNull("Authentication has not been cleaned up!", SecurityContextHolder.getContext().getAuthentication()); + assertNull(SecurityContextHolder.getContext().getAuthentication(), "Authentication has not been cleaned up!"); } @Test diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AADAuthenticationFilterPropertiesTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AADAuthenticationFilterPropertiesTest.java index a773f8e4ab48..99cfca307ff3 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AADAuthenticationFilterPropertiesTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AADAuthenticationFilterPropertiesTest.java @@ -3,9 +3,9 @@ package com.azure.spring.autoconfigure.aad; -import org.junit.After; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.boot.context.properties.ConfigurationPropertiesBindException; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.bind.validation.BindValidationException; @@ -21,7 +21,8 @@ import static org.assertj.core.api.Assertions.assertThat; public class AADAuthenticationFilterPropertiesTest { - @After + + @AfterEach public void clearAllProperties() { System.clearProperty("azure.activedirectory.environment"); System.clearProperty("azure.activedirectory.tenant-id"); @@ -43,7 +44,7 @@ public void canSetProperties() { assertThat(properties.getClientId()).isEqualTo(TestConstants.CLIENT_ID); assertThat(properties.getClientSecret()).isEqualTo(TestConstants.CLIENT_SECRET); assertThat(properties.getActiveDirectoryGroups() - .toString()).isEqualTo(TestConstants.TARGETED_GROUPS.toString()); + .toString()).isEqualTo(TestConstants.TARGETED_GROUPS.toString()); } } @@ -56,8 +57,9 @@ private void configureAllRequiredProperties() { System.setProperty("azure.activedirectory.allow-telemetry", "false"); } + @Disabled @Test - @Ignore // TODO (wepa) clientId and clientSecret can also be configured in oauth2 config, test to be refactored + //TODO (wepa) clientId and clientSecret can also be configured in oauth2 config, test to be refactored public void emptySettingsNotAllowed() { System.setProperty("azure.activedirectory.client-id", ""); System.setProperty("azure.activedirectory.client-secret", ""); @@ -82,10 +84,10 @@ public void emptySettingsNotAllowed() { final List errorStrings = errors.stream().map(ObjectError::toString).collect(Collectors.toList()); final List errorStringsExpected = Arrays.asList( - "Field error in object 'azure.activedirectory' on field 'activeDirectoryGroups': " - + "rejected value [null];", - "Field error in object 'azure.activedirectory' on field 'clientId': rejected value [];", - "Field error in object 'azure.activedirectory' on field 'clientSecret': rejected value [];" + "Field error in object 'azure.activedirectory' on field 'activeDirectoryGroups': " + + "rejected value [null];", + "Field error in object 'azure.activedirectory' on field 'clientId': rejected value [];", + "Field error in object 'azure.activedirectory' on field 'clientSecret': rejected value [];" ); Collections.sort(errorStrings); diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AADAuthenticationFilterTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AADAuthenticationFilterTest.java index 9c07615e4c05..65e2b0254c78 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AADAuthenticationFilterTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AADAuthenticationFilterTest.java @@ -6,8 +6,8 @@ import com.azure.spring.aad.AADAuthorizationServerEndpoints; import com.nimbusds.jose.JOSEException; import com.nimbusds.jose.proc.BadJOSEException; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.security.core.Authentication; @@ -24,8 +24,8 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -53,7 +53,7 @@ public AADAuthenticationFilterTest() { //TODO (Zhou Liu): current test case is out of date, a new test case need to cover here, do it later. @Test - @Ignore + @Disabled public void doFilterInternal() { this.contextRunner.withPropertyValues("azure.activedirectory.client-id", TestConstants.CLIENT_ID) .withPropertyValues("azure.activedirectory.client-secret", TestConstants.CLIENT_SECRET) diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AzureADGraphClientTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AzureADGraphClientTest.java index 771aff271d29..1e8622ae5be3 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AzureADGraphClientTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/AzureADGraphClientTest.java @@ -5,11 +5,9 @@ import com.azure.spring.aad.AADAuthorizationServerEndpoints; import com.google.common.collect.ImmutableSet; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; @@ -19,7 +17,6 @@ import static org.assertj.core.api.Assertions.assertThat; -@RunWith(MockitoJUnitRunner.class) public class AzureADGraphClientTest { private AzureADGraphClient client; @@ -27,7 +24,7 @@ public class AzureADGraphClientTest { @Mock private AADAuthorizationServerEndpoints endpoints; - @Before + @BeforeEach public void setup() { final List activeDirectoryGroups = new ArrayList<>(); activeDirectoryGroups.add("Test_Group"); diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/MembershipTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/MembershipTest.java index 8c27525c463e..beb39f840c2a 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/MembershipTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/MembershipTest.java @@ -3,36 +3,36 @@ package com.azure.spring.autoconfigure.aad; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class MembershipTest { private static final Membership GROUP_1 = new Membership("12345", Membership.OBJECT_TYPE_GROUP, "test"); @Test public void getDisplayName() { - Assert.assertEquals("test", GROUP_1.getDisplayName()); + Assertions.assertEquals("test", GROUP_1.getDisplayName()); } @Test public void getObjectType() { - Assert.assertEquals(Membership.OBJECT_TYPE_GROUP, GROUP_1.getObjectType()); + Assertions.assertEquals(Membership.OBJECT_TYPE_GROUP, GROUP_1.getObjectType()); } @Test public void getObjectID() { - Assert.assertEquals("12345", GROUP_1.getObjectID()); + Assertions.assertEquals("12345", GROUP_1.getObjectID()); } @Test public void equals() { final Membership group2 = new Membership("12345", Membership.OBJECT_TYPE_GROUP, "test"); - Assert.assertEquals(GROUP_1, group2); + Assertions.assertEquals(GROUP_1, group2); } @Test public void hashCodeTest() { final Membership group2 = new Membership("12345", Membership.OBJECT_TYPE_GROUP, "test"); - Assert.assertEquals(GROUP_1.hashCode(), group2.hashCode()); + Assertions.assertEquals(GROUP_1.hashCode(), group2.hashCode()); } } diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/ResourceRetrieverTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/ResourceRetrieverTest.java index a922045dad12..3763e5d25b55 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/ResourceRetrieverTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/ResourceRetrieverTest.java @@ -6,7 +6,7 @@ import com.nimbusds.jose.jwk.source.RemoteJWKSet; import com.nimbusds.jose.util.DefaultResourceRetriever; import com.nimbusds.jose.util.ResourceRetriever; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalAzureADGraphTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalAzureADGraphTest.java index 53b4bb1997e4..5d94f5803b85 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalAzureADGraphTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalAzureADGraphTest.java @@ -6,9 +6,9 @@ import com.github.tomakehurst.wiremock.junit.WireMockRule; import com.nimbusds.jose.JWSObject; import com.nimbusds.jwt.JWTClaimsSet; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.util.StringUtils; import java.io.File; @@ -20,10 +20,27 @@ import java.nio.file.Files; import java.text.ParseException; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class UserPrincipalAzureADGraphTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(9519); + + private WireMockRule wireMockRule; + + @BeforeEach + void setup() { + wireMockRule = new WireMockRule(9519); + wireMockRule.start(); + } + + @AfterEach + void close() { + if (wireMockRule.isRunning()) { + wireMockRule.stop(); + } + } @Test public void userPrincipalIsSerializable() throws ParseException, IOException, ClassNotFoundException { @@ -42,12 +59,10 @@ public void userPrincipalIsSerializable() throws ParseException, IOException, Cl final UserPrincipal serializedPrincipal = (UserPrincipal) objectInputStream.readObject(); - Assert.assertNotNull("Serialized UserPrincipal not null", serializedPrincipal); - Assert.assertFalse("Serialized UserPrincipal kid not empty", - StringUtils.isEmpty(serializedPrincipal.getKid())); - Assert.assertNotNull("Serialized UserPrincipal claims not null.", serializedPrincipal.getClaims()); - Assert.assertTrue("Serialized UserPrincipal claims not empty.", - serializedPrincipal.getClaims().size() > 0); + assertNotNull(serializedPrincipal, "Serialized UserPrincipal not null"); + assertFalse(StringUtils.isEmpty(serializedPrincipal.getKid()), "Serialized UserPrincipal kid not empty"); + assertNotNull(serializedPrincipal.getClaims(), "Serialized UserPrincipal claims not null."); + assertTrue(serializedPrincipal.getClaims().size() > 0, "Serialized UserPrincipal claims not empty."); } finally { Files.deleteIfExists(tmpOutputFile.toPath()); } diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalManagerAudienceTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalManagerAudienceTest.java index 1851c8548909..d2f843ac3521 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalManagerAudienceTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalManagerAudienceTest.java @@ -15,8 +15,8 @@ import com.nimbusds.jose.util.ResourceRetriever; import com.nimbusds.jwt.JWTClaimsSet; import com.nimbusds.jwt.SignedJWT; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.security.KeyPair; import java.security.KeyPairGenerator; @@ -43,7 +43,7 @@ public class UserPrincipalManagerAudienceTest { private AADAuthenticationProperties properties; private UserPrincipalManager userPrincipalManager; - @Before + @BeforeEach public void setupKeys() throws NoSuchAlgorithmException { final KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); kpg.initialize(2048); diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalManagerTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalManagerTest.java index d11d8cd3ab7a..1e99814e621a 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalManagerTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalManagerTest.java @@ -8,32 +8,33 @@ import com.nimbusds.jose.jwk.source.ImmutableJWKSet; import com.nimbusds.jose.proc.SecurityContext; import com.nimbusds.jwt.proc.BadJWTException; -import junitparams.FileParameters; -import junitparams.JUnitParamsRunner; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; +import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; -@RunWith(JUnitParamsRunner.class) + public class UserPrincipalManagerTest { private static ImmutableJWKSet immutableJWKSet; - @BeforeClass + @BeforeAll public static void setupClass() throws Exception { final X509Certificate cert = (X509Certificate) CertificateFactory.getInstance("X.509") - .generateCertificate(Files.newInputStream(Paths.get("src/test/resources/test-public-key.txt"))); + .generateCertificate(Files.newInputStream(Paths.get("src/test/resources/test-public-key.txt"))); immutableJWKSet = new ImmutableJWKSet<>(new JWKSet(JWK.parse( - cert))); + cert))); } private UserPrincipalManager userPrincipalManager; @@ -43,36 +44,43 @@ public static void setupClass() throws Exception { public void testAlgIsTakenFromJWT() throws Exception { userPrincipalManager = new UserPrincipalManager(immutableJWKSet); final UserPrincipal userPrincipal = userPrincipalManager.buildUserPrincipal( - new String(Files.readAllBytes( - Paths.get("src/test/resources/jwt-signed.txt")), StandardCharsets.UTF_8)); + new String(Files.readAllBytes( + Paths.get("src/test/resources/jwt-signed.txt")), StandardCharsets.UTF_8)); assertThat(userPrincipal).isNotNull().extracting(UserPrincipal::getIssuer, UserPrincipal::getSubject) - .containsExactly("https://sts.windows.net/test", "test@example.com"); + .containsExactly("https://sts.windows.net/test", "test@example.com"); } @Test public void invalidIssuer() { userPrincipalManager = new UserPrincipalManager(immutableJWKSet); - assertThatCode(() -> userPrincipalManager.buildUserPrincipal( - new String(Files.readAllBytes( - Paths.get("src/test/resources/jwt-bad-issuer.txt")), StandardCharsets.UTF_8))) - .isInstanceOf(BadJWTException.class); + assertThatCode(() -> userPrincipalManager.buildUserPrincipal(readJwtValidIssuerTxt())) + .isInstanceOf(BadJWTException.class); } - @Test //TODO: add more generated tokens with other valid issuers to this file. Didn't manage to generate them - @FileParameters("src/test/resources/jwt-valid-issuer.txt") + @ParameterizedTest + @MethodSource("readJwtValidIssuerTxtStream") public void validIssuer(final String token) { userPrincipalManager = new UserPrincipalManager(immutableJWKSet); assertThatCode(() -> userPrincipalManager.buildUserPrincipal(token)) - .doesNotThrowAnyException(); + .doesNotThrowAnyException(); } @Test public void nullIssuer() { userPrincipalManager = new UserPrincipalManager(immutableJWKSet); - assertThatCode(() -> userPrincipalManager.buildUserPrincipal( - new String(Files.readAllBytes( - Paths.get("src/test/resources/jwt-null-issuer.txt")), StandardCharsets.UTF_8))) - .isInstanceOf(BadJWTException.class); + assertThatCode(() -> userPrincipalManager.buildUserPrincipal(readJwtValidIssuerTxt())) + .isInstanceOf(BadJWTException.class); + } + + private String readJwtValidIssuerTxt() throws IOException { + return new String(Files.readAllBytes( + Paths.get("src/test/resources/jwt-null-issuer.txt")), StandardCharsets.UTF_8); } + + private static Stream readJwtValidIssuerTxtStream() throws IOException { + return Stream.of(new String(Files.readAllBytes( + Paths.get("src/test/resources/jwt-valid-issuer.txt")), StandardCharsets.UTF_8)); + } + } diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalMicrosoftGraphTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalMicrosoftGraphTest.java index eed497fded4c..ebe2c95768f3 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalMicrosoftGraphTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/aad/UserPrincipalMicrosoftGraphTest.java @@ -9,10 +9,10 @@ import com.github.tomakehurst.wiremock.junit.WireMockRule; import com.nimbusds.jose.JWSObject; import com.nimbusds.jwt.JWTClaimsSet; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; import org.springframework.util.StringUtils; import java.io.File; @@ -37,14 +37,18 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; import static com.github.tomakehurst.wiremock.client.WireMock.verify; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.springframework.http.HttpHeaders.ACCEPT; import static org.springframework.http.HttpHeaders.AUTHORIZATION; import static org.springframework.http.HttpHeaders.CONTENT_TYPE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class UserPrincipalMicrosoftGraphTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(9519); + + private WireMockRule wireMockRule; private String clientId; private String clientSecret; @@ -65,17 +69,26 @@ public class UserPrincipalMicrosoftGraphTest { e.printStackTrace(); userGroupsJson = null; } - Assert.assertNotNull(userGroupsJson); + assertNotNull(userGroupsJson); } - @Before + @BeforeAll public void setup() { accessToken = MicrosoftGraphConstants.BEARER_TOKEN; properties = new AADAuthenticationProperties(); - properties.setGraphMembershipUri("http://localhost:9519/memberOf"); + properties.setGraphMembershipUri("http://localhost:8080/memberOf"); endpoints = new AADAuthorizationServerEndpoints(properties.getBaseUri(), properties.getTenantId()); clientId = "client"; clientSecret = "pass"; + wireMockRule = new WireMockRule(8080); + wireMockRule.start(); + } + + @AfterAll + public void close() { + if (wireMockRule.isRunning()) { + wireMockRule.shutdown(); + } } @Test @@ -83,7 +96,6 @@ public void getGroups() throws Exception { properties.getUserGroup().setAllowedGroups(Arrays.asList("group1", "group2", "group3")); AzureADGraphClient graphClientMock = new AzureADGraphClient(clientId, clientSecret, properties, endpoints); - stubFor(get(urlEqualTo("/memberOf")) .withHeader(ACCEPT, equalTo(APPLICATION_JSON_VALUE)) .willReturn(aResponse() @@ -118,12 +130,10 @@ public void userPrincipalIsSerializable() throws ParseException, IOException, Cl final UserPrincipal serializedPrincipal = (UserPrincipal) objectInputStream.readObject(); - Assert.assertNotNull("Serialized UserPrincipal not null", serializedPrincipal); - Assert.assertFalse("Serialized UserPrincipal kid not empty", - StringUtils.isEmpty(serializedPrincipal.getKid())); - Assert.assertNotNull("Serialized UserPrincipal claims not null.", serializedPrincipal.getClaims()); - Assert.assertTrue("Serialized UserPrincipal claims not empty.", - serializedPrincipal.getClaims().size() > 0); + assertNotNull(serializedPrincipal, "Serialized UserPrincipal not null"); + assertFalse(StringUtils.isEmpty(serializedPrincipal.getKid()), "Serialized UserPrincipal kid not empty"); + assertNotNull(serializedPrincipal.getClaims(), "Serialized UserPrincipal claims not null."); + assertTrue(serializedPrincipal.getClaims().size() > 0, "Serialized UserPrincipal claims not empty."); } finally { Files.deleteIfExists(tmpOutputFile.toPath()); } diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/cosmos/CosmosAutoConfigurationTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/cosmos/CosmosAutoConfigurationTest.java index fe06591cb942..0d58e960e289 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/cosmos/CosmosAutoConfigurationTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/cosmos/CosmosAutoConfigurationTest.java @@ -5,20 +5,20 @@ import com.azure.cosmos.ThrottlingRetryOptions; import com.azure.cosmos.implementation.ConnectionPolicy; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -@Ignore +@Disabled public class CosmosAutoConfigurationTest { - @BeforeClass + @BeforeAll public static void beforeClass() { PropertySettingUtil.setProperties(); } - @AfterClass + @AfterAll public static void afterClass() { PropertySettingUtil.unsetProperties(); } diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/cosmos/CosmosPropertiesTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/cosmos/CosmosPropertiesTest.java index 45a496e50291..6b9f06dd1ddb 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/cosmos/CosmosPropertiesTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/cosmos/CosmosPropertiesTest.java @@ -3,7 +3,7 @@ package com.azure.spring.autoconfigure.cosmos; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.boot.context.properties.ConfigurationPropertiesBindException; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.bind.validation.BindValidationException; @@ -19,6 +19,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class CosmosPropertiesTest { + @Test public void canSetAllProperties() { PropertySettingUtil.setProperties(); @@ -77,9 +78,9 @@ public void emptySettingNotAllowed() { Collections.sort(errorStrings); final List errorStringsExpected = Arrays.asList( - "Field error in object 'azure.cosmos' on field 'database': rejected value [null];", - "Field error in object 'azure.cosmos' on field 'key': rejected value [null];", - "Field error in object 'azure.cosmos' on field 'uri': rejected value [null];" + "Field error in object 'azure.cosmos' on field 'database': rejected value [null];", + "Field error in object 'azure.cosmos' on field 'key': rejected value [null];", + "Field error in object 'azure.cosmos' on field 'uri': rejected value [null];" ); assertThat(errorStrings.size()).isEqualTo(errorStringsExpected.size()); diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/cosmos/CosmosRepositoriesAutoConfigurationUnitTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/cosmos/CosmosRepositoriesAutoConfigurationUnitTest.java index fe76f759d5b0..f8a7ccbe4d7f 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/cosmos/CosmosRepositoriesAutoConfigurationUnitTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/cosmos/CosmosRepositoriesAutoConfigurationUnitTest.java @@ -3,23 +3,22 @@ package com.azure.spring.autoconfigure.cosmos; -import com.azure.spring.data.cosmos.core.CosmosTemplate; -import com.azure.spring.data.cosmos.repository.config.EnableCosmosRepositories; import com.azure.spring.autoconfigure.cosmos.domain.Person; import com.azure.spring.autoconfigure.cosmos.domain.PersonRepository; +import com.azure.spring.data.cosmos.core.CosmosTemplate; +import com.azure.spring.data.cosmos.repository.config.EnableCosmosRepositories; import org.assertj.core.api.Assertions; -import org.junit.After; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.mockito.InjectMocks; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Configuration; -@RunWith(MockitoJUnitRunner.class) -@Ignore +@Disabled public class CosmosRepositoriesAutoConfigurationUnitTest { private AnnotationConfigApplicationContext context; @@ -27,7 +26,12 @@ public class CosmosRepositoriesAutoConfigurationUnitTest { @InjectMocks private CosmosTemplate cosmosTemplate; - @After + @BeforeEach + public void setUp() { + MockitoAnnotations.openMocks(this); + } + + @AfterEach public void close() { if (this.context != null) { this.context.close(); @@ -41,10 +45,12 @@ public void testDefaultRepositoryConfiguration() throws Exception { Assertions.assertThat(this.context.getBean(PersonRepository.class)).isNotNull(); } - @Test(expected = NoSuchBeanDefinitionException.class) + @Test public void autConfigNotKickInIfManualConfigDidNotCreateRepositories() throws Exception { prepareApplicationContext(InvalidCustomConfiguration.class); - this.context.getBean(PersonRepository.class); + + org.junit.jupiter.api.Assertions.assertThrows(NoSuchBeanDefinitionException.class, + () -> this.context.getBean(PersonRepository.class)); } private void prepareApplicationContext(Class... configurationClasses) { diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/jms/ConnectionStringResolverTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/jms/ConnectionStringResolverTest.java index 17537dd50717..e565014ad0d7 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/jms/ConnectionStringResolverTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/jms/ConnectionStringResolverTest.java @@ -3,10 +3,11 @@ package com.azure.spring.autoconfigure.jms; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class ConnectionStringResolverTest { + @Test public void testConnectionStringResolver() { final String connectionString = "Endpoint=sb://host/;SharedAccessKeyName=sasKeyName;SharedAccessKey=sasKey"; @@ -16,8 +17,8 @@ public void testConnectionStringResolver() { final String sasKeyName = serviceBusKey.getSharedAccessKeyName(); final String sasKey = serviceBusKey.getSharedAccessKey(); - Assert.assertEquals("host", host); - Assert.assertEquals("sasKeyName", sasKeyName); - Assert.assertEquals("sasKey", sasKey); + Assertions.assertEquals("host", host); + Assertions.assertEquals("sasKeyName", sasKeyName); + Assertions.assertEquals("sasKey", sasKey); } } diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/jms/NonPremiumServiceBusJMSAutoConfigurationTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/jms/NonPremiumServiceBusJMSAutoConfigurationTest.java index a0209101fbe4..78a81597b206 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/jms/NonPremiumServiceBusJMSAutoConfigurationTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/jms/NonPremiumServiceBusJMSAutoConfigurationTest.java @@ -4,7 +4,8 @@ package com.azure.spring.autoconfigure.jms; import org.apache.qpid.jms.JmsConnectionFactory; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration; import org.springframework.boot.test.context.FilteredClassLoader; @@ -34,19 +35,22 @@ public void testAzureServiceBusNonPremiumAutoConfiguration() { .run(context -> assertThat(context).hasSingleBean(AzureServiceBusJMSProperties.class)); } - @Test(expected = IllegalStateException.class) + @Test public void testAzureServiceBusJMSPropertiesConnectionStringValidation() { ApplicationContextRunner contextRunner = getEmptyContextRunner(); - contextRunner.run(context -> context.getBean(AzureServiceBusJMSProperties.class)); + contextRunner.run( + context -> Assertions.assertThrows(IllegalStateException.class, + () -> context.getBean(AzureServiceBusJMSProperties.class))); } - @Test(expected = IllegalStateException.class) + @Test public void testAzureServiceBusJMSPropertiesPricingTireValidation() { ApplicationContextRunner contextRunner = getEmptyContextRunner(); contextRunner.withPropertyValues( "spring.jms.servicebus.pricing-tier=fake", "spring.jms.servicebus.connection-string=" + CONNECTION_STRING) - .run(context -> context.getBean(AzureServiceBusJMSProperties.class)); + .run(context -> Assertions.assertThrows(IllegalStateException.class, + () -> context.getBean(AzureServiceBusJMSProperties.class))); } @Test @@ -90,7 +94,8 @@ public void testAzureServiceBusJMSPropertiesConfigured() { private ApplicationContextRunner getEmptyContextRunner() { return new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(NonPremiumServiceBusJMSAutoConfiguration.class, JmsAutoConfiguration.class)) + .withConfiguration(AutoConfigurations.of(NonPremiumServiceBusJMSAutoConfiguration.class, + JmsAutoConfiguration.class)) .withPropertyValues( "spring.jms.servicebus.pricing-tier=basic" ); @@ -99,7 +104,8 @@ private ApplicationContextRunner getEmptyContextRunner() { private ApplicationContextRunner getContextRunnerWithProperties() { return new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(NonPremiumServiceBusJMSAutoConfiguration.class, JmsAutoConfiguration.class)) + .withConfiguration(AutoConfigurations.of(NonPremiumServiceBusJMSAutoConfiguration.class, + JmsAutoConfiguration.class)) .withPropertyValues( "spring.jms.servicebus.connection-string=" + CONNECTION_STRING, "spring.jms.servicebus.topic-client-id=cid", diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/jms/PremiumServiceBusJMSAutoConfigurationTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/jms/PremiumServiceBusJMSAutoConfigurationTest.java index 77e8d3081fef..7cc42d8c1137 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/jms/PremiumServiceBusJMSAutoConfigurationTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/jms/PremiumServiceBusJMSAutoConfigurationTest.java @@ -4,7 +4,8 @@ package com.azure.spring.autoconfigure.jms; import com.microsoft.azure.servicebus.jms.ServiceBusJmsConnectionFactory; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration; import org.springframework.boot.test.context.FilteredClassLoader; @@ -34,10 +35,12 @@ public void testAzureServiceBusPremiumAutoConfiguration() { .run(context -> assertThat(context).hasSingleBean(AzureServiceBusJMSProperties.class)); } - @Test(expected = IllegalStateException.class) + @Test public void testAzureServiceBusJMSPropertiesConnectionStringValidation() { ApplicationContextRunner contextRunner = getEmptyContextRunner(); - contextRunner.run(context -> context.getBean(AzureServiceBusJMSProperties.class)); + contextRunner.run( + context -> Assertions.assertThrows(IllegalStateException.class, + () -> context.getBean(AzureServiceBusJMSProperties.class))); } @Test diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/AzureStorageResourcePatternResolverTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/AzureStorageResourcePatternResolverTest.java index 86a49f5e0df4..0da160490163 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/AzureStorageResourcePatternResolverTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/AzureStorageResourcePatternResolverTest.java @@ -17,27 +17,29 @@ import com.azure.storage.file.share.ShareServiceClient; import com.azure.storage.file.share.models.ShareFileItem; import com.azure.storage.file.share.models.ShareItem; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; import java.io.IOException; import java.util.ArrayList; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** * The JUnit tests for the AzureStorageResourcePatternResolver class. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) @SpringBootTest(properties = "spring.main.banner-mode=off") -@RunWith(SpringRunner.class) public class AzureStorageResourcePatternResolverTest { /** @@ -52,6 +54,18 @@ public class AzureStorageResourcePatternResolverTest { @Autowired private ShareServiceClient shareServiceClient; + private AutoCloseable closeable; + + @BeforeAll + public void setUp() { + this.closeable = MockitoAnnotations.openMocks(this); + } + + @AfterAll + public void close() throws Exception { + closeable.close(); + } + /** * Test getResources method. * diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/StorageAutoConfigurationTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/StorageAutoConfigurationTest.java index b764d0d9ce06..a95a9b65702d 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/StorageAutoConfigurationTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/StorageAutoConfigurationTest.java @@ -5,8 +5,7 @@ import com.azure.storage.blob.BlobServiceClientBuilder; import com.azure.storage.file.share.ShareServiceClientBuilder; -import org.assertj.core.api.Assertions; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -15,6 +14,8 @@ import org.springframework.core.io.ClassPathResource; import static org.assertj.core.api.Assertions.assertThat; + +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; public class StorageAutoConfigurationTest { @@ -35,10 +36,11 @@ public void testWithoutStorageClient() { .run(context -> assertThat(context).doesNotHaveBean(StorageProperties.class)); } - @Test(expected = IllegalStateException.class) + @Test public void testAzureStoragePropertiesIllegal() { this.contextRunner.withPropertyValues("azure.storage.accountName=a") - .run(context -> context.getBean(StorageProperties.class)); + .run(context -> assertThrows(IllegalStateException.class, + () -> context.getBean(StorageProperties.class))); } @Test @@ -49,9 +51,9 @@ public void testAzureStoragePropertiesConfigured() { .run(context -> { assertThat(context).hasSingleBean(StorageProperties.class); final StorageProperties storageProperties = context.getBean(StorageProperties.class); - Assertions.assertThat(storageProperties.getAccountName()).isEqualTo("acc1"); - Assertions.assertThat(storageProperties.getAccountKey()).isEqualTo("key1"); - Assertions.assertThat(storageProperties.getBlobEndpoint()).isEqualTo("endpoint1"); + assertThat(storageProperties.getAccountName()).isEqualTo("acc1"); + assertThat(storageProperties.getAccountKey()).isEqualTo("key1"); + assertThat(storageProperties.getBlobEndpoint()).isEqualTo("endpoint1"); }); } diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/actuator/BlobStorageHealthIndicatorTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/actuator/BlobStorageHealthIndicatorTest.java index 1ef55336a6db..b869f6fab4c5 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/actuator/BlobStorageHealthIndicatorTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/actuator/BlobStorageHealthIndicatorTest.java @@ -12,8 +12,8 @@ import com.azure.storage.blob.models.StorageAccountInfo; import com.azure.storage.file.share.ShareServiceClientBuilder; import org.apache.http.HttpException; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Status; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -29,7 +29,7 @@ public class BlobStorageHealthIndicatorTest { private static final String MOCK_URL = "https://example.org/bigly_fake_url"; - @Test(expected = IllegalStateException.class) + @Test public void testWithNoStorageConfiguration() { ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withAllowBeanDefinitionOverriding(true) @@ -37,7 +37,9 @@ public void testWithNoStorageConfiguration() { .withBean(ShareServiceClientBuilder.class) .withConfiguration(AutoConfigurations.of(StorageHealthConfiguration.class)); - contextRunner.run(context -> context.getBean(BlobStorageHealthIndicator.class).getHealth(true)); + contextRunner.run(context -> + Assertions.assertThrows(IllegalStateException.class, + () -> context.getBean(BlobStorageHealthIndicator.class).getHealth(true))); } @Test @@ -51,8 +53,8 @@ public void testWithStorageConfigurationWithConnectionUp() { contextRunner.run(context -> { Health health = context.getBean("blobStorageHealthIndicator", BlobStorageHealthIndicator.class) .getHealth(true); - Assert.assertEquals(Status.UP, health.getStatus()); - Assert.assertEquals(MOCK_URL, health.getDetails().get(Constants.URL_FIELD)); + Assertions.assertEquals(Status.UP, health.getStatus()); + Assertions.assertEquals(MOCK_URL, health.getDetails().get(Constants.URL_FIELD)); }); } @@ -67,8 +69,8 @@ public void testWithStorageConfigurationWithConnectionDown() { contextRunner.run(context -> { Health health = context.getBean("blobStorageHealthIndicator", BlobStorageHealthIndicator.class) .getHealth(true); - Assert.assertEquals(Status.DOWN, health.getStatus()); - Assert.assertEquals(MOCK_URL, health.getDetails().get(Constants.URL_FIELD)); + Assertions.assertEquals(Status.DOWN, health.getStatus()); + Assertions.assertEquals(MOCK_URL, health.getDetails().get(Constants.URL_FIELD)); }); } diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/actuator/FileStorageHealthIndicatorTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/actuator/FileStorageHealthIndicatorTest.java index 7dacb2bead8a..729f4dd39604 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/actuator/FileStorageHealthIndicatorTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/actuator/FileStorageHealthIndicatorTest.java @@ -10,8 +10,8 @@ import com.azure.storage.file.share.ShareServiceClientBuilder; import com.azure.storage.file.share.models.ShareServiceProperties; import org.apache.http.HttpException; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Status; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -27,16 +27,16 @@ public class FileStorageHealthIndicatorTest { private static final String MOCK_URL = "https://example.org/bigly_fake_url"; - @Test(expected = IllegalStateException.class) + @Test public void testWithNoStorageConfiguration() { ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withAllowBeanDefinitionOverriding(true) .withBean(ShareServiceClientBuilder.class) .withConfiguration(AutoConfigurations.of(StorageHealthConfiguration.class)); - contextRunner.withBean(FileStorageHealthIndicator.class).run(context -> { - context.getBean(FileStorageHealthIndicator.class).getHealth(true); - }); + contextRunner.withBean(FileStorageHealthIndicator.class).run(context -> + Assertions.assertThrows(IllegalStateException.class, + () -> context.getBean(FileStorageHealthIndicator.class).getHealth(true))); } @Test @@ -48,8 +48,8 @@ public void testWithStorageConfigurationWithConnectionUp() { .withPropertyValues("azure.storage.account-name=acc1"); contextRunner.run(context -> { Health health = context.getBean(FileStorageHealthIndicator.class).getHealth(true); - Assert.assertEquals(Status.UP, health.getStatus()); - Assert.assertEquals(MOCK_URL, health.getDetails().get(URL_FIELD)); + Assertions.assertEquals(Status.UP, health.getStatus()); + Assertions.assertEquals(MOCK_URL, health.getDetails().get(URL_FIELD)); }); } @@ -62,8 +62,8 @@ public void testWithStorageConfigurationWithConnectionDown() { .withPropertyValues("azure.storage.account-name=acc1"); contextRunner.run(context -> { Health health = context.getBean(FileStorageHealthIndicator.class).getHealth(true); - Assert.assertEquals(Status.DOWN, health.getStatus()); - Assert.assertEquals(MOCK_URL, health.getDetails().get(URL_FIELD)); + Assertions.assertEquals(Status.DOWN, health.getStatus()); + Assertions.assertEquals(MOCK_URL, health.getDetails().get(URL_FIELD)); }); } diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/resource/AzureBlobStorageTests.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/resource/AzureBlobStorageTests.java index 315e8f35db4e..7bdfcaddcb07 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/resource/AzureBlobStorageTests.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/storage/resource/AzureBlobStorageTests.java @@ -11,9 +11,8 @@ import com.azure.storage.blob.specialized.BlobInputStream; import com.azure.storage.blob.specialized.BlobOutputStream; import com.azure.storage.blob.specialized.BlockBlobClient; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; @@ -22,7 +21,6 @@ import org.springframework.context.annotation.Import; import org.springframework.core.io.Resource; import org.springframework.core.io.WritableResource; -import org.springframework.test.context.junit4.SpringRunner; import java.io.FileNotFoundException; import java.io.OutputStream; @@ -36,7 +34,6 @@ * @author Warren Zhu */ @SpringBootTest(properties = "spring.main.banner-mode=off") -@RunWith(SpringRunner.class) public class AzureBlobStorageTests { private static final String CONTAINER_NAME = "container"; @@ -50,27 +47,29 @@ public class AzureBlobStorageTests { @Autowired private BlobServiceClient blobServiceClient; - @Test(expected = IllegalArgumentException.class) + @Test public void testEmptyPath() { - new BlobStorageResource(this.blobServiceClient, "azure-blob://"); + Assertions.assertThrows(IllegalArgumentException.class, () -> new BlobStorageResource(this.blobServiceClient, + "azure-blob://")); } - @Test(expected = IllegalArgumentException.class) + @Test public void testSlashPath() { - new BlobStorageResource(this.blobServiceClient, "azure-blob:///"); + Assertions.assertThrows(IllegalArgumentException.class, () -> new BlobStorageResource(this.blobServiceClient, + "azure-blob:///")); } @Test public void testValidObject() throws Exception { - Assert.assertTrue(this.remoteResource.exists()); - Assert.assertEquals(CONTENT_LENGTH, this.remoteResource.contentLength()); + Assertions.assertTrue(this.remoteResource.exists()); + Assertions.assertEquals(CONTENT_LENGTH, this.remoteResource.contentLength()); } @Test public void testWritable() throws Exception { - Assert.assertTrue(this.remoteResource instanceof WritableResource); + Assertions.assertTrue(this.remoteResource instanceof WritableResource); WritableResource writableResource = (WritableResource) this.remoteResource; - Assert.assertTrue(writableResource.isWritable()); + Assertions.assertTrue(writableResource.isWritable()); writableResource.getOutputStream(); } @@ -80,44 +79,44 @@ public void testWritableOutputStream() throws Exception { BlobStorageResource resource = new BlobStorageResource(blobServiceClient, location); OutputStream os = resource.getOutputStream(); - Assert.assertNotNull(os); + Assertions.assertNotNull(os); } - @Test(expected = FileNotFoundException.class) - public void testWritableOutputStreamNoAutoCreateOnNullBlob() throws Exception { + @Test + public void testWritableOutputStreamNoAutoCreateOnNullBlob() { String location = "azure-blob://container/non-existing"; BlobStorageResource resource = new BlobStorageResource(this.blobServiceClient, location); - resource.getOutputStream(); + Assertions.assertThrows(FileNotFoundException.class, () -> resource.getOutputStream()); } - @Test(expected = FileNotFoundException.class) - public void testGetInputStreamOnNullBlob() throws Exception { + @Test + public void testGetInputStreamOnNullBlob() { String location = "azure-blob://container/non-existing"; BlobStorageResource resource = new BlobStorageResource(blobServiceClient, location); - resource.getInputStream(); + Assertions.assertThrows(FileNotFoundException.class, () -> resource.getInputStream()); } @Test public void testGetFilenameOnNonExistingBlob() { String location = "azure-blob://container/non-existing"; BlobStorageResource resource = new BlobStorageResource(blobServiceClient, location); - Assert.assertEquals(NON_EXISTING, resource.getFilename()); + Assertions.assertEquals(NON_EXISTING, resource.getFilename()); } @Test public void testContainerDoesNotExist() { BlobStorageResource resource = new BlobStorageResource(this.blobServiceClient, "azure-blob://non-existing/blob"); - Assert.assertFalse(resource.exists()); + Assertions.assertFalse(resource.exists()); } @Test public void testContainerExistsButResourceDoesNot() { BlobStorageResource resource = new BlobStorageResource(this.blobServiceClient, "azure-blob://container/non-existing"); - Assert.assertFalse(resource.exists()); + Assertions.assertFalse(resource.exists()); } @Configuration diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/cloudfoundry/environment/AzureCloudFoundryServiceApplicationTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/cloudfoundry/environment/AzureCloudFoundryServiceApplicationTest.java index c8ffda698118..dfdee77aab9f 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/cloudfoundry/environment/AzureCloudFoundryServiceApplicationTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/cloudfoundry/environment/AzureCloudFoundryServiceApplicationTest.java @@ -3,8 +3,7 @@ package com.azure.spring.cloudfoundry.environment; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -12,17 +11,15 @@ import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; -@RunWith(SpringRunner.class) @SpringBootTest @ContextConfiguration(classes = {VcapProcessor.class}) public class AzureCloudFoundryServiceApplicationTest { diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/CaseSensitiveKeyVaultTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/CaseSensitiveKeyVaultTest.java index cd35b152d802..f18385ae8674 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/CaseSensitiveKeyVaultTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/CaseSensitiveKeyVaultTest.java @@ -4,31 +4,42 @@ package com.azure.spring.keyvault; import com.azure.security.keyvault.secrets.SecretClient; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import java.util.ArrayList; import java.util.LinkedHashMap; import static com.azure.spring.utils.Constants.DEFAULT_REFRESH_INTERVAL_MS; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; - -@RunWith(MockitoJUnitRunner.class) public class CaseSensitiveKeyVaultTest { + private AutoCloseable closeable; + @Mock private SecretClient keyVaultClient; + @BeforeEach + public void setup() { + closeable = MockitoAnnotations.openMocks(this); + } + + @AfterEach + public void close() throws Exception { + closeable.close(); + } + @Test public void testGet() { final KeyVaultOperation keyVaultOperation = new KeyVaultOperation( - keyVaultClient, - DEFAULT_REFRESH_INTERVAL_MS, - new ArrayList<>(), - true); + keyVaultClient, + DEFAULT_REFRESH_INTERVAL_MS, + new ArrayList<>(), + true); final LinkedHashMap properties = new LinkedHashMap<>(); properties.put("key1", "value1"); diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/InitializerTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/InitializerTest.java index 21aff5ec99ff..feb169a3c154 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/InitializerTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/InitializerTest.java @@ -4,18 +4,19 @@ package com.azure.spring.keyvault; import com.azure.spring.utils.Constants; -import org.junit.Test; -import org.junit.runner.RunWith; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.MutablePropertySources; import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertFalse; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @TestPropertySource(locations = "classpath:application.properties") public class InitializerTest { @@ -25,9 +26,9 @@ public class InitializerTest { @Test public void testAzureKvPropertySourceNotInitialized() { final MutablePropertySources sources = - ((ConfigurableEnvironment) context.getEnvironment()).getPropertySources(); + ((ConfigurableEnvironment) context.getEnvironment()).getPropertySources(); - assertFalse("PropertySources should not contains azurekv when enabled=false", - sources.contains(Constants.AZURE_KEYVAULT_PROPERTYSOURCE_NAME)); + assertFalse(sources.contains(Constants.AZURE_KEYVAULT_PROPERTYSOURCE_NAME), "PropertySources should not " + + "contains azurekv when enabled=false"); } } diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/KeyVaultEnvironmentPostProcessorTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/KeyVaultEnvironmentPostProcessorTest.java index 1bca6eec71a4..b3887d08c26c 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/KeyVaultEnvironmentPostProcessorTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/KeyVaultEnvironmentPostProcessorTest.java @@ -8,8 +8,8 @@ import com.azure.identity.ClientSecretCredential; import com.azure.identity.ManagedIdentityCredential; import org.hamcrest.core.IsInstanceOf; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; @@ -28,7 +28,7 @@ import static com.azure.spring.keyvault.KeyVaultProperties.Property.CLIENT_KEY; import static com.azure.spring.keyvault.KeyVaultProperties.Property.TENANT_ID; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class KeyVaultEnvironmentPostProcessorTest { private KeyVaultEnvironmentPostProcessorHelper keyVaultEnvironmentPostProcessorHelper; @@ -36,7 +36,7 @@ public class KeyVaultEnvironmentPostProcessorTest { private MutablePropertySources propertySources; private Map testProperties = new HashMap<>(); - @Before + @BeforeEach public void setup() { environment = new MockEnvironment(); environment.setProperty(KeyVaultProperties.getPropertyName(ALLOW_TELEMETRY), "false"); @@ -114,16 +114,16 @@ public void postProcessorHasConfiguredOrder() { @Test public void postProcessorOrderConfigurable() { final ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(OrderedProcessConfig.class)) - .withPropertyValues("azure.keyvault.uri=fakeuri", "azure.keyvault.enabled=true"); + .withConfiguration(AutoConfigurations.of(OrderedProcessConfig.class)) + .withPropertyValues("azure.keyvault.uri=fakeuri", "azure.keyvault.enabled=true"); contextRunner.run(context -> { assertThat("Configured order for KeyVaultEnvironmentPostProcessor is different with default order " + "value.", KeyVaultEnvironmentPostProcessor.DEFAULT_ORDER != OrderedProcessConfig.TEST_ORDER); - assertEquals("KeyVaultEnvironmentPostProcessor order should be changed.", - OrderedProcessConfig.TEST_ORDER, - context.getBean(KeyVaultEnvironmentPostProcessor.class).getOrder()); + assertEquals(OrderedProcessConfig.TEST_ORDER, + context.getBean(KeyVaultEnvironmentPostProcessor.class).getOrder(), "KeyVaultEnvironmentPostProcessor" + + " order should be changed."); }); } diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/KeyVaultOperationUnitTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/KeyVaultOperationUnitTest.java index 081a9102d5a6..f5d9eea07574 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/KeyVaultOperationUnitTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/KeyVaultOperationUnitTest.java @@ -12,10 +12,11 @@ import com.azure.security.keyvault.secrets.SecretClient; import com.azure.security.keyvault.secrets.models.KeyVaultSecret; import com.azure.security.keyvault.secrets.models.SecretProperties; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -27,7 +28,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) public class KeyVaultOperationUnitTest { private static final List SECRET_KEYS_CONFIG = Arrays.asList("key1", "key2", "key3"); @@ -55,8 +55,21 @@ public class KeyVaultOperationUnitTest { @Mock private SecretClient keyVaultClient; + private KeyVaultOperation keyVaultOperation; + private AutoCloseable closeable; + + @BeforeEach + public void setup() { + closeable = MockitoAnnotations.openMocks(this); + } + + @AfterEach + public void close() throws Exception { + closeable.close(); + } + public void setupSecretBundle(List secretKeysConfig) { keyVaultOperation = new KeyVaultOperation( keyVaultClient, diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/KeyVaultPropertySourceUnitTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/KeyVaultPropertySourceUnitTest.java index 8eb33088379a..7a04b56e4927 100644 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/KeyVaultPropertySourceUnitTest.java +++ b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/keyvault/KeyVaultPropertySourceUnitTest.java @@ -3,26 +3,33 @@ package com.azure.spring.keyvault; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) + public class KeyVaultPropertySourceUnitTest { private static final String TEST_PROPERTY_NAME_1 = "testPropertyName1"; + + private AutoCloseable closeable; + @Mock KeyVaultOperation keyVaultOperation; + KeyVaultPropertySource keyVaultPropertySource; - @Before + @BeforeEach public void setup() { + closeable = MockitoAnnotations.openMocks(this); + final String[] propertyNameList = new String[]{TEST_PROPERTY_NAME_1}; when(keyVaultOperation.getProperty(anyString())).thenReturn(TEST_PROPERTY_NAME_1); @@ -31,6 +38,11 @@ public void setup() { keyVaultPropertySource = new KeyVaultPropertySource(keyVaultOperation); } + @AfterEach + public void close() throws Exception { + closeable.close(); + } + @Test public void testGetPropertyNames() { final String[] result = keyVaultPropertySource.getPropertyNames(); diff --git a/sdk/spring/azure-spring-cloud-autoconfigure/pom.xml b/sdk/spring/azure-spring-cloud-autoconfigure/pom.xml index 007c32797133..e531143d825d 100644 --- a/sdk/spring/azure-spring-cloud-autoconfigure/pom.xml +++ b/sdk/spring/azure-spring-cloud-autoconfigure/pom.xml @@ -154,6 +154,7 @@ true + org.springframework.boot spring-boot-starter-test @@ -161,34 +162,6 @@ test - - org.junit.vintage - junit-vintage-engine - 5.7.2 - test - - - - org.mockito - mockito-core - 3.9.0 - test - - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - - com.azure.spring diff --git a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/cache/AzureRedisAutoConfigurationTest.java b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/cache/AzureRedisAutoConfigurationTest.java index 55f93061cdef..4cde7e260e04 100644 --- a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/cache/AzureRedisAutoConfigurationTest.java +++ b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/cache/AzureRedisAutoConfigurationTest.java @@ -6,7 +6,7 @@ import com.azure.resourcemanager.redis.models.RedisAccessKeys; import com.azure.resourcemanager.redis.models.RedisCache; import com.azure.spring.cloud.context.core.impl.RedisCacheManager; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.data.redis.RedisProperties; import org.springframework.boot.test.context.FilteredClassLoader; @@ -16,6 +16,7 @@ import org.springframework.data.redis.core.RedisOperations; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -31,26 +32,30 @@ public class AzureRedisAutoConfigurationTest { @Test public void testAzureRedisDisabled() { this.contextRunner.withPropertyValues("spring.cloud.azure.redis.enabled=false") - .run(context -> assertThat(context).doesNotHaveBean(AzureRedisProperties.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureRedisProperties.class)); } @Test public void testWithoutRedisOperationsClass() { this.contextRunner.withClassLoader(new FilteredClassLoader(RedisOperations.class)) - .run(context -> assertThat(context).doesNotHaveBean(AzureRedisProperties.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureRedisProperties.class)); } - @Test(expected = IllegalStateException.class) + @Test public void testAzureRedisPropertiesIllegal() { this.contextRunner.withUserConfiguration(TestConfiguration.class) - .withPropertyValues("spring.cloud.azure.redis.name=") - .run(context -> context.getBean(AzureRedisProperties.class)); + .withPropertyValues("spring.cloud.azure.redis.name=") + .run(context -> assertThrows(IllegalStateException.class, + () -> context.getBean(AzureRedisProperties.class))); } @Test public void testAzureRedisPropertiesConfigured() { - this.contextRunner.withUserConfiguration(TestConfiguration.class). - withPropertyValues("spring.cloud.azure.redis.name=redis").run(context -> { + this.contextRunner + .withUserConfiguration(TestConfiguration.class) + .withPropertyValues("spring.cloud.azure.redis.name=redis") + .run( + context -> { assertThat(context).hasSingleBean(AzureRedisProperties.class); assertThat(context.getBean(AzureRedisProperties.class).getName()).isEqualTo("redis"); assertThat(context).hasSingleBean(RedisProperties.class); diff --git a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/cloudfoundry/AzureCloudFoundryEnvironmentPostProcessorTests.java b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/cloudfoundry/AzureCloudFoundryEnvironmentPostProcessorTests.java index 263d3e904097..a927e815a1ce 100644 --- a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/cloudfoundry/AzureCloudFoundryEnvironmentPostProcessorTests.java +++ b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/cloudfoundry/AzureCloudFoundryEnvironmentPostProcessorTests.java @@ -6,7 +6,7 @@ import com.azure.spring.cloud.autoconfigure.storage.AzureStorageProperties; import com.azure.spring.cloud.autoconfigure.eventhub.AzureEventHubProperties; import com.azure.spring.cloud.autoconfigure.servicebus.AzureServiceBusProperties; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.data.redis.RedisProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.assertj.AssertableApplicationContext; diff --git a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhub/AzureEventHubAutoConfigurationTest.java b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhub/AzureEventHubAutoConfigurationTest.java index 5fd39f5ae8d9..67c919af2a89 100644 --- a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhub/AzureEventHubAutoConfigurationTest.java +++ b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhub/AzureEventHubAutoConfigurationTest.java @@ -16,7 +16,7 @@ import com.azure.spring.integration.eventhub.api.EventHubClientFactory; import com.azure.spring.integration.eventhub.api.EventHubOperation; import com.azure.spring.integration.eventhub.factory.EventHubConnectionStringProvider; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.FilteredClassLoader; @@ -31,6 +31,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import static org.junit.jupiter.api.Assertions.assertThrows; public class AzureEventHubAutoConfigurationTest { @@ -52,10 +53,11 @@ public void testWithoutEventHubClient() { .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubProperties.class)); } - @Test(expected = IllegalStateException.class) + @Test public void testAzureEventHubPropertiesStorageAccountIllegal() { this.contextRunner.withPropertyValues(EVENT_HUB_PROPERTY_PREFIX + "checkpoint-storage-account=1") - .run(context -> context.getBean(AzureEventHubProperties.class)); + .run(context -> assertThrows(IllegalStateException.class, + () -> context.getBean(AzureEventHubProperties.class))); } @Test diff --git a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhub/AzureEventHubKafkaAutoConfigurationTest.java b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhub/AzureEventHubKafkaAutoConfigurationTest.java index 3c1eb1bd6c01..4159ba5c8e97 100644 --- a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhub/AzureEventHubKafkaAutoConfigurationTest.java +++ b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/eventhub/AzureEventHubKafkaAutoConfigurationTest.java @@ -14,8 +14,8 @@ import com.azure.resourcemanager.eventhubs.models.EventHubNamespaceAuthorizationRule; import com.azure.resourcemanager.eventhubs.models.EventHubNamespaces; import com.azure.spring.cloud.context.core.config.AzureProperties; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.kafka.KafkaProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; @@ -31,6 +31,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import static org.junit.jupiter.api.Assertions.assertThrows; public class AzureEventHubKafkaAutoConfigurationTest { @@ -51,12 +52,13 @@ public void testWithoutKafkaTemplate() { .run(context -> assertThat(context).doesNotHaveBean(AzureEventHubProperties.class)); } - @Test(expected = IllegalStateException.class) + @Test public void testAzureEventHubPropertiesStorageAccountIllegal() { this.contextRunner.withPropertyValues( EVENT_HUB_PROPERTY_PREFIX + "namespace=ns1", EVENT_HUB_PROPERTY_PREFIX + "checkpoint-storage-account=1") - .run(context -> context.getBean(AzureEventHubProperties.class)); + .run(context -> assertThrows(IllegalStateException.class, + () -> context.getBean(AzureEventHubProperties.class))); } @Test @@ -68,7 +70,7 @@ public void testNamespaceProvided() { .run(context -> context.getBean(AzureEventHubProperties.class)); } - @Ignore("org.apache.kafka.common.serialization.StringSerializer required on classpath") + @Disabled("org.apache.kafka.common.serialization.StringSerializer required on classpath") @Test public void testAzureEventHubPropertiesConfigured() { this.contextRunner.withPropertyValues(EVENT_HUB_PROPERTY_PREFIX + "namespace=ns1").run(context -> { diff --git a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusAutoConfigurationTest.java b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusAutoConfigurationTest.java index 2f36e4b8f506..4a6ae9f34396 100644 --- a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusAutoConfigurationTest.java +++ b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusAutoConfigurationTest.java @@ -8,7 +8,7 @@ import com.azure.spring.cloud.context.core.config.AzureProperties; import com.azure.spring.cloud.context.core.impl.ServiceBusNamespaceManager; import com.azure.spring.integration.servicebus.factory.ServiceBusConnectionStringProvider; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.context.properties.EnableConfigurationProperties; @@ -20,6 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; +import static org.junit.jupiter.api.Assertions.assertThrows; public class AzureServiceBusAutoConfigurationTest { @@ -63,10 +64,11 @@ public void testWithoutServiceBusSDKInClasspath() { .run(context -> assertThat(context).doesNotHaveBean(AzureServiceBusProperties.class)); } - @Test(expected = NoSuchBeanDefinitionException.class) + @Test public void testAzureServiceBusPropertiesValidation() { this.contextRunner.withClassLoader(new FilteredClassLoader(ServiceBusReceivedMessage.class)) - .run(context -> context.getBean(AzureServiceBusProperties.class)); + .run(context -> assertThrows(NoSuchBeanDefinitionException.class, + () -> context.getBean(AzureServiceBusProperties.class))); } @Test diff --git a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusQueueAutoConfigurationTest.java b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusQueueAutoConfigurationTest.java index 20a43448282c..d5d793ca7cb2 100644 --- a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusQueueAutoConfigurationTest.java +++ b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusQueueAutoConfigurationTest.java @@ -13,7 +13,11 @@ import com.azure.spring.integration.servicebus.factory.ServiceBusQueueClientFactory; import com.azure.spring.integration.servicebus.queue.ServiceBusQueueOperation; import com.azure.spring.integration.servicebus.queue.ServiceBusQueueTemplate; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.mockito.MockitoAnnotations; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.FilteredClassLoader; @@ -29,6 +33,7 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.mockito.Mockito.mock; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class AzureServiceBusQueueAutoConfigurationTest { private static final String SERVICE_BUS_PROPERTY_PREFIX = "spring.cloud.azure.servicebus."; @@ -40,15 +45,27 @@ public class AzureServiceBusQueueAutoConfigurationTest { private static final String SHARED_ACCESS_KEY_NAME = "dummySasKeyName"; private static final String SHARED_ACCESS_KEY = "dummySasKey"; private static final String ENDPOINT = getUri(ENDPOINT_FORMAT, NAMESPACE_NAME, DEFAULT_DOMAIN_NAME).toString(); - static final String NAMESPACE_CONNECTION_STRING = String.format("Endpoint=%s;SharedAccessKeyName=%s;SharedAccessKey=%s", - ENDPOINT, SHARED_ACCESS_KEY_NAME, SHARED_ACCESS_KEY); + static final String NAMESPACE_CONNECTION_STRING = String.format("Endpoint=%s;SharedAccessKeyName=%s;" + + "SharedAccessKey=%s", + ENDPOINT, SHARED_ACCESS_KEY_NAME, SHARED_ACCESS_KEY); + private AutoCloseable closeable; + + @BeforeAll + public void setup() { + this.closeable = MockitoAnnotations.openMocks(this); + } + + @AfterAll + public void close() throws Exception { + this.closeable.close(); + } private static URI getUri(String endpointFormat, String namespace, String domainName) { try { return new URI(String.format(Locale.US, endpointFormat, namespace, domainName)); } catch (URISyntaxException exception) { throw new IllegalArgumentException(String.format(Locale.US, - "Invalid namespace name: %s", namespace), exception); + "Invalid namespace name: %s", namespace), exception); } } @@ -75,7 +92,8 @@ public void testWithoutServiceBusNamespaceManager() { @Test public void testWithServiceBusNamespaceManager() { - this.contextRunner.withUserConfiguration(TestConfigWithServiceBusNamespaceManager.class, TestConfigWithConnectionStringProvider.class) + this.contextRunner.withUserConfiguration(TestConfigWithServiceBusNamespaceManager.class, + TestConfigWithConnectionStringProvider.class) .run(context -> assertThat(context).hasSingleBean(ServiceBusQueueManager.class)); } @@ -93,7 +111,8 @@ public void testConnectionStringProvided() { this.contextRunner.withPropertyValues(SERVICE_BUS_PROPERTY_PREFIX + "connection-string=" + NAMESPACE_CONNECTION_STRING) .withUserConfiguration(AzureServiceBusAutoConfiguration.class) .run(context -> { - assertThat(context.getBean(ServiceBusConnectionStringProvider.class).getConnectionString()).isEqualTo(NAMESPACE_CONNECTION_STRING); + assertThat(context.getBean(ServiceBusConnectionStringProvider.class) + .getConnectionString()).isEqualTo(NAMESPACE_CONNECTION_STRING); assertThat(context).doesNotHaveBean(ServiceBusNamespaceManager.class); assertThat(context).doesNotHaveBean(ServiceBusQueueManager.class); assertThat(context).hasSingleBean(ServiceBusQueueClientFactory.class); @@ -132,7 +151,8 @@ public void testMessageConverterProvided() { assertThat(context).hasSingleBean(ServiceBusMessageConverter.class); assertThat(context).hasSingleBean(ServiceBusQueueTemplate.class); - ServiceBusMessageConverter messageConverter = context.getBean(ServiceBusMessageConverter.class); + ServiceBusMessageConverter messageConverter = + context.getBean(ServiceBusMessageConverter.class); ServiceBusQueueTemplate queueTemplate = context.getBean(ServiceBusQueueTemplate.class); assertSame(messageConverter, queueTemplate.getMessageConverter()); }); diff --git a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusTopicAutoConfigurationTest.java b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusTopicAutoConfigurationTest.java index 9f32dcf5cf6c..e23b0df30e75 100644 --- a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusTopicAutoConfigurationTest.java +++ b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/AzureServiceBusTopicAutoConfigurationTest.java @@ -14,7 +14,11 @@ import com.azure.spring.integration.servicebus.factory.ServiceBusTopicClientFactory; import com.azure.spring.integration.servicebus.topic.ServiceBusTopicOperation; import com.azure.spring.integration.servicebus.topic.ServiceBusTopicTemplate; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.mockito.MockitoAnnotations; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.FilteredClassLoader; @@ -27,6 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.mockito.Mockito.mock; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class AzureServiceBusTopicAutoConfigurationTest { private static final String SERVICE_BUS_PROPERTY_PREFIX = "spring.cloud.azure.servicebus."; @@ -34,6 +39,17 @@ public class AzureServiceBusTopicAutoConfigurationTest { private ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(AzureServiceBusTopicAutoConfiguration.class)); + private AutoCloseable closeable; + + @BeforeAll + public void setup() { + this.closeable = MockitoAnnotations.openMocks(this); + } + + @AfterAll + public void close() throws Exception { + this.closeable.close(); + } @Test public void testAzureServiceBusTopicDisabled() { @@ -64,7 +80,8 @@ public void testWithServiceBusNamespaceManager() { @Test public void testTopicClientFactoryCreated() { - this.contextRunner.withUserConfiguration(TestConfigWithConnectionStringProvider.class, TestConfigWithServiceBusNamespaceManager.class) + this.contextRunner.withUserConfiguration(TestConfigWithConnectionStringProvider.class, + TestConfigWithServiceBusNamespaceManager.class) .run(context -> assertThat(context).hasSingleBean(ServiceBusTopicClientFactory.class) .hasSingleBean(ServiceBusTopicOperation.class)); } @@ -86,7 +103,8 @@ public void testConnectionStringProvided() { @Test public void testResourceManagerProvided() { - this.contextRunner.withUserConfiguration(TestConfigWithAzureResourceManager.class, TestConfigWithConnectionStringProvider.class, AzureServiceBusAutoConfiguration.class) + this.contextRunner.withUserConfiguration(TestConfigWithAzureResourceManager.class, + TestConfigWithConnectionStringProvider.class, AzureServiceBusAutoConfiguration.class) .withPropertyValues( AZURE_PROPERTY_PREFIX + "resource-group=rg1", SERVICE_BUS_PROPERTY_PREFIX + "namespace=ns1" @@ -112,7 +130,8 @@ public void testMessageConverterProvided() { assertThat(context).hasSingleBean(ServiceBusMessageConverter.class); assertThat(context).hasSingleBean(ServiceBusTopicTemplate.class); - ServiceBusMessageConverter messageConverter = context.getBean(ServiceBusMessageConverter.class); + ServiceBusMessageConverter messageConverter = + context.getBean(ServiceBusMessageConverter.class); ServiceBusTopicTemplate topicTemplate = context.getBean(ServiceBusTopicTemplate.class); assertSame(messageConverter, topicTemplate.getMessageConverter()); }); diff --git a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/ServiceBusUtilsTest.java b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/ServiceBusUtilsTest.java index e5c3697ffd9b..56b9b853a431 100644 --- a/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/ServiceBusUtilsTest.java +++ b/sdk/spring/azure-spring-cloud-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/servicebus/ServiceBusUtilsTest.java @@ -3,8 +3,8 @@ package com.azure.spring.cloud.autoconfigure.servicebus; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class ServiceBusUtilsTest { @@ -12,11 +12,11 @@ public class ServiceBusUtilsTest { public void testGetNamespace() { String connectionString = "Endpoint=sb://namespace.servicebus.windows.net/;" + "SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=key"; - Assert.assertEquals("namespace", ServiceBusUtils.getNamespace(connectionString)); + Assertions.assertEquals("namespace", ServiceBusUtils.getNamespace(connectionString)); } @Test public void testGetNamespaceWithInvalidConnectionString() { - Assert.assertNull(ServiceBusUtils.getNamespace("fake-connection-str")); + Assertions.assertNull(ServiceBusUtils.getNamespace("fake-connection-str")); } } diff --git a/sdk/spring/azure-spring-cloud-context/pom.xml b/sdk/spring/azure-spring-cloud-context/pom.xml index 5d5cddb018f6..9f38eae8b743 100644 --- a/sdk/spring/azure-spring-cloud-context/pom.xml +++ b/sdk/spring/azure-spring-cloud-context/pom.xml @@ -73,24 +73,12 @@ - - org.mockito - mockito-core - 3.9.0 - test - org.springframework.boot spring-boot-starter-test 2.5.0 test - - org.junit.vintage - junit-vintage-engine - 5.7.2 - test - - - junit - junit - 4.13.2 - test - - - - org.mockito - mockito-core - 3.9.0 - test - - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - provided + + + + org.springframework.boot + spring-boot-starter-test + 2.5.0 + test + diff --git a/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AbstractAzureMessagingAnnotationDrivenTests.java b/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AbstractAzureMessagingAnnotationDrivenTests.java index c4bf0a36d6b6..e327dfb7a62a 100644 --- a/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AbstractAzureMessagingAnnotationDrivenTests.java +++ b/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AbstractAzureMessagingAnnotationDrivenTests.java @@ -8,23 +8,20 @@ import com.azure.spring.messaging.endpoint.AzureListenerEndpoint; import com.azure.spring.messaging.endpoint.MethodAzureListenerEndpoint; import com.azure.spring.messaging.endpoint.SimpleAzureListenerEndpoint; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationContext; import org.springframework.messaging.handler.annotation.SendTo; import org.springframework.stereotype.Component; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.springframework.test.util.AssertionErrors.assertNotNull; + /** * @author Warren Zhu */ -public abstract class AbstractAzureMessagingAnnotationDrivenTests { - @Rule - public final ExpectedException thrown = ExpectedException.none(); +public abstract class AbstractAzureMessagingAnnotationDrivenTests { @Test public abstract void sampleConfiguration(); @@ -51,29 +48,28 @@ public abstract class AbstractAzureMessagingAnnotationDrivenTests { public abstract void azureMessageListeners(); /** - * Test for {@link SampleBean} discovery. If a factory with the default name - * is set, an endpoint will use it automatically + * Test for {@link SampleBean} discovery. If a factory with the default name is set, an endpoint will use it + * automatically */ public void testSampleConfiguration(ApplicationContext context) { AzureListenerContainerTestFactory defaultFactory = - context.getBean("azureListenerContainerFactory", AzureListenerContainerTestFactory.class); + context.getBean("azureListenerContainerFactory", AzureListenerContainerTestFactory.class); AzureListenerContainerTestFactory simpleFactory = - context.getBean("simpleFactory", AzureListenerContainerTestFactory.class); + context.getBean("simpleFactory", AzureListenerContainerTestFactory.class); assertEquals(1, defaultFactory.getListenerContainers().size()); assertEquals(1, simpleFactory.getListenerContainers().size()); } /** - * Test for {@link FullBean} discovery. In this case, no default is set because - * all endpoints provide a default registry. This shows that the default factory - * is only retrieved if it needs to be. + * Test for {@link FullBean} discovery. In this case, no default is set because all endpoints provide a default + * registry. This shows that the default factory is only retrieved if it needs to be. */ public void testFullConfiguration(ApplicationContext context) { AzureListenerContainerTestFactory simpleFactory = - context.getBean("simpleFactory", AzureListenerContainerTestFactory.class); + context.getBean("simpleFactory", AzureListenerContainerTestFactory.class); assertEquals(1, simpleFactory.getListenerContainers().size()); MethodAzureListenerEndpoint endpoint = - (MethodAzureListenerEndpoint) simpleFactory.getListenerContainers().get(0).getEndpoint(); + (MethodAzureListenerEndpoint) simpleFactory.getListenerContainers().get(0).getEndpoint(); assertEquals("listener1", endpoint.getId()); assertEquals("queueIn", endpoint.getDestination()); assertEquals("group1", endpoint.getGroup()); @@ -81,71 +77,70 @@ public void testFullConfiguration(ApplicationContext context) { } /** - * Test for {@link CustomBean} and an manually endpoint registered - * with "myCustomEndpointId". The custom endpoint does not provide - * any factory so it's registered with the default one + * Test for {@link CustomBean} and an manually endpoint registered with "myCustomEndpointId". The custom endpoint + * does not provide any factory so it's registered with the default one */ public void testCustomConfiguration(ApplicationContext context) { AzureListenerContainerTestFactory defaultFactory = context.getBean( - AzureListenerAnnotationBeanPostProcessor.DEFAULT_AZURE_LISTENER_CONTAINER_FACTORY_BEAN_NAME, - AzureListenerContainerTestFactory.class); + AzureListenerAnnotationBeanPostProcessor.DEFAULT_AZURE_LISTENER_CONTAINER_FACTORY_BEAN_NAME, + AzureListenerContainerTestFactory.class); AzureListenerContainerTestFactory customFactory = - context.getBean("customFactory", AzureListenerContainerTestFactory.class); + context.getBean("customFactory", AzureListenerContainerTestFactory.class); assertEquals(1, defaultFactory.getListenerContainers().size()); assertEquals(1, customFactory.getListenerContainers().size()); AzureListenerEndpoint endpoint = defaultFactory.getListenerContainers().get(0).getEndpoint(); - assertEquals("Wrong endpoint type", SimpleAzureListenerEndpoint.class, endpoint.getClass()); + assertEquals(SimpleAzureListenerEndpoint.class, endpoint.getClass(), "Wrong endpoint type"); AzureListenerEndpointRegistry customRegistry = - context.getBean("customRegistry", AzureListenerEndpointRegistry.class); - assertEquals("Wrong number of containers in the registry", 2, customRegistry.getListenerContainerIds().size()); - assertEquals("Wrong number of containers in the registry", 2, customRegistry.getListenerContainers().size()); + context.getBean("customRegistry", AzureListenerEndpointRegistry.class); + assertEquals(2, customRegistry.getListenerContainerIds().size(), "Wrong number of containers in the registry"); + assertEquals(2, customRegistry.getListenerContainers().size(), "Wrong number of containers in the registry"); assertNotNull("Container with custom id on the annotation should be found", - customRegistry.getListenerContainer("listenerId")); + customRegistry.getListenerContainer("listenerId")); assertNotNull("Container created with custom id should be found", - customRegistry.getListenerContainer("myCustomEndpointId")); + customRegistry.getListenerContainer("myCustomEndpointId")); } /** - * Test for {@link DefaultBean} that does not define the container - * factory to use as a default is registered with an explicit - * default. + * Test for {@link DefaultBean} that does not define the container factory to use as a default is registered with an + * explicit default. */ public void testExplicitContainerFactoryConfiguration(ApplicationContext context) { AzureListenerContainerTestFactory defaultFactory = - context.getBean("simpleFactory", AzureListenerContainerTestFactory.class); + context.getBean("simpleFactory", AzureListenerContainerTestFactory.class); assertEquals(1, defaultFactory.getListenerContainers().size()); } /** - * Test for {@link DefaultBean} that does not define the container - * factory to use as a default is registered with the default name. + * Test for {@link DefaultBean} that does not define the container factory to use as a default is registered with + * the default name. */ public void testDefaultContainerFactoryConfiguration(ApplicationContext context) { AzureListenerContainerTestFactory defaultFactory = context.getBean( - AzureListenerAnnotationBeanPostProcessor.DEFAULT_AZURE_LISTENER_CONTAINER_FACTORY_BEAN_NAME, - AzureListenerContainerTestFactory.class); + AzureListenerAnnotationBeanPostProcessor.DEFAULT_AZURE_LISTENER_CONTAINER_FACTORY_BEAN_NAME, + AzureListenerContainerTestFactory.class); assertEquals(1, defaultFactory.getListenerContainers().size()); } /** - * Test for {@link AzureListenerRepeatableBean} and {@link AzureListenersBean} that validates that the - * {@code @AzureListener} annotation is repeatable and generate one specific container per annotation. + * Test for {@link AzureListenerRepeatableBean} and {@link AzureListenersBean} that validates that the {@code + * + * @AzureListener} annotation is repeatable and generate one specific container per annotation. */ public void testAzureListenerRepeatable(ApplicationContext context) { AzureListenerContainerTestFactory simpleFactory = context.getBean( - AzureListenerAnnotationBeanPostProcessor.DEFAULT_AZURE_LISTENER_CONTAINER_FACTORY_BEAN_NAME, - AzureListenerContainerTestFactory.class); + AzureListenerAnnotationBeanPostProcessor.DEFAULT_AZURE_LISTENER_CONTAINER_FACTORY_BEAN_NAME, + AzureListenerContainerTestFactory.class); assertEquals(2, simpleFactory.getListenerContainers().size()); MethodAzureListenerEndpoint first = - (MethodAzureListenerEndpoint) simpleFactory.getListenerContainer("first").getEndpoint(); + (MethodAzureListenerEndpoint) simpleFactory.getListenerContainer("first").getEndpoint(); assertEquals("first", first.getId()); assertEquals("myQueue", first.getDestination()); assertEquals(null, first.getConcurrency()); MethodAzureListenerEndpoint second = - (MethodAzureListenerEndpoint) simpleFactory.getListenerContainer("second").getEndpoint(); + (MethodAzureListenerEndpoint) simpleFactory.getListenerContainer("second").getEndpoint(); assertEquals("second", second.getId()); assertEquals("anotherQueue", second.getDestination()); assertEquals("2-10", second.getConcurrency()); @@ -167,7 +162,7 @@ public void simpleHandle(String msg) { static class FullBean { @AzureMessageListener(id = "listener1", containerFactory = "simpleFactory", destination = "queueIn", - group = "group1", concurrency = "1-10") + group = "group1", concurrency = "1-10") @SendTo("queueOut") public String fullHandle(String msg) { return "reply"; @@ -201,8 +196,8 @@ public void repeatableHandle(String msg) { @Component static class AzureListenersBean { - @AzureMessageListeners({@AzureMessageListener(id = "first", destination = "myQueue"), - @AzureMessageListener(id = "second", destination = "anotherQueue", concurrency = "2-10")}) + @AzureMessageListeners({ @AzureMessageListener(id = "first", destination = "myQueue"), + @AzureMessageListener(id = "second", destination = "anotherQueue", concurrency = "2-10") }) public void repeatableHandle(String msg) { } } diff --git a/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AzureListenerAnnotationBeanPostProcessorTests.java b/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AzureListenerAnnotationBeanPostProcessorTests.java index 89208fc9a53f..e4feface80c1 100644 --- a/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AzureListenerAnnotationBeanPostProcessorTests.java +++ b/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AzureListenerAnnotationBeanPostProcessorTests.java @@ -9,9 +9,7 @@ import com.azure.spring.messaging.endpoint.AbstractAzureListenerEndpoint; import com.azure.spring.messaging.endpoint.AzureListenerEndpoint; import com.azure.spring.messaging.endpoint.MethodAzureListenerEndpoint; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -29,55 +27,54 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + /** * @author Warren Zhu */ public class AzureListenerAnnotationBeanPostProcessorTests { - @Rule - public final ExpectedException thrown = ExpectedException.none(); - @Test public void simpleMessageListener() throws Exception { ConfigurableApplicationContext context = - new AnnotationConfigApplicationContext(Config.class, SimpleMessageListenerTestBean.class); + new AnnotationConfigApplicationContext(Config.class, SimpleMessageListenerTestBean.class); AzureListenerContainerTestFactory factory = context.getBean(AzureListenerContainerTestFactory.class); - assertEquals("One container should have been registered", 1, factory.getListenerContainers().size()); + assertEquals(1, factory.getListenerContainers().size(), "One container should have been registered"); MessageListenerTestContainer container = factory.getListenerContainers().get(0); AzureListenerEndpoint endpoint = container.getEndpoint(); - assertEquals("Wrong endpoint type", MethodAzureListenerEndpoint.class, endpoint.getClass()); + assertEquals(MethodAzureListenerEndpoint.class, endpoint.getClass(), "Wrong endpoint type"); MethodAzureListenerEndpoint methodEndpoint = (MethodAzureListenerEndpoint) endpoint; assertEquals(SimpleMessageListenerTestBean.class, methodEndpoint.getBean().getClass()); assertEquals(SimpleMessageListenerTestBean.class.getMethod("handleIt", String.class), - methodEndpoint.getMethod()); + methodEndpoint.getMethod()); MessageListenerContainer listenerContainer = new SimpleMessageListenerContainer(); methodEndpoint.setupListenerContainer(listenerContainer); assertNotNull(listenerContainer.getMessageHandler()); - assertTrue("Should have been started " + container, container.isStarted()); + assertTrue(container.isStarted(), "Should have been started " + container); context.close(); // Close and stop the listeners - assertTrue("Should have been stopped " + container, container.isStopped()); + assertTrue(container.isStopped(), "Should have been stopped " + container); } @Test public void metaAnnotationIsDiscovered() throws Exception { ConfigurableApplicationContext context = - new AnnotationConfigApplicationContext(Config.class, MetaAnnotationTestBean.class); + new AnnotationConfigApplicationContext(Config.class, MetaAnnotationTestBean.class); try { AzureListenerContainerTestFactory factory = context.getBean(AzureListenerContainerTestFactory.class); - assertEquals("one container should have been registered", 1, factory.getListenerContainers().size()); + assertEquals(1, factory.getListenerContainers().size(), "one container should have been registered"); AzureListenerEndpoint endpoint = factory.getListenerContainers().get(0).getEndpoint(); - assertEquals("Wrong endpoint type", MethodAzureListenerEndpoint.class, endpoint.getClass()); + assertEquals(MethodAzureListenerEndpoint.class, endpoint.getClass(), "Wrong endpoint type"); MethodAzureListenerEndpoint methodEndpoint = (MethodAzureListenerEndpoint) endpoint; assertEquals(MetaAnnotationTestBean.class, methodEndpoint.getBean().getClass()); assertEquals(MetaAnnotationTestBean.class.getMethod("handleIt", String.class), methodEndpoint.getMethod()); @@ -90,10 +87,9 @@ public void metaAnnotationIsDiscovered() throws Exception { @Test @SuppressWarnings("resource") public void invalidProxy() { - thrown.expect(BeanCreationException.class); - thrown.expectCause(is(instanceOf(IllegalStateException.class))); - thrown.expectMessage("handleIt2"); - new AnnotationConfigApplicationContext(Config.class, ProxyConfig.class, InvalidProxyTestBean.class); + assertThrows(BeanCreationException.class, + () -> new AnnotationConfigApplicationContext(Config.class, ProxyConfig.class, InvalidProxyTestBean.class), + "handleIt2"); } @AzureMessageListener(destination = "metaTestQueue") diff --git a/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AzureListenerEndpointRegistrarTests.java b/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AzureListenerEndpointRegistrarTests.java index 41914aab8cc8..7be19f67a1fc 100644 --- a/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AzureListenerEndpointRegistrarTests.java +++ b/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AzureListenerEndpointRegistrarTests.java @@ -4,27 +4,24 @@ package com.azure.spring.messaging.config; import com.azure.spring.messaging.endpoint.SimpleAzureListenerEndpoint; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.support.StaticListableBeanFactory; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.springframework.test.util.AssertionErrors.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; /** * @author Warren Zhu */ public class AzureListenerEndpointRegistrarTests { - @Rule - public final ExpectedException thrown = ExpectedException.none(); private final AzureListenerEndpointRegistrar registrar = new AzureListenerEndpointRegistrar(); private final AzureListenerEndpointRegistry registry = new AzureListenerEndpointRegistry(); private final AzureListenerContainerTestFactory containerFactory = new AzureListenerContainerTestFactory(); - @Before + @BeforeEach public void setup() { this.registrar.setEndpointRegistry(this.registry); this.registrar.setBeanFactory(new StaticListableBeanFactory()); @@ -32,14 +29,14 @@ public void setup() { @Test public void registerNullEndpoint() { - this.thrown.expect(IllegalArgumentException.class); - this.registrar.registerEndpoint(null, this.containerFactory); + assertThrows(IllegalArgumentException.class, + () -> this.registrar.registerEndpoint(null, this.containerFactory)); } @Test public void registerNullEndpointId() { - this.thrown.expect(IllegalArgumentException.class); - this.registrar.registerEndpoint(new SimpleAzureListenerEndpoint(), this.containerFactory); + assertThrows(IllegalArgumentException.class, + () -> this.registrar.registerEndpoint(new SimpleAzureListenerEndpoint(), this.containerFactory)); } @Test @@ -47,8 +44,8 @@ public void registerEmptyEndpointId() { SimpleAzureListenerEndpoint endpoint = new SimpleAzureListenerEndpoint(); endpoint.setId(""); - this.thrown.expect(IllegalArgumentException.class); - this.registrar.registerEndpoint(endpoint, this.containerFactory); + assertThrows(IllegalArgumentException.class, + () -> this.registrar.registerEndpoint(endpoint, this.containerFactory)); } @Test @@ -69,9 +66,8 @@ public void registerNullContainerFactoryWithNoDefault() throws Exception { endpoint.setId("some id"); this.registrar.registerEndpoint(endpoint, null); - this.thrown.expect(IllegalStateException.class); - this.thrown.expectMessage(endpoint.toString()); - this.registrar.afterPropertiesSet(); + assertThrows(IllegalStateException.class, + () -> this.registrar.afterPropertiesSet(), endpoint.toString()); } @Test diff --git a/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AzureListenerEndpointRegistryTests.java b/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AzureListenerEndpointRegistryTests.java index 137fbf6f92a9..5c72c5cd503a 100644 --- a/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AzureListenerEndpointRegistryTests.java +++ b/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/AzureListenerEndpointRegistryTests.java @@ -5,44 +5,42 @@ import com.azure.spring.messaging.endpoint.MethodAzureListenerEndpoint; import com.azure.spring.messaging.endpoint.SimpleAzureListenerEndpoint; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertThrows; /** * @author Warren Zhu */ public class AzureListenerEndpointRegistryTests { - @Rule - public final ExpectedException thrown = ExpectedException.none(); private final AzureListenerEndpointRegistry registry = new AzureListenerEndpointRegistry(); private final AzureListenerContainerTestFactory containerFactory = new AzureListenerContainerTestFactory(); @Test public void createWithNullEndpoint() { - thrown.expect(IllegalArgumentException.class); - registry.registerListenerContainer(null, containerFactory); + assertThrows(IllegalArgumentException.class, + () -> registry.registerListenerContainer(null, containerFactory)); } @Test public void createWithNullEndpointId() { - thrown.expect(IllegalArgumentException.class); - registry.registerListenerContainer(new MethodAzureListenerEndpoint(), containerFactory); + assertThrows(IllegalArgumentException.class, + () -> registry.registerListenerContainer(new MethodAzureListenerEndpoint(), containerFactory)); } @Test public void createWithNullContainerFactory() { - thrown.expect(IllegalArgumentException.class); - registry.registerListenerContainer(createEndpoint("foo", "myDestination"), null); + assertThrows(IllegalArgumentException.class, + () -> registry.registerListenerContainer(createEndpoint("foo", "myDestination"), null)); } @Test public void createWithDuplicateEndpointId() { registry.registerListenerContainer(createEndpoint("test", "queue"), containerFactory); - thrown.expect(IllegalStateException.class); - registry.registerListenerContainer(createEndpoint("test", "queue"), containerFactory); + assertThrows(IllegalStateException.class, + () -> registry.registerListenerContainer(createEndpoint("test", "queue"), containerFactory)); } private SimpleAzureListenerEndpoint createEndpoint(String id, String destinationName) { diff --git a/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/EnableAzureMessagingTests.java b/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/EnableAzureMessagingTests.java index efedf66d9c5b..bc1d19353dcd 100644 --- a/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/EnableAzureMessagingTests.java +++ b/sdk/spring/azure-spring-cloud-messaging/src/test/java/com/azure/spring/messaging/config/EnableAzureMessagingTests.java @@ -3,16 +3,14 @@ package com.azure.spring.messaging.config; -import com.azure.spring.messaging.endpoint.MethodAzureListenerEndpoint; -import com.azure.spring.messaging.listener.AzureMessageHandler; -import com.azure.spring.messaging.listener.DefaultAzureMessageHandler; import com.azure.spring.integration.core.api.SubscribeByGroupOperation; import com.azure.spring.messaging.annotation.AzureMessageListener; import com.azure.spring.messaging.annotation.EnableAzureMessaging; +import com.azure.spring.messaging.endpoint.MethodAzureListenerEndpoint; import com.azure.spring.messaging.endpoint.SimpleAzureListenerEndpoint; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import com.azure.spring.messaging.listener.AzureMessageHandler; +import com.azure.spring.messaging.listener.DefaultAzureMessageHandler; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -25,7 +23,11 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; /** @@ -33,14 +35,12 @@ */ public class EnableAzureMessagingTests extends AbstractAzureMessagingAnnotationDrivenTests { - @Rule - public final ExpectedException thrown = ExpectedException.none(); @Override @Test public void sampleConfiguration() { ConfigurableApplicationContext context = - new AnnotationConfigApplicationContext(EnableAzureMessagingSampleConfig.class, SampleBean.class); + new AnnotationConfigApplicationContext(EnableAzureMessagingSampleConfig.class, SampleBean.class); testSampleConfiguration(context); } @@ -48,7 +48,7 @@ public void sampleConfiguration() { @Test public void fullConfiguration() { ConfigurableApplicationContext context = - new AnnotationConfigApplicationContext(EnableAzureMessagingFullConfig.class, FullBean.class); + new AnnotationConfigApplicationContext(EnableAzureMessagingFullConfig.class, FullBean.class); testFullConfiguration(context); } @@ -61,7 +61,7 @@ public void fullConfigurableConfiguration() { @Test public void customConfiguration() { ConfigurableApplicationContext context = - new AnnotationConfigApplicationContext(EnableAzureMessagingCustomConfig.class, CustomBean.class); + new AnnotationConfigApplicationContext(EnableAzureMessagingCustomConfig.class, CustomBean.class); testCustomConfiguration(context); } @@ -69,8 +69,8 @@ public void customConfiguration() { @Test public void explicitContainerFactory() { ConfigurableApplicationContext context = - new AnnotationConfigApplicationContext(EnableAzureMessagingCustomContainerFactoryConfig.class, - DefaultBean.class); + new AnnotationConfigApplicationContext(EnableAzureMessagingCustomContainerFactoryConfig.class, + DefaultBean.class); testExplicitContainerFactoryConfiguration(context); } @@ -78,16 +78,16 @@ public void explicitContainerFactory() { @Test public void defaultContainerFactory() { ConfigurableApplicationContext context = - new AnnotationConfigApplicationContext(EnableAzureMessagingDefaultContainerFactoryConfig.class, - DefaultBean.class); + new AnnotationConfigApplicationContext(EnableAzureMessagingDefaultContainerFactoryConfig.class, + DefaultBean.class); testDefaultContainerFactoryConfiguration(context); } @Test public void containerAreStartedByDefault() { ConfigurableApplicationContext context = - new AnnotationConfigApplicationContext(EnableAzureMessagingDefaultContainerFactoryConfig.class, - DefaultBean.class); + new AnnotationConfigApplicationContext(EnableAzureMessagingDefaultContainerFactoryConfig.class, + DefaultBean.class); AzureListenerContainerTestFactory factory = context.getBean(AzureListenerContainerTestFactory.class); MessageListenerTestContainer container = factory.getListenerContainers().get(0); assertTrue(container.isAutoStartup()); @@ -97,8 +97,8 @@ public void containerAreStartedByDefault() { @Test public void containerCanBeStarterViaTheRegistry() { ConfigurableApplicationContext context = - new AnnotationConfigApplicationContext(EnableAzureMessagingAutoStartupFalseConfig.class, - DefaultBean.class); + new AnnotationConfigApplicationContext(EnableAzureMessagingAutoStartupFalseConfig.class, + DefaultBean.class); AzureListenerContainerTestFactory factory = context.getBean(AzureListenerContainerTestFactory.class); MessageListenerTestContainer container = factory.getListenerContainers().get(0); assertFalse(container.isAutoStartup()); @@ -112,8 +112,8 @@ public void containerCanBeStarterViaTheRegistry() { @Test public void azureMessageListenerIsRepeatable() { ConfigurableApplicationContext context = - new AnnotationConfigApplicationContext(EnableAzureMessagingDefaultContainerFactoryConfig.class, - AzureListenerRepeatableBean.class); + new AnnotationConfigApplicationContext(EnableAzureMessagingDefaultContainerFactoryConfig.class, + AzureListenerRepeatableBean.class); testAzureListenerRepeatable(context); } @@ -121,28 +121,28 @@ public void azureMessageListenerIsRepeatable() { @Test public void azureMessageListeners() { ConfigurableApplicationContext context = - new AnnotationConfigApplicationContext(EnableAzureMessagingDefaultContainerFactoryConfig.class, - AzureListenersBean.class); + new AnnotationConfigApplicationContext(EnableAzureMessagingDefaultContainerFactoryConfig.class, + AzureListenersBean.class); testAzureListenerRepeatable(context); } @Test public void composedAzureMessageListeners() { try (ConfigurableApplicationContext context = new AnnotationConfigApplicationContext( - EnableAzureMessagingDefaultContainerFactoryConfig.class, ComposedAzureMessageListenersBean.class)) { + EnableAzureMessagingDefaultContainerFactoryConfig.class, ComposedAzureMessageListenersBean.class)) { AzureListenerContainerTestFactory simpleFactory = context.getBean( - AzureListenerAnnotationBeanPostProcessor.DEFAULT_AZURE_LISTENER_CONTAINER_FACTORY_BEAN_NAME, - AzureListenerContainerTestFactory.class); + AzureListenerAnnotationBeanPostProcessor.DEFAULT_AZURE_LISTENER_CONTAINER_FACTORY_BEAN_NAME, + AzureListenerContainerTestFactory.class); assertEquals(2, simpleFactory.getListenerContainers().size()); MethodAzureListenerEndpoint first = - (MethodAzureListenerEndpoint) simpleFactory.getListenerContainer("first").getEndpoint(); + (MethodAzureListenerEndpoint) simpleFactory.getListenerContainer("first").getEndpoint(); assertEquals("first", first.getId()); assertEquals("orderQueue", first.getDestination()); assertNull(first.getConcurrency()); MethodAzureListenerEndpoint second = - (MethodAzureListenerEndpoint) simpleFactory.getListenerContainer("second").getEndpoint(); + (MethodAzureListenerEndpoint) simpleFactory.getListenerContainer("second").getEndpoint(); assertEquals("second", second.getId()); assertEquals("billingQueue", second.getDestination()); assertEquals("2-10", second.getConcurrency()); @@ -152,27 +152,27 @@ public void composedAzureMessageListeners() { @Test @SuppressWarnings("resource") public void unknownFactory() { - thrown.expect(BeanCreationException.class); - thrown.expectMessage("customFactory"); // not found - new AnnotationConfigApplicationContext(EnableAzureMessagingSampleConfig.class, CustomBean.class); + assertThrows(BeanCreationException.class, + () -> new AnnotationConfigApplicationContext(EnableAzureMessagingSampleConfig.class, CustomBean.class), + "customFactory"); } @Test public void lazyComponent() { ConfigurableApplicationContext context = - new AnnotationConfigApplicationContext(EnableAzureMessagingDefaultContainerFactoryConfig.class, - LazyBean.class); + new AnnotationConfigApplicationContext(EnableAzureMessagingDefaultContainerFactoryConfig.class, + LazyBean.class); AzureListenerContainerTestFactory defaultFactory = context.getBean( - AzureListenerAnnotationBeanPostProcessor.DEFAULT_AZURE_LISTENER_CONTAINER_FACTORY_BEAN_NAME, - AzureListenerContainerTestFactory.class); + AzureListenerAnnotationBeanPostProcessor.DEFAULT_AZURE_LISTENER_CONTAINER_FACTORY_BEAN_NAME, + AzureListenerContainerTestFactory.class); assertEquals(0, defaultFactory.getListenerContainers().size()); context.getBean(LazyBean.class); // trigger lazy resolution assertEquals(1, defaultFactory.getListenerContainers().size()); MessageListenerTestContainer container = defaultFactory.getListenerContainers().get(0); - assertTrue("Should have been started " + container, container.isStarted()); + assertTrue(container.isStarted(), "Should have been started " + container); context.close(); // close and stop the listeners - assertTrue("Should have been stopped " + container, container.isStopped()); + assertTrue(container.isStopped(), "Should have been stopped " + container); } @AzureMessageListener(destination = "orderQueue") diff --git a/sdk/spring/azure-spring-cloud-starter-eventhubs/pom.xml b/sdk/spring/azure-spring-cloud-starter-eventhubs/pom.xml index b2f25f31be14..087f4256647e 100644 --- a/sdk/spring/azure-spring-cloud-starter-eventhubs/pom.xml +++ b/sdk/spring/azure-spring-cloud-starter-eventhubs/pom.xml @@ -31,7 +31,6 @@ azure-spring-cloud-messaging 2.6.0-beta.1 - diff --git a/sdk/spring/azure-spring-cloud-storage/pom.xml b/sdk/spring/azure-spring-cloud-storage/pom.xml index b4cce90e88f8..11916e74c15a 100644 --- a/sdk/spring/azure-spring-cloud-storage/pom.xml +++ b/sdk/spring/azure-spring-cloud-storage/pom.xml @@ -75,34 +75,6 @@ test - - org.junit.vintage - junit-vintage-engine - 5.7.2 - test - - - - org.mockito - mockito-core - 3.9.0 - test - - - - org.powermock - powermock-api-mockito2 - 2.0.2 - test - - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - - diff --git a/sdk/spring/azure-spring-cloud-storage/src/test/java/com/azure/spring/cloud/autoconfigure/storage/AzureStorageQueueAutoConfigurationTest.java b/sdk/spring/azure-spring-cloud-storage/src/test/java/com/azure/spring/cloud/autoconfigure/storage/AzureStorageQueueAutoConfigurationTest.java index 14a25e5498c9..df9bd4dd335e 100644 --- a/sdk/spring/azure-spring-cloud-storage/src/test/java/com/azure/spring/cloud/autoconfigure/storage/AzureStorageQueueAutoConfigurationTest.java +++ b/sdk/spring/azure-spring-cloud-storage/src/test/java/com/azure/spring/cloud/autoconfigure/storage/AzureStorageQueueAutoConfigurationTest.java @@ -5,7 +5,7 @@ import com.azure.spring.integration.storage.queue.factory.DefaultStorageQueueClientFactory; import com.azure.storage.queue.QueueServiceClient; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -14,6 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; +import static org.junit.jupiter.api.Assertions.assertThrows; public class AzureStorageQueueAutoConfigurationTest { @@ -25,19 +26,20 @@ public class AzureStorageQueueAutoConfigurationTest { @Test public void testAzureStorageDisabled() { this.contextRunner.withPropertyValues("spring.cloud.azure.storage.queue.enabled=false") - .run(context -> assertThat(context).doesNotHaveBean(AzureStorageProperties.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureStorageProperties.class)); } @Test public void testWithoutCloudQueueClient() { this.contextRunner.withClassLoader(new FilteredClassLoader(QueueServiceClient.class)) - .run(context -> assertThat(context).doesNotHaveBean(AzureStorageProperties.class)); + .run(context -> assertThat(context).doesNotHaveBean(AzureStorageProperties.class)); } - @Test(expected = IllegalStateException.class) + @Test public void testAzureStoragePropertiesIllegal() { this.contextRunner.withPropertyValues("spring.cloud.azure.storage.account=a") - .run(context -> context.getBean(AzureStorageProperties.class)); + .run(context -> assertThrows(IllegalStateException.class, + () -> context.getBean(AzureStorageProperties.class))); } @Test diff --git a/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/src/test/java/com/azure/spring/eventhub/stream/binder/EventHubBinderHealthIndicatorTest.java b/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/src/test/java/com/azure/spring/eventhub/stream/binder/EventHubBinderHealthIndicatorTest.java index 153c99b1ff7a..08569fa91125 100644 --- a/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/src/test/java/com/azure/spring/eventhub/stream/binder/EventHubBinderHealthIndicatorTest.java +++ b/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/src/test/java/com/azure/spring/eventhub/stream/binder/EventHubBinderHealthIndicatorTest.java @@ -6,8 +6,9 @@ import com.azure.messaging.eventhubs.EventHubProducerAsyncClient; import com.azure.messaging.eventhubs.EventHubProperties; import com.azure.spring.integration.eventhub.api.EventHubClientFactory; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.boot.actuate.health.Health; @@ -35,7 +36,7 @@ public class EventHubBinderHealthIndicatorTest { private EventHubHealthIndicator healthIndicator; - @Before + @BeforeEach public void init() { MockitoAnnotations.openMocks(this); when(clientFactory.getOrCreateProducerClient(anyString())).thenReturn(producerAsyncClient); @@ -75,7 +76,8 @@ public void testEventHubIsDown() { assertThat(health.getStatus()).isEqualTo(Status.DOWN); } - @Test(timeout = 5000) + @Test + @Timeout(5) public void testGetEventHubInfoTimeout() { healthIndicator.setTimeout(1); diff --git a/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/src/test/java/com/azure/spring/eventhub/stream/binder/EventHubMessageChannelBinderTest.java b/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/src/test/java/com/azure/spring/eventhub/stream/binder/EventHubMessageChannelBinderTest.java index 871dc2008d5e..2e1264d854b2 100644 --- a/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/src/test/java/com/azure/spring/eventhub/stream/binder/EventHubMessageChannelBinderTest.java +++ b/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/src/test/java/com/azure/spring/eventhub/stream/binder/EventHubMessageChannelBinderTest.java @@ -10,8 +10,8 @@ import com.azure.spring.integration.eventhub.api.EventHubClientFactory; import com.azure.spring.integration.eventhub.support.EventHubTestOperation; import org.assertj.core.api.Assertions; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.springframework.cloud.stream.binder.ExtendedProducerProperties; import org.springframework.cloud.stream.provisioning.ProducerDestination; @@ -42,7 +42,7 @@ public class EventHubMessageChannelBinderTest { private static final String PARTITION_HEADER = "headers['scst_partition']"; - @Before + @BeforeEach public void setUp() { this.binder = new EventHubTestBinder(new EventHubTestOperation(clientFactory, () -> eventContext)); this.producerProperties = new ExtendedProducerProperties<>(new EventHubProducerProperties()); diff --git a/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/src/test/java/com/azure/spring/eventhub/stream/binder/EventHubPartitionBinderTests.java b/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/src/test/java/com/azure/spring/eventhub/stream/binder/EventHubPartitionBinderTests.java index e236156dc708..bd78d49b63bd 100644 --- a/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/src/test/java/com/azure/spring/eventhub/stream/binder/EventHubPartitionBinderTests.java +++ b/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/src/test/java/com/azure/spring/eventhub/stream/binder/EventHubPartitionBinderTests.java @@ -3,20 +3,17 @@ package com.azure.spring.eventhub.stream.binder; -import com.azure.spring.eventhub.stream.binder.properties.EventHubProducerProperties; import com.azure.messaging.eventhubs.models.EventContext; import com.azure.messaging.eventhubs.models.PartitionContext; import com.azure.spring.eventhub.stream.binder.properties.EventHubConsumerProperties; -import com.azure.spring.servicebus.stream.binder.test.AzurePartitionBinderTests; +import com.azure.spring.eventhub.stream.binder.properties.EventHubProducerProperties; import com.azure.spring.integration.core.api.StartPosition; import com.azure.spring.integration.eventhub.api.EventHubClientFactory; import com.azure.spring.integration.eventhub.support.EventHubTestOperation; +import com.azure.spring.servicebus.stream.binder.test.AzurePartitionBinderTests; import org.junit.Before; -import org.junit.runner.RunWith; import org.mockito.Mock; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; +import org.mockito.MockitoAnnotations; import org.springframework.cloud.stream.binder.ExtendedConsumerProperties; import org.springframework.cloud.stream.binder.ExtendedProducerProperties; import org.springframework.cloud.stream.binder.HeaderMode; @@ -29,12 +26,10 @@ * * @author Warren Zhu */ -@RunWith(PowerMockRunner.class) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) -@PrepareForTest(EventContext.class) public class EventHubPartitionBinderTests extends - AzurePartitionBinderTests, - ExtendedProducerProperties> { + AzurePartitionBinderTests, + ExtendedProducerProperties> { + //TODO (Xiaobing Zhu): It is currently impossible to upgrade JUnit 4 to JUnit 5 due to the inheritance of Spring unit tests. @Mock EventHubClientFactory clientFactory; @@ -45,11 +40,11 @@ public class EventHubPartitionBinderTests extends @Mock PartitionContext partitionContext; - private EventHubTestBinder binder; @Before public void setUp() { + MockitoAnnotations.openMocks(this); when(this.eventContext.updateCheckpointAsync()).thenReturn(Mono.empty()); when(this.eventContext.getPartitionContext()).thenReturn(this.partitionContext); when(this.partitionContext.getPartitionId()).thenReturn("1"); @@ -70,7 +65,7 @@ protected EventHubTestBinder getBinder() throws Exception { @Override protected ExtendedConsumerProperties createConsumerProperties() { ExtendedConsumerProperties properties = - new ExtendedConsumerProperties<>(new EventHubConsumerProperties()); + new ExtendedConsumerProperties<>(new EventHubConsumerProperties()); properties.setHeaderMode(HeaderMode.embeddedHeaders); properties.getExtension().setStartPosition(StartPosition.EARLIEST); return properties; @@ -79,7 +74,7 @@ protected ExtendedConsumerProperties createConsumerP @Override protected ExtendedProducerProperties createProducerProperties() { ExtendedProducerProperties properties = - new ExtendedProducerProperties<>(new EventHubProducerProperties()); + new ExtendedProducerProperties<>(new EventHubProducerProperties()); properties.setHeaderMode(HeaderMode.embeddedHeaders); return properties; } diff --git a/sdk/spring/azure-spring-cloud-stream-binder-servicebus-queue/src/test/java/com/azure/spring/servicebus/stream/binder/ServiceBusQueuePartitionBinderTests.java b/sdk/spring/azure-spring-cloud-stream-binder-servicebus-queue/src/test/java/com/azure/spring/servicebus/stream/binder/ServiceBusQueuePartitionBinderTests.java index 4baedd201f3e..3c99e26dece5 100644 --- a/sdk/spring/azure-spring-cloud-stream-binder-servicebus-queue/src/test/java/com/azure/spring/servicebus/stream/binder/ServiceBusQueuePartitionBinderTests.java +++ b/sdk/spring/azure-spring-cloud-stream-binder-servicebus-queue/src/test/java/com/azure/spring/servicebus/stream/binder/ServiceBusQueuePartitionBinderTests.java @@ -26,6 +26,7 @@ public class ServiceBusQueuePartitionBinderTests extends AzurePartitionBinderTests, ExtendedProducerProperties> { + //TODO (Xiaobing Zhu): It is currently impossible to upgrade JUnit 4 to JUnit 5 due to the inheritance of Spring unit tests. @Mock ServiceBusQueueClientFactory clientFactory; diff --git a/sdk/spring/azure-spring-cloud-stream-binder-servicebus-topic/src/test/java/com/azure/spring/servicebus/stream/binder/ServiceBusTopicPartitionBinderTests.java b/sdk/spring/azure-spring-cloud-stream-binder-servicebus-topic/src/test/java/com/azure/spring/servicebus/stream/binder/ServiceBusTopicPartitionBinderTests.java index 1afbb985fa16..1de3436d94e0 100644 --- a/sdk/spring/azure-spring-cloud-stream-binder-servicebus-topic/src/test/java/com/azure/spring/servicebus/stream/binder/ServiceBusTopicPartitionBinderTests.java +++ b/sdk/spring/azure-spring-cloud-stream-binder-servicebus-topic/src/test/java/com/azure/spring/servicebus/stream/binder/ServiceBusTopicPartitionBinderTests.java @@ -27,6 +27,8 @@ public class ServiceBusTopicPartitionBinderTests ExtendedConsumerProperties, ExtendedProducerProperties> { + //TODO (Xiaobing Zhu): It is currently impossible to upgrade JUnit 4 to JUnit 5 due to the inheritance of Spring unit tests. + @Mock ServiceBusTopicClientFactory clientFactory; diff --git a/sdk/spring/azure-spring-cloud-telemetry/pom.xml b/sdk/spring/azure-spring-cloud-telemetry/pom.xml index b7f361d4e66e..8d1054c6601d 100644 --- a/sdk/spring/azure-spring-cloud-telemetry/pom.xml +++ b/sdk/spring/azure-spring-cloud-telemetry/pom.xml @@ -60,12 +60,6 @@ 2.5.0 test - - org.junit.vintage - junit-vintage-engine - 5.7.2 - test - diff --git a/sdk/spring/azure-spring-cloud-telemetry/src/test/java/com/azure/spring/cloud/autoconfigure/telemetry/TelemetryAutoConfigurationTest.java b/sdk/spring/azure-spring-cloud-telemetry/src/test/java/com/azure/spring/cloud/autoconfigure/telemetry/TelemetryAutoConfigurationTest.java index 575aa35a5ccb..a0a5f6a3ce05 100644 --- a/sdk/spring/azure-spring-cloud-telemetry/src/test/java/com/azure/spring/cloud/autoconfigure/telemetry/TelemetryAutoConfigurationTest.java +++ b/sdk/spring/azure-spring-cloud-telemetry/src/test/java/com/azure/spring/cloud/autoconfigure/telemetry/TelemetryAutoConfigurationTest.java @@ -7,7 +7,7 @@ import com.azure.spring.cloud.telemetry.TelemetryProperties; import com.azure.spring.cloud.telemetry.TelemetrySender; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; diff --git a/sdk/spring/azure-spring-cloud-test-eventhubs/pom.xml b/sdk/spring/azure-spring-cloud-test-eventhubs/pom.xml index c7474240c24b..ffefb6c5b99c 100644 --- a/sdk/spring/azure-spring-cloud-test-eventhubs/pom.xml +++ b/sdk/spring/azure-spring-cloud-test-eventhubs/pom.xml @@ -42,12 +42,6 @@ org.springframework.boot spring-boot-starter-actuator - - junit - junit - 4.13.2 - test - com.google.code.gson gson @@ -58,18 +52,6 @@ azure-spring-cloud-stream-binder-test 2.6.0-beta.1 - - org.junit.jupiter - junit-jupiter-engine - 5.7.2 - test - - - org.junit.vintage - junit-vintage-engine - 5.7.2 - test - diff --git a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/DefaultEventHubClientFactoryTest.java b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/DefaultEventHubClientFactoryTest.java index 1eaad2325405..247acda80ea7 100644 --- a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/DefaultEventHubClientFactoryTest.java +++ b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/DefaultEventHubClientFactoryTest.java @@ -22,15 +22,21 @@ import java.util.Optional; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.times; import static org.mockito.Mockito.when; import static org.powermock.api.mockito.PowerMockito.*; @RunWith(PowerMockRunner.class) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) -@PrepareForTest({DefaultEventHubClientFactory.class}) +@PowerMockIgnore({ "com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*" }) +@PrepareForTest({ DefaultEventHubClientFactory.class }) public class DefaultEventHubClientFactoryTest { + //TODO (Xiaobing Zhu): Due to Powermock, it is currently impossible to upgrade JUnit 4 to JUnit 5. @Mock EventHubConsumerAsyncClient eventHubConsumerClient; @@ -134,8 +140,8 @@ public void testGetOrCreateEventProcessorClient() throws Exception { assertNotNull(client); clientFactory.createEventProcessorClient(eventHubName, consumerGroup, eventHubProcessor); - verifyPrivate(clientFactory).invoke("createEventProcessorClientInternal", eventHubName, consumerGroup, - eventHubProcessor); + verifyPrivate(clientFactory, times(1)) + .invoke("createEventProcessorClientInternal", eventHubName, consumerGroup, eventHubProcessor); } @Test diff --git a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubOperationSendSubscribeTest.java b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubOperationSendSubscribeTest.java index 51abd0205821..63ef08c7107a 100644 --- a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubOperationSendSubscribeTest.java +++ b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubOperationSendSubscribeTest.java @@ -14,18 +14,21 @@ import com.azure.spring.integration.eventhub.support.EventHubTestOperation; import com.azure.spring.integration.test.support.pojo.User; import com.azure.spring.integration.test.support.reactor.SendSubscribeByGroupOperationTest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.messaging.Message; import reactor.core.publisher.Mono; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) public class EventHubOperationSendSubscribeTest extends SendSubscribeByGroupOperationTest { @Mock @@ -34,9 +37,12 @@ public class EventHubOperationSendSubscribeTest extends SendSubscribeByGroupOper @Mock PartitionContext partitionContext; - @Before + private AutoCloseable closeable; + + @BeforeEach @Override public void setUp() { + this.closeable = MockitoAnnotations.openMocks(this); when(this.eventContext.updateCheckpointAsync()).thenReturn(Mono.empty()); when(this.eventContext.getPartitionContext()).thenReturn(this.partitionContext); when(this.partitionContext.getPartitionId()).thenReturn(this.partitionId); @@ -44,6 +50,11 @@ public void setUp() { this.sendSubscribeOperation = new EventHubTestOperation(null, () -> eventContext); } + @AfterEach + public void close() throws Exception { + closeable.close(); + } + @Override protected void verifyCheckpointSuccessCalled(int times) { verify(this.eventContext, times(times)).updateCheckpointAsync(); diff --git a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubRxOperationSendSubscribeTest.java b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubRxOperationSendSubscribeTest.java index ab459e220d92..460944c36139 100644 --- a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubRxOperationSendSubscribeTest.java +++ b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubRxOperationSendSubscribeTest.java @@ -12,18 +12,19 @@ import com.azure.spring.integration.eventhub.support.RxEventHubTestOperation; import com.azure.spring.integration.test.support.pojo.User; import com.azure.spring.integration.test.support.rx.RxSendSubscribeByGroupOperationTest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import reactor.core.publisher.Mono; import java.util.Arrays; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) public class EventHubRxOperationSendSubscribeTest extends RxSendSubscribeByGroupOperationTest { @Mock @@ -32,9 +33,12 @@ public class EventHubRxOperationSendSubscribeTest extends RxSendSubscribeByGroup @Mock PartitionContext partitionContext; - @Before + private AutoCloseable closeable; + + @BeforeEach @Override public void setUp() { + this.closeable = MockitoAnnotations.openMocks(this); when(this.eventContext.updateCheckpointAsync()).thenReturn(Mono.empty()); when(this.eventContext.getPartitionContext()).thenReturn(this.partitionContext); when(this.partitionContext.getPartitionId()).thenReturn(this.partitionId); @@ -42,6 +46,11 @@ public void setUp() { this.sendSubscribeOperation = new RxEventHubTestOperation(null, () -> eventContext); } + @AfterEach + public void close() throws Exception { + closeable.close(); + } + @Override protected void verifyCheckpointSuccessCalled(int times) { verify(this.eventContext, times(times)).updateCheckpointAsync(); diff --git a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubTemplateSendTest.java b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubTemplateSendTest.java index 257f674c97c5..7296c4e4bc5d 100644 --- a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubTemplateSendTest.java +++ b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubTemplateSendTest.java @@ -12,28 +12,33 @@ import com.azure.spring.integration.eventhub.impl.EventHubRuntimeException; import com.azure.spring.integration.eventhub.impl.EventHubTemplate; import com.azure.spring.integration.test.support.reactor.SendOperationTest; -import org.junit.Before; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import reactor.core.publisher.Mono; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + -@RunWith(MockitoJUnitRunner.class) public class EventHubTemplateSendTest extends SendOperationTest { @Mock EventDataBatch eventDataBatch; @Mock - private EventHubClientFactory mockClientFactory; + EventHubClientFactory mockClientFactory; @Mock - private EventHubProducerAsyncClient mockProducerClient; + EventHubProducerAsyncClient mockProducerClient; + + private AutoCloseable closeable; - @Before + @BeforeEach public void setUp() { + this.closeable = MockitoAnnotations.openMocks(this); when(this.mockClientFactory.getOrCreateProducerClient(eq(this.destination))) .thenReturn(this.mockProducerClient); when(this.mockProducerClient.createBatch(any(CreateBatchOptions.class))) @@ -44,6 +49,11 @@ public void setUp() { this.sendOperation = new EventHubTemplate(mockClientFactory); } + @AfterEach + public void close() throws Exception { + closeable.close(); + } + @Override protected void verifySendCalled(int times) { verify(this.mockProducerClient, times(times)).send(any(EventDataBatch.class)); diff --git a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubTemplateSubscribeTest.java b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubTemplateSubscribeTest.java index abc4c696be69..4e5bf48a71e6 100644 --- a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubTemplateSubscribeTest.java +++ b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/EventHubTemplateSubscribeTest.java @@ -9,18 +9,22 @@ import com.azure.spring.integration.eventhub.impl.EventHubProcessor; import com.azure.spring.integration.eventhub.impl.EventHubTemplate; import com.azure.spring.integration.test.support.SubscribeByGroupOperationTest; -import org.junit.Before; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import java.util.Optional; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.isA; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) public class EventHubTemplateSubscribeTest extends SubscribeByGroupOperationTest { @Mock @@ -29,8 +33,11 @@ public class EventHubTemplateSubscribeTest extends SubscribeByGroupOperationTest @Mock private EventProcessorClient eventProcessorClient; - @Before + private AutoCloseable closeable; + + @BeforeEach public void setUp() { + this.closeable = MockitoAnnotations.openMocks(this); this.subscribeByGroupOperation = new EventHubTemplate(mockClientFactory); when(this.mockClientFactory.createEventProcessorClient(anyString(), anyString(), isA(EventHubProcessor.class))) .thenReturn(this.eventProcessorClient); @@ -40,6 +47,11 @@ public void setUp() { doNothing().when(this.eventProcessorClient).start(); } + @AfterEach + public void close() throws Exception { + closeable.close(); + } + @Override protected void verifySubscriberCreatorCalled() { verify(this.mockClientFactory, atLeastOnce()).createEventProcessorClient(anyString(), anyString(), diff --git a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/converter/EventHubMessageConverterTest.java b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/converter/EventHubMessageConverterTest.java index 25d559f07fc7..aecbecba6b5a 100644 --- a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/converter/EventHubMessageConverterTest.java +++ b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/converter/EventHubMessageConverterTest.java @@ -7,7 +7,7 @@ import com.azure.spring.integration.core.EventHubHeaders; import com.azure.spring.integration.core.converter.AzureMessageConverter; import com.azure.spring.integration.test.support.UnaryAzureMessageConverterTest; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.messaging.Message; import org.springframework.messaging.MessageHeaders; import org.springframework.util.LinkedMultiValueMap; @@ -18,9 +18,9 @@ import java.util.HashMap; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.springframework.messaging.support.NativeMessageHeaderAccessor.NATIVE_HEADERS; public class EventHubMessageConverterTest extends UnaryAzureMessageConverterTest { diff --git a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/inbound/EventHubInboundAdapterTest.java b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/inbound/EventHubInboundAdapterTest.java index 10e76dedbc4e..c5904098a9a1 100644 --- a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/inbound/EventHubInboundAdapterTest.java +++ b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/inbound/EventHubInboundAdapterTest.java @@ -7,11 +7,11 @@ import com.azure.messaging.eventhubs.models.EventContext; import com.azure.spring.integration.eventhub.support.EventHubTestOperation; import com.azure.spring.integration.test.support.InboundChannelAdapterTest; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; -@RunWith(MockitoJUnitRunner.class) public class EventHubInboundAdapterTest extends InboundChannelAdapterTest { @Mock @@ -20,10 +20,19 @@ public class EventHubInboundAdapterTest extends InboundChannelAdapterTest partitionContext), - consumerGroup); + () -> partitionContext), + consumerGroup); + } + + @AfterEach + public void close() throws Exception { + closeable.close(); } } diff --git a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/outbound/EventHubMessageHandlerTest.java b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/outbound/EventHubMessageHandlerTest.java index 4995cc63dbef..a461f3f1a5a1 100644 --- a/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/outbound/EventHubMessageHandlerTest.java +++ b/sdk/spring/azure-spring-integration-eventhubs/src/test/java/com/azure/spring/integration/eventhub/outbound/EventHubMessageHandlerTest.java @@ -9,11 +9,11 @@ import com.azure.spring.integration.eventhub.api.EventHubOperation; import com.azure.spring.integration.test.support.reactor.MessageHandlerTest; import com.google.common.collect.ImmutableMap; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.expression.Expression; import org.springframework.expression.ExpressionParser; @@ -31,7 +31,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) public class EventHubMessageHandlerTest extends MessageHandlerTest { private static final ExpressionParser EXPRESSION_PARSER = new SpelExpressionParser(); @@ -42,11 +41,13 @@ public class EventHubMessageHandlerTest extends MessageHandlerTest { - @Before + + private AutoCloseable closeable; + + + @BeforeEach @Override @SuppressWarnings("unchecked") public void setUp() { + this.closeable = MockitoAnnotations.openMocks(this); this.future.complete(null); this.sendOperation = mock(ServiceBusQueueOperation.class); when(this.sendOperation.sendAsync(eq(this.destination), isA(Message.class), @@ -33,4 +37,10 @@ public void setUp() { .thenReturn(future); this.handler = new DefaultMessageHandler(this.destination, this.sendOperation); } + + @AfterEach + public void close() throws Exception { + closeable.close(); + } + } diff --git a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/ServiceBusTemplateSendTest.java b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/ServiceBusTemplateSendTest.java index 34ac0968d612..80c865ddb522 100644 --- a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/ServiceBusTemplateSendTest.java +++ b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/ServiceBusTemplateSendTest.java @@ -8,7 +8,7 @@ import com.azure.spring.integration.core.api.SendOperation; import com.azure.spring.integration.servicebus.factory.ServiceBusSenderFactory; import com.azure.spring.integration.test.support.SendOperationTest; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import reactor.core.publisher.Mono; import static org.mockito.ArgumentMatchers.anyString; @@ -30,7 +30,7 @@ public abstract class ServiceBusTemplateSendTest this.messageConverter.toMessage(this.receivedMessage, byte[].class)); } @Test @@ -168,8 +176,8 @@ public void testConvertSpringNativeMessageHeaders() { @Test public void testAzureMessageHeader() { Message springMessage = MessageBuilder.withPayload(PAYLOAD) - .setHeader(AzureHeaders.RAW_ID, AZURE_MESSAGE_RAW_ID) - .build(); + .setHeader(AzureHeaders.RAW_ID, AZURE_MESSAGE_RAW_ID) + .build(); ServiceBusMessage serviceBusMessage = this.messageConverter.fromMessage(springMessage, ServiceBusMessage.class); @@ -188,21 +196,22 @@ public void testAzureMessageHeader() { public void testServiceBusMessageHeadersSet() { Instant scheduledEnqueueInstant = Instant.now().plusSeconds(5); final OffsetDateTime scheduledEnqueueOffsetDateTime = OffsetDateTime - .ofInstant(scheduledEnqueueInstant, systemDefault()) - .toInstant() - .atOffset(ZoneOffset.UTC); + .ofInstant(scheduledEnqueueInstant, systemDefault()) + .toInstant() + .atOffset(ZoneOffset.UTC); Message springMessage = MessageBuilder.withPayload(PAYLOAD) - .setHeader(AzureHeaders.RAW_ID, AZURE_MESSAGE_RAW_ID) - .setHeader(MESSAGE_ID, SERVICE_BUS_MESSAGE_ID) - .setHeader(TIME_TO_LIVE, SERVICE_BUS_TTL) - .setHeader(SCHEDULED_ENQUEUE_TIME, scheduledEnqueueInstant) - .setHeader(SESSION_ID, SERVICE_BUS_SESSION_ID) - .setHeader(CORRELATION_ID, SERVICE_BUS_CORRELATION_ID) - .setHeader(TO, SERVICE_BUS_TO) - .setHeader(REPLY_TO_SESSION_ID, SERVICE_BUS_REPLY_TO_SESSION_ID) - .setHeader(PARTITION_KEY, SERVICE_BUS_SESSION_ID) // when session id set, the partition key equals to session id - .build(); + .setHeader(AzureHeaders.RAW_ID, AZURE_MESSAGE_RAW_ID) + .setHeader(MESSAGE_ID, SERVICE_BUS_MESSAGE_ID) + .setHeader(TIME_TO_LIVE, SERVICE_BUS_TTL) + .setHeader(SCHEDULED_ENQUEUE_TIME, scheduledEnqueueInstant) + .setHeader(SESSION_ID, SERVICE_BUS_SESSION_ID) + .setHeader(CORRELATION_ID, SERVICE_BUS_CORRELATION_ID) + .setHeader(TO, SERVICE_BUS_TO) + .setHeader(REPLY_TO_SESSION_ID, SERVICE_BUS_REPLY_TO_SESSION_ID) + .setHeader(PARTITION_KEY, SERVICE_BUS_SESSION_ID) // when + // session id set, the partition key equals to session id + .build(); ServiceBusMessage serviceBusMessage = this.messageConverter.fromMessage(springMessage, ServiceBusMessage.class); diff --git a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/QueueTemplateSendTest.java b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/QueueTemplateSendTest.java index 5bf0845091b5..0901841df737 100644 --- a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/QueueTemplateSendTest.java +++ b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/QueueTemplateSendTest.java @@ -8,22 +8,24 @@ import com.azure.spring.integration.servicebus.ServiceBusTemplateSendTest; import com.azure.spring.integration.servicebus.converter.ServiceBusMessageConverter; import com.azure.spring.integration.servicebus.factory.ServiceBusQueueClientFactory; -import org.junit.Before; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.mockito.MockitoAnnotations; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) public class QueueTemplateSendTest extends ServiceBusTemplateSendTest { - @Before + private AutoCloseable closeable; + + @BeforeEach @Override public void setUp() { + this.closeable = MockitoAnnotations.openMocks(this); this.mockClientFactory = mock(ServiceBusQueueClientFactory.class); this.mockClient = mock(ServiceBusSenderAsyncClient.class); @@ -32,4 +34,11 @@ public void setUp() { this.sendOperation = new ServiceBusQueueTemplate(mockClientFactory, new ServiceBusMessageConverter()); } + + + @AfterEach + public void close() throws Exception { + closeable.close(); + } + } diff --git a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/QueueTemplateSubscribeTest.java b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/QueueTemplateSubscribeTest.java index 263cec4ac300..2b0652dffb3c 100644 --- a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/QueueTemplateSubscribeTest.java +++ b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/QueueTemplateSubscribeTest.java @@ -8,12 +8,12 @@ import com.azure.spring.integration.servicebus.factory.ServiceBusQueueClientFactory; import com.azure.spring.integration.servicebus.support.ServiceBusProcessorClientWrapper; import com.azure.spring.integration.test.support.SubscribeOperationTest; -import org.junit.Before; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; @@ -22,7 +22,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) public class QueueTemplateSubscribeTest extends SubscribeOperationTest { @Mock @@ -30,13 +29,20 @@ public class QueueTemplateSubscribeTest extends SubscribeOperationTest { @Mock ServiceBusQueueClientFactory clientFactory; + private AutoCloseable closeable; + + @BeforeEach @Override public void setUp() { + this.closeable = MockitoAnnotations.openMocks(this); this.adapter = new ServiceBusQueueInboundChannelAdapter(destination, new ServiceBusQueueTestOperation(clientFactory)); } + + @AfterEach + public void close() throws Exception { + closeable.close(); + } } diff --git a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/ServiceBusQueueOperationDeadLetterQueueTest.java b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/ServiceBusQueueOperationDeadLetterQueueTest.java index 0c7157b03166..e90b7076ed7e 100644 --- a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/ServiceBusQueueOperationDeadLetterQueueTest.java +++ b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/ServiceBusQueueOperationDeadLetterQueueTest.java @@ -6,13 +6,25 @@ import com.azure.spring.integration.core.api.CheckpointConfig; import com.azure.spring.integration.core.api.CheckpointMode; import com.azure.spring.integration.test.support.pojo.User; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.MockitoAnnotations; -@RunWith(MockitoJUnitRunner.class) public class ServiceBusQueueOperationDeadLetterQueueTest extends ServiceBusQueueOperationSendSubscribeTest { + private AutoCloseable closeable; + + @BeforeEach + public void setup() { + this.closeable = MockitoAnnotations.openMocks(this); + } + + @AfterEach + public void close() throws Exception { + closeable.close(); + } + @Test public void testSendDeadLetterQueueWithoutManualCheckpointModel() { subscribe(destination, m -> sendSubscribeOperation.deadLetter(destination, m, "reason", "desc"), User.class); diff --git a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/ServiceBusQueueOperationSendSubscribeTest.java b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/ServiceBusQueueOperationSendSubscribeTest.java index 272272860c2a..14d8126fa7cd 100644 --- a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/ServiceBusQueueOperationSendSubscribeTest.java +++ b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/queue/ServiceBusQueueOperationSendSubscribeTest.java @@ -7,30 +7,38 @@ import com.azure.spring.integration.servicebus.factory.ServiceBusQueueClientFactory; import com.azure.spring.integration.servicebus.support.ServiceBusQueueTestOperation; import com.azure.spring.integration.test.support.SendSubscribeWithoutGroupOperationTest; -import org.junit.Before; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.messaging.Message; import static com.azure.spring.integration.servicebus.converter.ServiceBusMessageHeaders.RECEIVED_MESSAGE_CONTEXT; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + -@RunWith(MockitoJUnitRunner.class) public class ServiceBusQueueOperationSendSubscribeTest extends SendSubscribeWithoutGroupOperationTest { + private AutoCloseable closeable; + @Mock ServiceBusQueueClientFactory clientFactory; - @Before + @BeforeEach @Override public void setUp() { + this.closeable = MockitoAnnotations.openMocks(this); this.sendSubscribeOperation = new ServiceBusQueueTestOperation(clientFactory); } + @AfterEach + public void close() throws Exception { + closeable.close(); + } + @Override protected void verifyCheckpointSuccessCalled(int times) { verifyCompleteCalledTimes(times); @@ -51,7 +59,7 @@ protected void manualCheckpointHandler(Message message) { assertTrue(message.getHeaders().containsKey(RECEIVED_MESSAGE_CONTEXT)); final ServiceBusReceivedMessageContext receivedMessageContext = message.getHeaders() .get(RECEIVED_MESSAGE_CONTEXT, - ServiceBusReceivedMessageContext.class); + ServiceBusReceivedMessageContext.class); assertNotNull(receivedMessageContext); receivedMessageContext.complete(); @@ -65,20 +73,20 @@ protected void manualCheckpointHandler(Message message) { } protected void verifyCompleteCalledTimes(int times) { - waitMillis(25); + waitMillis(250); final int actualTimes = ((ServiceBusQueueTestOperation) sendSubscribeOperation).getCompleteCalledTimes(); if (actualTimes != times) { - assertEquals("Complete called times", times, actualTimes); + assertEquals(times, actualTimes, "Complete called times"); } } protected void verifyAbandonCalledTimes(int times) { - waitMillis(25); + waitMillis(250); final int actualTimes = ((ServiceBusQueueTestOperation) sendSubscribeOperation).getCompleteCalledTimes(); if (actualTimes != times) { - assertEquals("Complete called times", times, actualTimes); + assertEquals(times, actualTimes, "Complete called times"); } } @@ -86,7 +94,7 @@ protected void verifyDeadLetterCalledTimes(int times) { final int actualTimes = ((ServiceBusQueueTestOperation) sendSubscribeOperation).getDeadLetterCalledTimes(); if (actualTimes != times) { - assertEquals("Complete called times", times, actualTimes); + assertEquals(times, actualTimes, "Complete called times"); } } diff --git a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/ServiceBusTopicInboundAdapterTest.java b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/ServiceBusTopicInboundAdapterTest.java index 884d50c3bbfc..4454c9b86275 100644 --- a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/ServiceBusTopicInboundAdapterTest.java +++ b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/ServiceBusTopicInboundAdapterTest.java @@ -7,18 +7,26 @@ import com.azure.spring.integration.servicebus.inbound.ServiceBusTopicInboundChannelAdapter; import com.azure.spring.integration.servicebus.support.ServiceBusTopicTestOperation; import com.azure.spring.integration.test.support.InboundChannelAdapterTest; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; -@RunWith(MockitoJUnitRunner.class) public class ServiceBusTopicInboundAdapterTest extends InboundChannelAdapterTest { @Mock ServiceBusTopicClientFactory clientFactory; + private AutoCloseable closeable; + + @AfterEach + public void close() throws Exception { + closeable.close(); + } + @BeforeEach @Override public void setUp() { + this.closeable = MockitoAnnotations.openMocks(this); this.adapter = new ServiceBusTopicInboundChannelAdapter(destination, new ServiceBusTopicTestOperation(clientFactory), consumerGroup); diff --git a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/ServiceBusTopicOperationSendSubscribeTest.java b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/ServiceBusTopicOperationSendSubscribeTest.java index 4426062dee53..e94f2a4a82de 100644 --- a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/ServiceBusTopicOperationSendSubscribeTest.java +++ b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/ServiceBusTopicOperationSendSubscribeTest.java @@ -7,30 +7,36 @@ import com.azure.spring.integration.servicebus.factory.ServiceBusTopicClientFactory; import com.azure.spring.integration.servicebus.support.ServiceBusTopicTestOperation; import com.azure.spring.integration.test.support.SendSubscribeWithGroupOperationTest; -import org.junit.Before; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.messaging.Message; import static com.azure.spring.integration.servicebus.converter.ServiceBusMessageHeaders.RECEIVED_MESSAGE_CONTEXT; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; -@RunWith(MockitoJUnitRunner.class) public class ServiceBusTopicOperationSendSubscribeTest extends SendSubscribeWithGroupOperationTest { @Mock ServiceBusTopicClientFactory clientFactory; - @Before - @Override + private AutoCloseable closeable; + + @BeforeEach public void setUp() { + this.closeable = MockitoAnnotations.openMocks(this); this.sendSubscribeOperation = new ServiceBusTopicTestOperation(clientFactory); } + @AfterEach + public void close() throws Exception { + closeable.close(); + } + @Override protected void verifyCheckpointSuccessCalled(int times) { verifyCompleteCalledTimes(times); @@ -51,7 +57,7 @@ protected void manualCheckpointHandler(Message message) { assertTrue(message.getHeaders().containsKey(RECEIVED_MESSAGE_CONTEXT)); final ServiceBusReceivedMessageContext receivedMessageContext = message.getHeaders() .get(RECEIVED_MESSAGE_CONTEXT, - ServiceBusReceivedMessageContext.class); + ServiceBusReceivedMessageContext.class); assertNotNull(receivedMessageContext); receivedMessageContext.complete(); @@ -62,20 +68,20 @@ protected void manualCheckpointHandler(Message message) { } protected void verifyCompleteCalledTimes(int times) { - waitMillis(25); + waitMillis(250); final int actualTimes = ((ServiceBusTopicTestOperation) sendSubscribeOperation).getCompleteCalledTimes(); if (actualTimes != times) { - assertEquals("Complete called times", times, actualTimes); + assertEquals(times, actualTimes, "Complete called times"); } } protected void verifyAbandonCalledTimes(int times) { - waitMillis(25); + waitMillis(250); final int actualTimes = ((ServiceBusTopicTestOperation) sendSubscribeOperation).getCompleteCalledTimes(); if (actualTimes != times) { - assertEquals("Complete called times", times, actualTimes); + assertEquals(times, actualTimes, "Complete called times"); } } } diff --git a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/TopicTemplateSendTest.java b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/TopicTemplateSendTest.java index 1873a4754166..9feed4aa9d68 100644 --- a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/TopicTemplateSendTest.java +++ b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/TopicTemplateSendTest.java @@ -8,22 +8,24 @@ import com.azure.spring.integration.servicebus.ServiceBusTemplateSendTest; import com.azure.spring.integration.servicebus.converter.ServiceBusMessageConverter; import com.azure.spring.integration.servicebus.factory.ServiceBusTopicClientFactory; -import org.junit.Before; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.mockito.MockitoAnnotations; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) public class TopicTemplateSendTest extends ServiceBusTemplateSendTest { - @Before + private AutoCloseable closeable; + + @BeforeEach @Override public void setUp() { + this.closeable = MockitoAnnotations.openMocks(this); this.mockClientFactory = mock(ServiceBusTopicClientFactory.class); this.mockClient = mock(ServiceBusSenderAsyncClient.class); @@ -33,4 +35,9 @@ public void setUp() { this.sendOperation = new ServiceBusTopicTemplate(mockClientFactory, new ServiceBusMessageConverter()); } + @AfterEach + public void close() throws Exception { + closeable.close(); + } + } diff --git a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/TopicTemplateSubscribeTest.java b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/TopicTemplateSubscribeTest.java index 6e298a5c0853..297d2e317219 100644 --- a/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/TopicTemplateSubscribeTest.java +++ b/sdk/spring/azure-spring-integration-servicebus/src/test/java/com/azure/spring/integration/servicebus/topic/TopicTemplateSubscribeTest.java @@ -7,12 +7,12 @@ import com.azure.spring.integration.servicebus.factory.ServiceBusTopicClientFactory; import com.azure.spring.integration.servicebus.support.ServiceBusProcessorClientWrapper; import com.azure.spring.integration.test.support.SubscribeByGroupOperationTest; -import org.junit.Before; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.atLeastOnce; @@ -20,15 +20,15 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) public class TopicTemplateSubscribeTest extends SubscribeByGroupOperationTest { @Mock private ServiceBusTopicClientFactory mockClientFactory; private ServiceBusProcessorClientWrapper processorClientWrapper; - - @Before + private AutoCloseable closeable; + @BeforeEach public void setUp() { + this.closeable = MockitoAnnotations.openMocks(this); this.processorClientWrapper = new ServiceBusProcessorClientWrapper(); ServiceBusProcessorClientWrapper anotherProcessorClientWrapper = new ServiceBusProcessorClientWrapper(); @@ -44,6 +44,11 @@ public void setUp() { any())).thenReturn(anotherProcessorClientWrapper.getClient()); } + @AfterEach + public void close() throws Exception { + closeable.close(); + } + @Override protected void verifySubscriberCreatorCalled() { verify(this.mockClientFactory, atLeastOnce()).getOrCreateProcessor(eq(this.destination), diff --git a/sdk/spring/azure-spring-integration-storage-queue/src/test/java/com/azure/spring/integration/storage/queue/StorageQueueMessageSourceTest.java b/sdk/spring/azure-spring-integration-storage-queue/src/test/java/com/azure/spring/integration/storage/queue/StorageQueueMessageSourceTest.java index 0ecce8645e77..c947299866d9 100644 --- a/sdk/spring/azure-spring-integration-storage-queue/src/test/java/com/azure/spring/integration/storage/queue/StorageQueueMessageSourceTest.java +++ b/sdk/spring/azure-spring-integration-storage-queue/src/test/java/com/azure/spring/integration/storage/queue/StorageQueueMessageSourceTest.java @@ -5,21 +5,24 @@ import com.azure.spring.integration.storage.queue.inbound.StorageQueueMessageSource; import com.google.common.collect.ImmutableMap; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; import reactor.core.publisher.Mono; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class StorageQueueMessageSourceTest { @Mock @@ -29,23 +32,34 @@ public class StorageQueueMessageSourceTest { private String destination = "test-destination"; private StorageQueueMessageSource messageSource; + private AutoCloseable closeable; - @Before + @BeforeAll + public void init() { + this.closeable = MockitoAnnotations.openMocks(this); + } + + @BeforeEach public void setup() { messageSource = new StorageQueueMessageSource(destination, mockOperation); } + @AfterAll + public void close() throws Exception { + this.closeable.close(); + } + @Test public void testDoReceiveWhenHaveNoMessage() { when(this.mockOperation.receiveAsync(eq(destination))).thenReturn(Mono.empty()); assertNull(messageSource.doReceive()); } - @Test(expected = StorageQueueRuntimeException.class) + @Test public void testReceiveFailure() { when(this.mockOperation.receiveAsync(eq(destination))).thenReturn(Mono.error( new StorageQueueRuntimeException("Failed to receive message."))); - messageSource.doReceive(); + assertThrows(StorageQueueRuntimeException.class, () -> messageSource.doReceive()); } @Test diff --git a/sdk/spring/azure-spring-integration-storage-queue/src/test/java/com/azure/spring/integration/storage/queue/StorageQueueTemplateReceiveTest.java b/sdk/spring/azure-spring-integration-storage-queue/src/test/java/com/azure/spring/integration/storage/queue/StorageQueueTemplateReceiveTest.java index a58bc43fc57c..88537d5d68d5 100644 --- a/sdk/spring/azure-spring-integration-storage-queue/src/test/java/com/azure/spring/integration/storage/queue/StorageQueueTemplateReceiveTest.java +++ b/sdk/spring/azure-spring-integration-storage-queue/src/test/java/com/azure/spring/integration/storage/queue/StorageQueueTemplateReceiveTest.java @@ -8,19 +8,19 @@ import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedResponse; import com.azure.core.util.IterableStream; -import com.azure.storage.queue.QueueAsyncClient; -import com.azure.storage.queue.models.QueueMessageItem; -import com.azure.storage.queue.models.QueueStorageException; -import com.google.common.collect.Lists; import com.azure.spring.integration.core.AzureHeaders; import com.azure.spring.integration.core.api.CheckpointMode; import com.azure.spring.integration.core.api.reactor.Checkpointer; import com.azure.spring.integration.storage.queue.factory.StorageQueueClientFactory; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import com.azure.storage.queue.QueueAsyncClient; +import com.azure.storage.queue.models.QueueMessageItem; +import com.azure.storage.queue.models.QueueStorageException; +import com.google.common.collect.Lists; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import org.springframework.messaging.Message; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -30,12 +30,16 @@ import java.util.List; import java.util.Map; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) public class StorageQueueTemplateReceiveTest { private final String messageId = "1"; @@ -49,9 +53,11 @@ public class StorageQueueTemplateReceiveTest { private QueueMessageItem queueMessage; private int visibilityTimeoutInSeconds = 30; private String destination = "queue"; + private AutoCloseable closeable; - @Before + @BeforeEach public void setup() { + this.closeable = MockitoAnnotations.openMocks(this); queueMessage = new QueueMessageItem(); queueMessage.setMessageText(messageText); queueMessage.setMessageId(messageId); @@ -100,6 +106,11 @@ public IterableStream getElements() { this.operation = new StorageQueueTemplate(this.mockClientFactory); } + @AfterEach + public void close() throws Exception { + this.closeable.close(); + } + @Test public void testReceiveFailure() { when(this.mockClient.receiveMessages(eq(1), eq(Duration.ofSeconds(visibilityTimeoutInSeconds)))) diff --git a/sdk/spring/azure-spring-integration-storage-queue/src/test/java/com/azure/spring/integration/storage/queue/StorageQueueTemplateSendTest.java b/sdk/spring/azure-spring-integration-storage-queue/src/test/java/com/azure/spring/integration/storage/queue/StorageQueueTemplateSendTest.java index 0ec4ccdf1925..9b3981a56026 100644 --- a/sdk/spring/azure-spring-integration-storage-queue/src/test/java/com/azure/spring/integration/storage/queue/StorageQueueTemplateSendTest.java +++ b/sdk/spring/azure-spring-integration-storage-queue/src/test/java/com/azure/spring/integration/storage/queue/StorageQueueTemplateSendTest.java @@ -3,20 +3,24 @@ package com.azure.spring.integration.storage.queue; -import com.azure.storage.queue.QueueAsyncClient; -import com.azure.storage.queue.models.SendMessageResult; import com.azure.spring.integration.storage.queue.factory.StorageQueueClientFactory; import com.azure.spring.integration.test.support.reactor.SendOperationTest; -import org.junit.Before; -import org.junit.runner.RunWith; +import com.azure.storage.queue.QueueAsyncClient; +import com.azure.storage.queue.models.SendMessageResult; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.MockitoAnnotations; import reactor.core.publisher.Mono; -import static org.mockito.ArgumentMatchers.*; -import static org.mockito.Mockito.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; -@RunWith(MockitoJUnitRunner.class) public class StorageQueueTemplateSendTest extends SendOperationTest { @Mock @@ -25,7 +29,19 @@ public class StorageQueueTemplateSendTest extends SendOperationTestspring-boot-starter-test 2.5.0 - - org.junit.vintage - junit-vintage-engine - 5.7.2 - org.hibernate.validator hibernate-validator diff --git a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/InboundChannelAdapterTest.java b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/InboundChannelAdapterTest.java index 68ffb814866d..c438cdce148d 100644 --- a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/InboundChannelAdapterTest.java +++ b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/InboundChannelAdapterTest.java @@ -4,8 +4,8 @@ package com.azure.spring.integration.test.support; import com.azure.spring.integration.core.AbstractInboundChannelAdapter; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; @@ -17,8 +17,8 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; public abstract class InboundChannelAdapterTest { @@ -49,14 +49,14 @@ public void sendAndReceive() throws InterruptedException { }); this.messages.forEach(this.adapter::receiveMessage); - assertTrue("Failed to receive message", latch.await(5L, TimeUnit.SECONDS)); + assertTrue(latch.await(5L, TimeUnit.SECONDS), "Failed to receive message"); for (int i = 0; i < receivedMessages.size(); i++) { assertEquals(receivedMessages.get(i), payloads[i]); } } - @Before + @BeforeEach public abstract void setUp(); public A getAdapter() { diff --git a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/MessageHandlerTest.java b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/MessageHandlerTest.java index 12fa2854d1f2..27658fb377b8 100644 --- a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/MessageHandlerTest.java +++ b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/MessageHandlerTest.java @@ -8,9 +8,7 @@ import com.azure.spring.integration.core.DefaultMessageHandler; import com.azure.spring.integration.core.api.PartitionSupplier; import com.azure.spring.integration.core.api.SendOperation; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.Test; import org.springframework.expression.Expression; import org.springframework.integration.MessageTimeoutException; import org.springframework.messaging.Message; @@ -25,8 +23,8 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.mockito.Mockito.spy; +import static org.junit.jupiter.api.Assertions.assertThrows; -@RunWith(MockitoJUnitRunner.class) public abstract class MessageHandlerTest { @SuppressWarnings("unchecked") @@ -113,13 +111,13 @@ public void testSendSync() { } @SuppressWarnings("unchecked") - @Test(expected = MessageTimeoutException.class) + @Test public void testSendTimeout() { when(this.sendOperation.sendAsync(eq(this.destination), isA(Message.class), isA(PartitionSupplier.class))) .thenReturn(new CompletableFuture<>()); this.handler.setSync(true); this.handler.setSendTimeout(1); - this.handler.handleMessage(this.message); + assertThrows(MessageTimeoutException.class, () -> this.handler.handleMessage(this.message)); } @Test diff --git a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SendOperationTest.java b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SendOperationTest.java index a6f0824b4c36..ad485b8b23f2 100644 --- a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SendOperationTest.java +++ b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SendOperationTest.java @@ -6,7 +6,7 @@ import com.azure.spring.integration.core.api.PartitionSupplier; import com.azure.spring.integration.core.api.SendOperation; import com.google.common.collect.ImmutableMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.NestedRuntimeException; import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; @@ -15,15 +15,16 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; +import static org.assertj.core.api.Fail.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; public abstract class SendOperationTest { protected String destination = "event-hub"; protected Message message = new GenericMessage<>("testPayload", - ImmutableMap.of("key1", "value1", "key2", "value2")); + ImmutableMap.of("key1", "value1", "key2", "value2")); protected Mono mono = Mono.empty(); protected String partitionKey = "key"; protected String payload = "payload"; @@ -32,15 +33,12 @@ public abstract class SendOperationTest { protected abstract void setupError(String errorMessage); - @Test(expected = NestedRuntimeException.class) + @Test public void testSendCreateSenderFailure() throws Throwable { whenSendWithException(); - try { - this.sendOperation.sendAsync(destination, this.message, null).get(); - } catch (ExecutionException e) { - throw e.getCause(); - } + assertThrows(NestedRuntimeException.class, + () -> this.sendOperation.sendAsync(destination, this.message, null).get()); } @Test diff --git a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SendSubscribeOperationTest.java b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SendSubscribeOperationTest.java index 4220f1aaa2c9..817f401d6264 100644 --- a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SendSubscribeOperationTest.java +++ b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SendSubscribeOperationTest.java @@ -9,8 +9,8 @@ import com.azure.spring.integration.core.api.Checkpointer; import com.azure.spring.integration.core.api.SendOperation; import com.azure.spring.integration.test.support.pojo.User; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; @@ -22,9 +22,9 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; public abstract class SendSubscribeOperationTest { @@ -45,7 +45,7 @@ public abstract class SendSubscribeOperationTest { private final Message stringMessage = new GenericMessage<>(payload, headers); private final Message byteMessage = new GenericMessage<>(payload.getBytes(StandardCharsets.UTF_8), headers); - @Before + @BeforeEach public abstract void setUp() throws Exception; @Test diff --git a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SubscribeByGroupOperationTest.java b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SubscribeByGroupOperationTest.java index 66063a1fb71d..1137465f407a 100644 --- a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SubscribeByGroupOperationTest.java +++ b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SubscribeByGroupOperationTest.java @@ -4,11 +4,11 @@ package com.azure.spring.integration.test.support; import com.azure.spring.integration.core.api.SubscribeByGroupOperation; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.messaging.Message; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public abstract class SubscribeByGroupOperationTest { diff --git a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SubscribeOperationTest.java b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SubscribeOperationTest.java index d48e594e2ba4..32224a070d2a 100644 --- a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SubscribeOperationTest.java +++ b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/SubscribeOperationTest.java @@ -4,11 +4,11 @@ package com.azure.spring.integration.test.support; import com.azure.spring.integration.core.api.SubscribeOperation; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.messaging.Message; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public abstract class SubscribeOperationTest { diff --git a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/UnaryAzureMessageConverterTest.java b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/UnaryAzureMessageConverterTest.java index ca4d41ec08b1..25efc3caa2e6 100644 --- a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/UnaryAzureMessageConverterTest.java +++ b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/UnaryAzureMessageConverterTest.java @@ -5,15 +5,15 @@ import com.azure.spring.integration.core.converter.AzureMessageConverter; import com.azure.spring.integration.test.support.pojo.User; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; import java.nio.charset.StandardCharsets; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; public abstract class UnaryAzureMessageConverterTest { @@ -28,7 +28,7 @@ public abstract class UnaryAzureMessageConverterTest { protected abstract void assertMessageHeadersEqual(T azureMessage, Message message); - @Before + @BeforeEach public void setUp() { converter = getConverter(); } diff --git a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/reactor/MessageHandlerTest.java b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/reactor/MessageHandlerTest.java index f02e8bd50ce2..874bbab823cb 100644 --- a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/reactor/MessageHandlerTest.java +++ b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/reactor/MessageHandlerTest.java @@ -8,9 +8,7 @@ import com.azure.spring.integration.core.api.reactor.DefaultMessageHandler; import com.azure.spring.integration.core.api.reactor.SendOperation; import com.google.common.collect.ImmutableMap; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import org.junit.jupiter.api.Test; import org.springframework.expression.Expression; import org.springframework.integration.MessageTimeoutException; import org.springframework.messaging.Message; @@ -24,8 +22,8 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static org.junit.jupiter.api.Assertions.assertThrows; -@RunWith(MockitoJUnitRunner.class) public abstract class MessageHandlerTest { protected String destination = "dest"; @@ -34,7 +32,7 @@ public abstract class MessageHandlerTest { protected Mono mono = Mono.empty(); protected O sendOperation; private Message message = new GenericMessage<>("testPayload", - ImmutableMap.of("key1", "value1", "key2", "value2")); + ImmutableMap.of("key1", "value1", "key2", "value2")); private String payload = "payload"; public abstract void setUp(); @@ -44,7 +42,7 @@ public abstract class MessageHandlerTest { public void testSend() { this.handler.handleMessage(this.message); verify(this.sendOperation, times(1)).sendAsync(eq(destination), isA(Message.class), - isA(PartitionSupplier.class)); + isA(PartitionSupplier.class)); } @Test @@ -70,10 +68,10 @@ public void onSuccess(Void v) { @SuppressWarnings("unchecked") public void testSendDynamicTopic() { Message dynamicMessage = new GenericMessage<>(payload, - ImmutableMap.of(AzureHeaders.NAME, dynamicDestination)); + ImmutableMap.of(AzureHeaders.NAME, dynamicDestination)); this.handler.handleMessage(dynamicMessage); verify(this.sendOperation, times(1)).sendAsync(eq(dynamicDestination), isA(Message.class), - isA(PartitionSupplier.class)); + isA(PartitionSupplier.class)); } @Test @@ -86,15 +84,15 @@ public void testSendSync() { verify(timeout, times(1)).getValue(eq(null), eq(this.message), eq(Long.class)); } - @Test(expected = MessageTimeoutException.class) + @Test @SuppressWarnings("unchecked") public void testSendTimeout() { when(this.sendOperation.sendAsync(eq(this.destination), isA(Message.class), - isA(PartitionSupplier.class))).thenReturn(Mono.empty().timeout(Mono.empty())); + isA(PartitionSupplier.class))).thenReturn(Mono.empty().timeout(Mono.empty())); this.handler.setSync(true); this.handler.setSendTimeout(1); - this.handler.handleMessage(this.message); + assertThrows(MessageTimeoutException.class, () -> this.handler.handleMessage(this.message)); } public Mono getMono() { diff --git a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/reactor/SendOperationTest.java b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/reactor/SendOperationTest.java index bc88a53a62cf..1a5409d57854 100644 --- a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/reactor/SendOperationTest.java +++ b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/reactor/SendOperationTest.java @@ -5,29 +5,30 @@ import com.azure.spring.integration.core.api.reactor.SendOperation; import com.google.common.collect.ImmutableMap; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.core.NestedRuntimeException; import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; import reactor.core.publisher.Mono; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; - +import static org.assertj.core.api.Fail.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; public abstract class SendOperationTest { protected String consumerGroup = "consumer-group"; protected String destination = "event-hub"; protected Message message = new GenericMessage<>("testPayload", - ImmutableMap.of("key1", "value1", "key2", "value2")); + ImmutableMap.of("key1", "value1", "key2", "value2")); protected Mono mono = Mono.empty(); protected String payload = "payload"; protected O sendOperation; protected abstract void setupError(String errorMessage); + @Test public void testSend() { final Mono mono = this.sendOperation.sendAsync(destination, message, null); @@ -36,11 +37,12 @@ public void testSend() { verifySendCalled(1); } - @Test(expected = NestedRuntimeException.class) + @Test public void testSendCreateSenderFailure() { whenSendWithException(); - this.sendOperation.sendAsync(destination, this.message, null).block(); + assertThrows(NestedRuntimeException.class, () -> this.sendOperation.sendAsync(destination, this.message, + null).block()); } @Test diff --git a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/reactor/SendSubscribeOperationTest.java b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/reactor/SendSubscribeOperationTest.java index 30169dc8420d..0b2de2fc1bd6 100644 --- a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/reactor/SendSubscribeOperationTest.java +++ b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/reactor/SendSubscribeOperationTest.java @@ -9,8 +9,8 @@ import com.azure.spring.integration.core.api.reactor.Checkpointer; import com.azure.spring.integration.core.api.reactor.SendOperation; import com.azure.spring.integration.test.support.pojo.User; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; @@ -22,9 +22,10 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + public abstract class SendSubscribeOperationTest { @@ -45,7 +46,7 @@ public abstract class SendSubscribeOperationTest { protected abstract void setCheckpointConfig(CheckpointConfig checkpointConfig); - @Before + @BeforeEach public abstract void setUp(); protected abstract void subscribe(String destination, Consumer> consumer, Class payloadType); diff --git a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/rx/RxSendSubscribeOperationTest.java b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/rx/RxSendSubscribeOperationTest.java index 322a4e4e4286..1af31743a2fe 100644 --- a/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/rx/RxSendSubscribeOperationTest.java +++ b/sdk/spring/azure-spring-integration-test/src/main/java/com/azure/spring/integration/test/support/rx/RxSendSubscribeOperationTest.java @@ -7,8 +7,8 @@ import com.azure.spring.integration.core.api.CheckpointMode; import com.azure.spring.integration.core.api.RxSendOperation; import com.azure.spring.integration.test.support.pojo.User; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.messaging.Message; import org.springframework.messaging.support.GenericMessage; import rx.Observable; @@ -40,7 +40,7 @@ public abstract class RxSendSubscribeOperationTest { protected abstract void setCheckpointConfig(CheckpointConfig checkpointConfig); - @Before + @BeforeEach public abstract void setUp(); protected abstract Observable> subscribe(String destination, Class payloadType); From 8cc107cccf5443c2fdb8c663bbeec4e814c96b3c Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Tue, 1 Jun 2021 08:12:46 -0700 Subject: [PATCH 04/53] Fix Broken Link Explaining Spring Duration Conversions (#21942) --- .../README.md | 2 +- .../README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/appconfiguration/azure-spring-cloud-starter-appconfiguration-config/README.md b/sdk/appconfiguration/azure-spring-cloud-starter-appconfiguration-config/README.md index a037d66ed4d0..355dcf3e3618 100644 --- a/sdk/appconfiguration/azure-spring-cloud-starter-appconfiguration-config/README.md +++ b/sdk/appconfiguration/azure-spring-cloud-starter-appconfiguration-config/README.md @@ -327,7 +327,7 @@ Please follow [instructions here][contributing_md] to build from source or contr [logging_doc]: https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#boot-features-logging [contributing_md]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/spring/CONTRIBUTING.md [maven]: https://maven.apache.org/ -[spring_conversion_duration]: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-conversion-duration +[spring_conversion_duration]: https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.conversion.durations [azure_managed_identity]: https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview [enable_managed_identities]: https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview#how-can-i-use-managed-identities-for-azure-resources [support_azure_services]: https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/services-support-managed-identities diff --git a/sdk/appconfiguration/spring-cloud-starter-azure-appconfiguration-config/README.md b/sdk/appconfiguration/spring-cloud-starter-azure-appconfiguration-config/README.md index b697d7d1c883..eb61f2580992 100644 --- a/sdk/appconfiguration/spring-cloud-starter-azure-appconfiguration-config/README.md +++ b/sdk/appconfiguration/spring-cloud-starter-azure-appconfiguration-config/README.md @@ -241,7 +241,7 @@ public class MyClient implements ConfigurationClientBuilderSetup, SecretClientBu [azure_managed_identity]: https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview [enable_managed_identities]: https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview#how-can-i-use-managed-identities-for-azure-resources [support_azure_services]: https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/services-support-managed-identities -[spring_conversion_duration]: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-conversion-duration +[spring_conversion_duration]: https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.conversion.durations [azure_subscription]: https://azure.microsoft.com/free [jdk_link]: https://docs.microsoft.com/java/azure/jdk/?view=azure-java-stable [maven]: https://maven.apache.org/ From ebe9c6d4350c4f890f014b582d6da8b9b5fe98d1 Mon Sep 17 00:00:00 2001 From: Jianping Chen Date: Tue, 1 Jun 2021 10:15:34 -0700 Subject: [PATCH 05/53] [Communication]: Remove unused code in pom and test files (#21654) * Remove unused code in pom and test files * Restore unintended change * Revert a test file change * Restore tests.yml * Remove unused env variable in tests.yml * Remove tests.yml * Keep skipping SMS tests in INT * Try to skip jacoco in INT * try different syntax * Try use string as much as we can * Try escape quotes * Try use a variable inside loop * Fix a typo * Move variable to a different place * Try Macro syntax * Remove variable, use stage name instead * Fix syntax * Try a different syntax * Try something simple * Move variables to the right place * Flip logic * Renamve variable * Give up on customizing jacoco.skip * Try to use variable to skp jacoco * Try different syntax * Move variable declaration * Try to set variable * Try PreSteps * Remove local variable * Remove unnecessary overwrite * Remove quotes Co-authored-by: JP Chen --- .../azure-communication-chat/pom.xml | 42 ----------- .../chat/ChatAsyncClientTest.java | 7 -- .../communication/chat/ChatClientTest.java | 7 -- .../chat/ChatClientTestBase.java | 7 -- .../chat/ChatThreadAsyncClientTest.java | 7 -- .../chat/ChatThreadClientTest.java | 7 -- .../azure-communication-identity/pom.xml | 42 ----------- .../CommunicationIdentityAsyncTests.java | 7 -- .../CommunicationIdentityClientTestBase.java | 7 -- .../identity/CommunicationIdentityTests.java | 7 -- .../azure-communication-phonenumbers/pom.xml | 56 --------------- ...honeNumbersAsyncClientIntegrationTest.java | 7 -- .../PhoneNumbersClientBuilderTest.java | 2 - .../PhoneNumbersClientIntegrationTest.java | 7 -- .../PhoneNumbersIntegrationTestBase.java | 6 -- .../azure-communication-sms/pom.xml | 58 --------------- .../azure/communication/sms/SmsTestBase.java | 5 +- .../communication-tests-template.yml | 5 +- sdk/communication/tests.yml | 71 ------------------- 19 files changed, 5 insertions(+), 352 deletions(-) delete mode 100644 sdk/communication/tests.yml diff --git a/sdk/communication/azure-communication-chat/pom.xml b/sdk/communication/azure-communication-chat/pom.xml index 7cc62dd52847..f0a85bb294e3 100644 --- a/sdk/communication/azure-communication-chat/pom.xml +++ b/sdk/communication/azure-communication-chat/pom.xml @@ -170,47 +170,5 @@ - - disable-coverage-if-identity - - - env.TEST_PACKAGES_ENABLED - identity - - - - src/main - src/test - true - - - - disable-coverage-if-phonenumbers - - - env.TEST_PACKAGES_ENABLED - phonenumbers - - - - src/main - src/test - true - - - - disable-coverage-if-sms - - - env.TEST_PACKAGES_ENABLED - sms - - - - src/main - src/test - true - - diff --git a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatAsyncClientTest.java b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatAsyncClientTest.java index 27e723e58170..eebeaf5b9f31 100644 --- a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatAsyncClientTest.java +++ b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatAsyncClientTest.java @@ -30,7 +30,6 @@ import java.util.UUID; import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assumptions.assumeTrue; /** * Set the AZURE_TEST_MODE environment variable to either PLAYBACK or RECORD to determine if tests are playback or @@ -46,12 +45,6 @@ public class ChatAsyncClientTest extends ChatClientTestBase { private CommunicationUserIdentifier firstThreadMember; private CommunicationUserIdentifier secondThreadMember; - @Override - protected void beforeTest() { - super.beforeTest(); - assumeTrue(shouldEnableChatTests()); - } - @Override protected void afterTest() { super.afterTest(); diff --git a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTest.java b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTest.java index 2c803d0e9a48..89cd18a49ba8 100644 --- a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTest.java +++ b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTest.java @@ -6,7 +6,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assumptions.assumeTrue; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -40,12 +39,6 @@ public class ChatClientTest extends ChatClientTestBase { private CommunicationUserIdentifier firstThreadMember; private CommunicationUserIdentifier secondThreadMember; - @Override - protected void beforeTest() { - super.beforeTest(); - assumeTrue(shouldEnableChatTests()); - } - @Override protected void afterTest() { super.afterTest(); diff --git a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTestBase.java b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTestBase.java index 048e7420a984..1df05fdd4ca8 100644 --- a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTestBase.java +++ b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatClientTestBase.java @@ -46,9 +46,6 @@ public class ChatClientTestBase extends TestBase { protected static final String ACCESS_KEY = Configuration.getGlobalConfiguration() .get("COMMUNICATION_SERVICE_ACCESS_KEY", "pw=="); - private static final String TEST_PACKAGES_ENABLED = Configuration.getGlobalConfiguration() - .get("TEST_PACKAGES_ENABLED", "all"); - private static final StringJoiner JSON_PROPERTIES_TO_REDACT = new StringJoiner("\":\"|\"", "\"", "\":\"") .add("token"); @@ -215,10 +212,6 @@ protected ChatClientBuilder addLoggingPolicyForIdentityClientBuilder(ChatClientB return builder.addPolicy(new CommunicationLoggerPolicy(testName)); } - protected boolean shouldEnableChatTests() { - return TEST_PACKAGES_ENABLED.matches("(all|chat)"); - } - private String redact(String content, Matcher matcher, String replacement) { while (matcher.find()) { String captureGroup = matcher.group(1); diff --git a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java index 064e3897c8df..e57f75afd1ac 100644 --- a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java +++ b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java @@ -6,7 +6,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assumptions.assumeTrue; import com.azure.communication.chat.implementation.models.CommunicationErrorResponseException; import com.azure.core.exception.HttpResponseException; @@ -58,12 +57,6 @@ public class ChatThreadAsyncClientTest extends ChatClientTestBase { private CommunicationUserIdentifier firstAddedParticipant; private CommunicationUserIdentifier secondAddedParticipant; - @Override - protected void beforeTest() { - super.beforeTest(); - assumeTrue(shouldEnableChatTests()); - } - @Override protected void afterTest() { super.afterTest(); diff --git a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadClientTest.java b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadClientTest.java index 8a55178ab83f..448dfcbb28de 100644 --- a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadClientTest.java +++ b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadClientTest.java @@ -6,7 +6,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assumptions.assumeTrue; import static org.junit.jupiter.api.Assertions.assertThrows; import com.azure.core.exception.HttpResponseException; @@ -54,12 +53,6 @@ public class ChatThreadClientTest extends ChatClientTestBase { private CommunicationUserIdentifier firstAddedParticipant; private CommunicationUserIdentifier secondAddedParticipant; - @Override - protected void beforeTest() { - super.beforeTest(); - assumeTrue(shouldEnableChatTests()); - } - @Override protected void afterTest() { super.afterTest(); diff --git a/sdk/communication/azure-communication-identity/pom.xml b/sdk/communication/azure-communication-identity/pom.xml index 03b1a27204bb..b699d5458ba6 100644 --- a/sdk/communication/azure-communication-identity/pom.xml +++ b/sdk/communication/azure-communication-identity/pom.xml @@ -181,47 +181,5 @@ - - disable-coverage-if-phonenumbers - - - env.TEST_PACKAGES_ENABLED - phonenumbers - - - - src/main - src/test - true - - - - disable-coverage-if-sms - - - env.TEST_PACKAGES_ENABLED - sms - - - - src/main - src/test - true - - - - disable-coverage-if-chat - - - env.TEST_PACKAGES_ENABLED - chat - - - - src/main - src/test - true - - diff --git a/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityAsyncTests.java b/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityAsyncTests.java index 750dbf95f6fa..f97a0cd92d7e 100644 --- a/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityAsyncTests.java +++ b/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityAsyncTests.java @@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.util.Arrays; import java.util.List; @@ -26,12 +25,6 @@ public class CommunicationIdentityAsyncTests extends CommunicationIdentityClientTestBase { private CommunicationIdentityAsyncClient asyncClient; - @Override - protected void beforeTest() { - super.beforeTest(); - assumeTrue(shouldEnableIdentityTests()); - } - @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void createAsyncIdentityClientUsingManagedIdentity(HttpClient httpClient) { diff --git a/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityClientTestBase.java b/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityClientTestBase.java index 697c2c9d4160..30a12efc9a6d 100644 --- a/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityClientTestBase.java +++ b/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityClientTestBase.java @@ -34,9 +34,6 @@ public class CommunicationIdentityClientTestBase extends TestBase { protected static final String CONNECTION_STRING = Configuration.getGlobalConfiguration() .get("COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING", "endpoint=https://REDACTED.communication.azure.com/;accesskey=QWNjZXNzS2V5"); - private static final String TEST_PACKAGES_ENABLED = Configuration.getGlobalConfiguration() - .get("TEST_PACKAGES_ENABLED", "all"); - private static final StringJoiner JSON_PROPERTIES_TO_REDACT = new StringJoiner("\":\"|\"", "\"", "\":\"") .add("token"); @@ -138,10 +135,6 @@ private Mono logHeaders(String testName, HttpPipelineNextPolicy ne }); } - protected boolean shouldEnableIdentityTests() { - return TEST_PACKAGES_ENABLED.matches("(all|identity)"); - } - static class FakeCredentials implements TokenCredential { @Override public Mono getToken(TokenRequestContext tokenRequestContext) { diff --git a/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityTests.java b/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityTests.java index 6e0b225c83a1..b0ac974b2ba8 100644 --- a/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityTests.java +++ b/sdk/communication/azure-communication-identity/src/test/java/com/azure/communication/identity/CommunicationIdentityTests.java @@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.util.Arrays; import java.util.List; @@ -24,12 +23,6 @@ public class CommunicationIdentityTests extends CommunicationIdentityClientTestBase { private CommunicationIdentityClient client; - @Override - protected void beforeTest() { - super.beforeTest(); - assumeTrue(shouldEnableIdentityTests()); - } - @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void createIdentityClientUsingManagedIdentity(HttpClient httpClient) { diff --git a/sdk/communication/azure-communication-phonenumbers/pom.xml b/sdk/communication/azure-communication-phonenumbers/pom.xml index 72d1b01929f4..414f997d37fd 100644 --- a/sdk/communication/azure-communication-phonenumbers/pom.xml +++ b/sdk/communication/azure-communication-phonenumbers/pom.xml @@ -180,61 +180,5 @@ - - disable-coverage-if-identity - - - env.TEST_PACKAGES_ENABLED - identity - - - - src/main - src/test - true - - - - disable-coverage-if-sms - - - env.TEST_PACKAGES_ENABLED - sms - - - - src/main - src/test - true - - - - disable-coverage-if-chat - - - env.TEST_PACKAGES_ENABLED - chat - - - - src/main - src/test - true - - - - disable-coverage-if-phonenumbers - - - env.COMMUNICATION_SKIP_INT_PHONENUMBERS_TEST - true - - - - src/main - src/test - true - - diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index 245222009f7f..22e2c3b6787c 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -26,16 +26,9 @@ import java.time.Duration; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assumptions.assumeTrue; public class PhoneNumbersAsyncClientIntegrationTest extends PhoneNumbersIntegrationTestBase { - @Override - protected void beforeTest() { - super.beforeTest(); - assumeTrue(shouldEnablePhoneNumbersTests()); - } - @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void getPurchasedPhoneNumber(HttpClient httpClient) { diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java index 7fab07c5f7cd..66ddc4898cf4 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java @@ -26,7 +26,6 @@ import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assumptions.assumeTrue; import static org.mockito.Mockito.*; @Execution(value = ExecutionMode.SAME_THREAD) @@ -45,7 +44,6 @@ public class PhoneNumbersClientBuilderTest { void setUp() { this.httpClient = mock(HttpClient.class); this.clientBuilder = Mockito.spy(new PhoneNumbersClientBuilder()); - assumeTrue(Configuration.getGlobalConfiguration().get("TEST_PACKAGES_ENABLED", "all").matches("all|phonenumbers")); } @AfterEach diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java index 2ddc060f213b..0b2b0090c7a4 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java @@ -30,16 +30,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.fail; -import static org.junit.jupiter.api.Assumptions.assumeTrue; public class PhoneNumbersClientIntegrationTest extends PhoneNumbersIntegrationTestBase { - @Override - protected void beforeTest() { - super.beforeTest(); - assumeTrue(shouldEnablePhoneNumbersTests()); - } - @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void getPurchasedPhoneNumber(HttpClient httpClient) { diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java index 12f68bb14789..03bed7ebe66c 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java @@ -37,9 +37,6 @@ public class PhoneNumbersIntegrationTestBase extends TestBase { protected static final String PHONE_NUMBER = Configuration.getGlobalConfiguration().get("AZURE_PHONE_NUMBER", "+11234567891"); - private static final String TEST_PACKAGES_ENABLED = Configuration.getGlobalConfiguration() - .get("TEST_PACKAGES_ENABLED", "all"); - private static final StringJoiner JSON_PROPERTIES_TO_REDACT = new StringJoiner("\":\"|\"", "\"", "\":\"") .add("id") @@ -146,7 +143,4 @@ private String redact(String content, Matcher matcher, String replacement) { return content; } - protected boolean shouldEnablePhoneNumbersTests() { - return TEST_PACKAGES_ENABLED.matches("(all|phonenumbers)"); - } } diff --git a/sdk/communication/azure-communication-sms/pom.xml b/sdk/communication/azure-communication-sms/pom.xml index 2cf833da7b9a..9ac2c2216164 100644 --- a/sdk/communication/azure-communication-sms/pom.xml +++ b/sdk/communication/azure-communication-sms/pom.xml @@ -144,62 +144,4 @@ - - - disable-coverage-if-identity - - - env.TEST_PACKAGES_ENABLED - identity - - - - src/main - src/test - true - - - - disable-coverage-if-phonenumbers - - - env.TEST_PACKAGES_ENABLED - phonenumbers - - - - src/main - src/test - true - - - - disable-coverage-if-chat - - - env.TEST_PACKAGES_ENABLED - chat - - - - src/main - src/test - true - - - - disable-coverage-if-sms - - - env.COMMUNICATION_SKIP_INT_PHONENUMBERS_TEST - true - - - - src/main - src/test - true - - - diff --git a/sdk/communication/azure-communication-sms/src/test/java/com/azure/communication/sms/SmsTestBase.java b/sdk/communication/azure-communication-sms/src/test/java/com/azure/communication/sms/SmsTestBase.java index f21bd701cc4f..81547473b298 100644 --- a/sdk/communication/azure-communication-sms/src/test/java/com/azure/communication/sms/SmsTestBase.java +++ b/sdk/communication/azure-communication-sms/src/test/java/com/azure/communication/sms/SmsTestBase.java @@ -38,9 +38,6 @@ public class SmsTestBase extends TestBase { protected static final String FROM_PHONE_NUMBER = Configuration.getGlobalConfiguration() .get("AZURE_PHONE_NUMBER", "+15551234567"); - private static final String TEST_PACKAGES_ENABLED = Configuration.getGlobalConfiguration() - .get("TEST_PACKAGES_ENABLED", "all"); - private static final String SKIP_INT_SMS_TEST = Configuration.getGlobalConfiguration() .get("COMMUNICATION_SKIP_INT_SMS_TEST", "False"); @@ -153,6 +150,6 @@ private String redact(String content, Matcher matcher, String replacement) { } protected boolean shouldEnableSmsTests() { - return TEST_PACKAGES_ENABLED.matches("(all|sms)") && !Boolean.parseBoolean(SKIP_INT_SMS_TEST); + return !Boolean.parseBoolean(SKIP_INT_SMS_TEST); } } diff --git a/sdk/communication/communication-tests-template.yml b/sdk/communication/communication-tests-template.yml index 3d567ca197a2..627005f89d7e 100644 --- a/sdk/communication/communication-tests-template.yml +++ b/sdk/communication/communication-tests-template.yml @@ -21,6 +21,9 @@ stages: groupId: com.azure safeName: ${{ parameters.SafeName }} ServiceDirectory: communication + PreSteps: + - bash: echo "##vso[task.setvariable variable=DefaultTestOptions]-Djacoco.skip=true $(DefaultTestOptions)" + condition: not(startsWith(variables['System.StageName'], 'Public')) PostSteps: - task: PublishCodeCoverageResults@1 condition: and(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['JavaTestVersion'], '1.11'), startsWith(variables['System.StageName'], 'Public')) @@ -30,4 +33,4 @@ stages: reportDirectory: sdk/communication/${{ parameters.PackageName }}/target/site/jacoco/ failIfCoverageEmpty: true EnvVars: - SKIP_LIVE_TEST: TRUE + SKIP_LIVE_TEST: TRUE \ No newline at end of file diff --git a/sdk/communication/tests.yml b/sdk/communication/tests.yml deleted file mode 100644 index 13b976f89e37..000000000000 --- a/sdk/communication/tests.yml +++ /dev/null @@ -1,71 +0,0 @@ -trigger: none - -parameters: - - name: TestPackagesEnabled - displayName: Tests Enabled - type: string - default: all - values: - - all - - chat - - identity - - phonenumbers - - sms - -stages: -- template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml - parameters: - CloudConfig: - Public: - SubscriptionConfigurations: - - $(sub-config-azure-cloud-test-resources) - - $(sub-config-communication-services-cloud-test-resources-common) - - $(sub-config-communication-services-cloud-test-resources-java) - Int: - SubscriptionConfigurations: - - $(sub-config-communication-int-test-resources-common) - - $(sub-config-communication-int-test-resources-java) - Clouds: Public,Int - Artifacts: - - name: azure-communication-chat - groupId: com.azure - safeName: azurecommunicationchat - - name: azure-communication-sms - groupId: com.azure - safeName: azurecommunicationsms - - name: azure-communication-identity - groupId: com.azure - safeName: azurecommunicationidentity - - name: azure-communication-phonenumbers - groupId: com.azure - safeName: azurecommunicationphonenumbers - ServiceDirectory: communication - PostSteps: - - task: Maven@3 - displayName: 'Generate aggregate code coverage report' - # The OSName variable gets set by the verify-agent-os.yml template - condition: and(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['JavaTestVersion'], '1.11')) - inputs: - mavenPomFile: sdk/communication/pom.xml - options: -Pcoverage - mavenOptions: '$(MemoryOptions) $(LoggingOptions)' - javaHomeOption: 'JDKVersion' - jdkVersionOption: $(JavaTestVersion) - jdkArchitectureOption: 'x64' - goals: jacoco:report-aggregate - # we want to run this when TestFromSource isn't true - condition: and(succeeded(), ne(variables['TestFromSource'],'true')) - - # Azure DevOps only seems to respect the last code coverage result published, so only do this for Windows + Java LTS. - # Code coverage reporting is setup only for Track 2 modules. - - task: PublishCodeCoverageResults@1 - condition: and(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['JavaTestVersion'], '1.11')) - inputs: - codeCoverageTool: JaCoCo - summaryFileLocation: sdk/communication/target/site/jacoco-aggregate/jacoco.xml - reportDirectory: sdk/communication/target/site/jacoco-aggregate/ - failIfCoverageEmpty: false - EnvVars: - SKIP_PHONENUMBER_INTEGRATION_TESTS: TRUE - SKIP_LIVE_TEST: TRUE - TEST_PACKAGES_ENABLED: ${{ parameters.TestPackagesEnabled }} From b26abbb80c5e698ac512ac4834bef6ba1653af29 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 1 Jun 2021 13:47:13 -0400 Subject: [PATCH 06/53] [Automation] Generate Fluent Lite from deviceprovisioningservices#package-2020-03 (#21938) Co-authored-by: timtay-microsoft --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 103 + .../pom.xml | 116 + .../IotDpsManager.java | 239 + .../fluent/DpsCertificatesClient.java | 312 ++ .../fluent/IotDpsClient.java | 67 + .../fluent/IotDpsResourcesClient.java | 765 +++ .../fluent/OperationsClient.java | 38 + .../models/AsyncOperationResultInner.java | 80 + .../CertificateListDescriptionInner.java | 54 + .../models/CertificateResponseInner.java | 70 + .../models/GroupIdInformationInner.java | 104 + .../models/IotDpsSkuDefinitionInner.java | 51 + .../models/NameAvailabilityInfoInner.java | 103 + .../fluent/models/OperationInner.java | 69 + .../PrivateEndpointConnectionInner.java | 60 + .../models/PrivateLinkResourcesInner.java | 54 + .../ProvisioningServiceDescriptionInner.java | 140 + ...AccessSignatureAuthorizationRuleInner.java | 141 + .../models/VerificationCodeResponseInner.java | 70 + .../fluent/models/package-info.java | 9 + .../fluent/package-info.java | 9 + .../AsyncOperationResultImpl.java | 38 + .../CertificateListDescriptionImpl.java | 48 + .../CertificateResponseImpl.java | 203 + .../DpsCertificatesClientImpl.java | 1984 ++++++++ .../implementation/DpsCertificatesImpl.java | 425 ++ .../GroupIdInformationImpl.java | 46 + .../implementation/IotDpsClientBuilder.java | 146 + .../implementation/IotDpsClientImpl.java | 321 ++ .../IotDpsResourcesClientImpl.java | 4158 +++++++++++++++++ .../implementation/IotDpsResourcesImpl.java | 601 +++ .../IotDpsSkuDefinitionImpl.java | 34 + .../NameAvailabilityInfoImpl.java | 42 + .../implementation/OperationImpl.java | 37 + .../implementation/OperationsClientImpl.java | 269 ++ .../implementation/OperationsImpl.java | 47 + .../PrivateEndpointConnectionImpl.java | 142 + .../PrivateLinkResourcesImpl.java | 48 + .../ProvisioningServiceDescriptionImpl.java | 214 + ...dAccessSignatureAuthorizationRuleImpl.java | 46 + .../implementation/Utils.java | 204 + .../VerificationCodeResponseImpl.java | 50 + .../implementation/package-info.java | 9 + .../models/AccessRightsDescription.java | 46 + .../models/AllocationPolicy.java | 37 + .../models/AsyncOperationResult.java | 32 + .../models/CertificateBodyDescription.java | 53 + .../models/CertificateListDescription.java | 26 + .../models/CertificateProperties.java | 142 + .../models/CertificatePurpose.java | 34 + .../models/CertificateResponse.java | 185 + .../models/DpsCertificates.java | 327 ++ .../models/ErrorDetails.java | 40 + .../models/ErrorDetailsException.java | 37 + .../models/ErrorMesssage.java | 102 + .../models/GroupIdInformation.java | 45 + .../models/GroupIdInformationProperties.java | 103 + .../models/IotDpsPropertiesDescription.java | 297 ++ .../models/IotDpsResources.java | 532 +++ .../models/IotDpsSku.java | 31 + .../models/IotDpsSkuDefinition.java | 25 + .../models/IotDpsSkuDefinitionListResult.java | 70 + .../models/IotDpsSkuInfo.java | 91 + .../models/IotHubDefinitionDescription.java | 155 + .../models/IpFilterActionType.java | 47 + .../models/IpFilterRule.java | 144 + .../models/IpFilterTargetType.java | 50 + .../models/NameAvailabilityInfo.java | 39 + .../models/NameUnavailabilityReason.java | 34 + .../models/Operation.java | 31 + .../models/OperationDisplay.java | 69 + .../models/OperationInputs.java | 55 + .../models/OperationListResult.java | 63 + .../models/Operations.java | 33 + .../models/PrivateEndpoint.java | 39 + .../models/PrivateEndpointConnection.java | 153 + .../PrivateEndpointConnectionProperties.java | 89 + .../models/PrivateLinkResources.java | 26 + .../PrivateLinkServiceConnectionState.java | 114 + .../PrivateLinkServiceConnectionStatus.java | 40 + .../ProvisioningServiceDescription.java | 272 ++ ...visioningServiceDescriptionListResult.java | 70 + .../models/PublicNetworkAccess.java | 34 + ...haredAccessSignatureAuthorizationRule.java | 47 + ...sSignatureAuthorizationRuleListResult.java | 72 + .../models/State.java | 64 + .../models/TagsResource.java | 54 + .../models/VerificationCodeRequest.java | 51 + .../models/VerificationCodeResponse.java | 53 + .../VerificationCodeResponseProperties.java | 234 + .../models/package-info.java | 9 + .../package-info.java | 9 + .../src/main/java/module-info.java | 19 + .../AllocationPolicyTests.java | 80 + .../CertificatesTests.java | 98 + .../deviceprovisioningservices/Constants.java | 48 + ...ceProvisioningResourceManagementTests.java | 150 + .../DeviceProvisioningTestBase.java | 98 + .../LinkedHubTests.java | 82 + .../SharedAccessPolicyTests.java | 117 + sdk/deviceprovisioningservices/ci.yml | 33 + sdk/deviceprovisioningservices/pom.xml | 53 + 105 files changed, 16956 insertions(+) create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/CHANGELOG.md create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/README.md create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/IotDpsManager.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/DpsCertificatesClient.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsClient.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsResourcesClient.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/OperationsClient.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/AsyncOperationResultInner.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateListDescriptionInner.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateResponseInner.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/GroupIdInformationInner.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/IotDpsSkuDefinitionInner.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/NameAvailabilityInfoInner.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/OperationInner.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateEndpointConnectionInner.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateLinkResourcesInner.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/ProvisioningServiceDescriptionInner.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/SharedAccessSignatureAuthorizationRuleInner.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/VerificationCodeResponseInner.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/package-info.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/package-info.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/AsyncOperationResultImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateListDescriptionImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateResponseImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesClientImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/GroupIdInformationImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientBuilder.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesClientImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsSkuDefinitionImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/NameAvailabilityInfoImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsClientImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateEndpointConnectionImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateLinkResourcesImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/ProvisioningServiceDescriptionImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/SharedAccessSignatureAuthorizationRuleImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/Utils.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/VerificationCodeResponseImpl.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/package-info.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AccessRightsDescription.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AllocationPolicy.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AsyncOperationResult.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateBodyDescription.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateListDescription.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateProperties.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificatePurpose.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateResponse.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/DpsCertificates.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetails.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetailsException.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorMesssage.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformation.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformationProperties.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsPropertiesDescription.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsResources.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSku.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinition.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinitionListResult.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuInfo.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotHubDefinitionDescription.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterActionType.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterRule.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterTargetType.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameAvailabilityInfo.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameUnavailabilityReason.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/Operation.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationDisplay.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationInputs.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationListResult.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/Operations.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpoint.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnection.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnectionProperties.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkResources.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionState.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionStatus.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescription.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescriptionListResult.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PublicNetworkAccess.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRule.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRuleListResult.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/State.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/TagsResource.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeRequest.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponse.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponseProperties.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/package-info.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/package-info.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/module-info.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/AllocationPolicyTests.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/CertificatesTests.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/Constants.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/DeviceProvisioningResourceManagementTests.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/DeviceProvisioningTestBase.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/LinkedHubTests.java create mode 100644 sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/SharedAccessPolicyTests.java create mode 100644 sdk/deviceprovisioningservices/ci.yml create mode 100644 sdk/deviceprovisioningservices/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 1fb5339b7ef0..9d103cf6e917 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -297,6 +297,7 @@ com.azure.resourcemanager:azure-resourcemanager-imagebuilder;1.0.0-beta.1;1.0.0- com.azure.resourcemanager:azure-resourcemanager-maps;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-botservice;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-recoveryservicesbackup;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-deviceprovisioningservices;1.0.0;1.0.0 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index 593ffcb08189..d3353927eb83 100644 --- a/pom.xml +++ b/pom.xml @@ -732,6 +732,7 @@ sdk/datamigration sdk/delegatednetwork sdk/deploymentmanager + sdk/deviceprovisioningservices sdk/deviceupdate sdk/devspaces sdk/devtestlabs diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/CHANGELOG.md b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/CHANGELOG.md new file mode 100644 index 000000000000..ed9f890b1cfa --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0 (2021-05-28) + +Initial release of the Java Resource Management SDK for Device Provisioning Service. diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/README.md b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/README.md new file mode 100644 index 000000000000..1d00d32a7512 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/README.md @@ -0,0 +1,103 @@ +# Azure Resource Manager IotDps client library for Java + +Azure Resource Manager IotDps client library for Java. + +This package contains Microsoft Azure SDK for IotDps Management SDK. API for using the Azure IoT Hub Device Provisioning Service features. Package tag package-2020-03. 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] +- [Service documentation][service_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-deviceprovisioningservices;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-deviceprovisioningservices + 1.0.0 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +IotDpsManager manager = IotDpsManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md +[service_docs]: https://docs.microsoft.com/azure/iot-dps diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml new file mode 100644 index 000000000000..8dbf83e7e31c --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml @@ -0,0 +1,116 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-deviceprovisioningservices + 1.0.0 + jar + + Microsoft Azure SDK for IotDps Management + This package contains Microsoft Azure SDK for IotDps Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API for using the Azure IoT Hub Device Provisioning Service features. Package tag package-2020-03. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.16.0 + + + com.azure + azure-core-management + 1.2.2 + + + com.azure + azure-identity + 1.3.0 + test + + + com.azure.resourcemanager + azure-resourcemanager-resources + 2.5.0 + test + + + com.azure + azure-core-test + 1.6.2 + test + + + org.slf4j + slf4j-simple + 1.7.30 + test + + + com.azure.resourcemanager + azure-resourcemanager-iothub + 1.0.0 + test + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/IotDpsManager.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/IotDpsManager.java new file mode 100644 index 000000000000..52876007565c --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/IotDpsManager.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.IotDpsClient; +import com.azure.resourcemanager.deviceprovisioningservices.implementation.DpsCertificatesImpl; +import com.azure.resourcemanager.deviceprovisioningservices.implementation.IotDpsClientBuilder; +import com.azure.resourcemanager.deviceprovisioningservices.implementation.IotDpsResourcesImpl; +import com.azure.resourcemanager.deviceprovisioningservices.implementation.OperationsImpl; +import com.azure.resourcemanager.deviceprovisioningservices.models.DpsCertificates; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsResources; +import com.azure.resourcemanager.deviceprovisioningservices.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to IotDpsManager. API for using the Azure IoT Hub Device Provisioning Service features. */ +public final class IotDpsManager { + private Operations operations; + + private DpsCertificates dpsCertificates; + + private IotDpsResources iotDpsResources; + + private final IotDpsClient clientObject; + + private IotDpsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new IotDpsClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of IotDps service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the IotDps service API instance. + */ + public static IotDpsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create IotDpsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new IotDpsManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of IotDps service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the IotDps service API instance. + */ + public IotDpsManager 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.deviceprovisioningservices") + .append("/") + .append("1.0.0"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new IotDpsManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of DpsCertificates. */ + public DpsCertificates dpsCertificates() { + if (this.dpsCertificates == null) { + this.dpsCertificates = new DpsCertificatesImpl(clientObject.getDpsCertificates(), this); + } + return dpsCertificates; + } + + /** @return Resource collection API of IotDpsResources. */ + public IotDpsResources iotDpsResources() { + if (this.iotDpsResources == null) { + this.iotDpsResources = new IotDpsResourcesImpl(clientObject.getIotDpsResources(), this); + } + return iotDpsResources; + } + + /** + * @return Wrapped service client IotDpsClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public IotDpsClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/DpsCertificatesClient.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/DpsCertificatesClient.java new file mode 100644 index 000000000000..afb767fd3bf1 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/DpsCertificatesClient.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateListDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.VerificationCodeResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateBodyDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificatePurpose; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeRequest; +import java.time.OffsetDateTime; + +/** An instance of this class provides access to all the operations defined in DpsCertificatesClient. */ +public interface DpsCertificatesClient { + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateResponseInner get(String certificateName, String resourceGroupName, String provisioningServiceName); + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String certificateName, + String resourceGroupName, + String provisioningServiceName, + String ifMatch, + Context context); + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateResponseInner createOrUpdate( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription); + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription, + String ifMatch, + Context context); + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 ifMatch, String provisioningServiceName, String certificateName); + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateListDescriptionInner list(String resourceGroupName, String provisioningServiceName); + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + String resourceGroupName, String provisioningServiceName, Context context); + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VerificationCodeResponseInner generateVerificationCode( + String certificateName, String ifMatch, String resourceGroupName, String provisioningServiceName); + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Description mentioning the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response generateVerificationCodeWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateResponseInner verifyCertificate( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request); + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Describe the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response verifyCertificateWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsClient.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsClient.java new file mode 100644 index 000000000000..139d7f710e8f --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsClient.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.deviceprovisioningservices.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for IotDpsClient class. */ +public interface IotDpsClient { + /** + * Gets The subscription identifier. + * + * @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 DpsCertificatesClient object to access its operations. + * + * @return the DpsCertificatesClient object. + */ + DpsCertificatesClient getDpsCertificates(); + + /** + * Gets the IotDpsResourcesClient object to access its operations. + * + * @return the IotDpsResourcesClient object. + */ + IotDpsResourcesClient getIotDpsResources(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsResourcesClient.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsResourcesClient.java new file mode 100644 index 000000000000..a923b0469250 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/IotDpsResourcesClient.java @@ -0,0 +1,765 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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.deviceprovisioningservices.fluent.models.AsyncOperationResultInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.NameAvailabilityInfoInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateLinkResourcesInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.OperationInputs; +import com.azure.resourcemanager.deviceprovisioningservices.models.TagsResource; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in IotDpsResourcesClient. */ +public interface IotDpsResourcesClient { + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProvisioningServiceDescriptionInner getByResourceGroup(String resourceGroupName, String provisioningServiceName); + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String provisioningServiceName, Context context); + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ProvisioningServiceDescriptionInner> + beginCreateOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription); + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ProvisioningServiceDescriptionInner> + beginCreateOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + Context context); + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProvisioningServiceDescriptionInner createOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription); + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProvisioningServiceDescriptionInner createOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + Context context); + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ProvisioningServiceDescriptionInner> beginUpdate( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags); + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ProvisioningServiceDescriptionInner> beginUpdate( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + Context context); + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProvisioningServiceDescriptionInner update( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags); + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProvisioningServiceDescriptionInner update( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + Context context); + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String provisioningServiceName); + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String provisioningServiceName, Context context); + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioningServiceName); + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioningServiceName, Context context); + + /** + * List all the provisioning services for a given subscription id. + * + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all the provisioning services for a given subscription id. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AsyncOperationResultInner getOperationResult( + String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo); + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getOperationResultWithResponse( + String operationId, + String resourceGroupName, + String provisioningServiceName, + String asyncinfo, + Context context); + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listValidSkus(String provisioningServiceName, String resourceGroupName); + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listValidSkus( + String provisioningServiceName, String resourceGroupName, Context context); + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NameAvailabilityInfoInner checkProvisioningServiceNameAvailability(OperationInputs arguments); + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkProvisioningServiceNameAvailabilityWithResponse( + OperationInputs arguments, Context context); + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName); + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName, Context context); + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedAccessSignatureAuthorizationRuleInner listKeysForKeyName( + String provisioningServiceName, String keyName, String resourceGroupName); + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listKeysForKeyNameWithResponse( + String provisioningServiceName, String keyName, String resourceGroupName, Context context); + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourcesInner listPrivateLinkResources(String resourceGroupName, String resourceName); + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GroupIdInformationInner getPrivateLinkResources(String resourceGroupName, String resourceName, String groupId); + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, String groupId, Context context); + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listPrivateEndpointConnections(String resourceGroupName, String resourceName); + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listPrivateEndpointConnectionsWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner getPrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName); + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getPrivateEndpointConnectionWithResponse( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> + beginCreateOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> + beginCreateOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context); + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context); + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> + beginDeletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName); + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> + beginDeletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName); + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/OperationsClient.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/OperationsClient.java new file mode 100644 index 000000000000..8d9a1c355f52 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/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.deviceprovisioningservices.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.deviceprovisioningservices.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/AsyncOperationResultInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/AsyncOperationResultInner.java new file mode 100644 index 000000000000..fec8a52bc5d1 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/AsyncOperationResultInner.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.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorMesssage; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Result of a long running operation. */ +@Fluent +public final class AsyncOperationResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AsyncOperationResultInner.class); + + /* + * current status of a long running operation. + */ + @JsonProperty(value = "status") + private String status; + + /* + * Error message containing code, description and details + */ + @JsonProperty(value = "error") + private ErrorMesssage error; + + /** + * Get the status property: current status of a long running operation. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: current status of a long running operation. + * + * @param status the status value to set. + * @return the AsyncOperationResultInner object itself. + */ + public AsyncOperationResultInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the error property: Error message containing code, description and details. + * + * @return the error value. + */ + public ErrorMesssage error() { + return this.error; + } + + /** + * Set the error property: Error message containing code, description and details. + * + * @param error the error value to set. + * @return the AsyncOperationResultInner object itself. + */ + public AsyncOperationResultInner withError(ErrorMesssage error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateListDescriptionInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateListDescriptionInner.java new file mode 100644 index 000000000000..8384ff271ae5 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateListDescriptionInner.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.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JSON-serialized array of Certificate objects. */ +@Fluent +public final class CertificateListDescriptionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateListDescriptionInner.class); + + /* + * The array of Certificate objects. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The array of Certificate objects. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of Certificate objects. + * + * @param value the value value to set. + * @return the CertificateListDescriptionInner object itself. + */ + public CertificateListDescriptionInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateResponseInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateResponseInner.java new file mode 100644 index 000000000000..17f4d9285913 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/CertificateResponseInner.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The X509 Certificate. */ +@Fluent +public final class CertificateResponseInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateResponseInner.class); + + /* + * properties of a certificate + */ + @JsonProperty(value = "properties") + private CertificateProperties properties; + + /* + * The entity tag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the properties property: properties of a certificate. + * + * @return the properties value. + */ + public CertificateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: properties of a certificate. + * + * @param properties the properties value to set. + * @return the CertificateResponseInner object itself. + */ + public CertificateResponseInner withProperties(CertificateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the etag property: The entity tag. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/GroupIdInformationInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/GroupIdInformationInner.java new file mode 100644 index 000000000000..ee3aa273bb24 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/GroupIdInformationInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.GroupIdInformationProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The group information for creating a private endpoint on a provisioning service. */ +@Fluent +public final class GroupIdInformationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GroupIdInformationInner.class); + + /* + * The resource identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The properties for a group information object + */ + @JsonProperty(value = "properties", required = true) + private GroupIdInformationProperties properties; + + /** + * Get the id property: The resource identifier. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the properties property: The properties for a group information object. + * + * @return the properties value. + */ + public GroupIdInformationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties for a group information object. + * + * @param properties the properties value to set. + * @return the GroupIdInformationInner object itself. + */ + public GroupIdInformationInner withProperties(GroupIdInformationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model GroupIdInformationInner")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/IotDpsSkuDefinitionInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/IotDpsSkuDefinitionInner.java new file mode 100644 index 000000000000..03df05de4b88 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/IotDpsSkuDefinitionInner.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.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Available SKUs of tier and units. */ +@Fluent +public final class IotDpsSkuDefinitionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotDpsSkuDefinitionInner.class); + + /* + * Sku name. + */ + @JsonProperty(value = "name") + private IotDpsSku name; + + /** + * Get the name property: Sku name. + * + * @return the name value. + */ + public IotDpsSku name() { + return this.name; + } + + /** + * Set the name property: Sku name. + * + * @param name the name value to set. + * @return the IotDpsSkuDefinitionInner object itself. + */ + public IotDpsSkuDefinitionInner withName(IotDpsSku name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/NameAvailabilityInfoInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/NameAvailabilityInfoInner.java new file mode 100644 index 000000000000..edb9361c47f2 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/NameAvailabilityInfoInner.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.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.NameUnavailabilityReason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Description of name availability. */ +@Fluent +public final class NameAvailabilityInfoInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityInfoInner.class); + + /* + * specifies if a name is available or not + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * specifies the reason a name is unavailable + */ + @JsonProperty(value = "reason") + private NameUnavailabilityReason reason; + + /* + * message containing a detailed reason name is unavailable + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the nameAvailable property: specifies if a name is available or not. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: specifies if a name is available or not. + * + * @param nameAvailable the nameAvailable value to set. + * @return the NameAvailabilityInfoInner object itself. + */ + public NameAvailabilityInfoInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: specifies the reason a name is unavailable. + * + * @return the reason value. + */ + public NameUnavailabilityReason reason() { + return this.reason; + } + + /** + * Set the reason property: specifies the reason a name is unavailable. + * + * @param reason the reason value to set. + * @return the NameAvailabilityInfoInner object itself. + */ + public NameAvailabilityInfoInner withReason(NameUnavailabilityReason reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: message containing a detailed reason name is unavailable. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: message containing a detailed reason name is unavailable. + * + * @param message the message value to set. + * @return the NameAvailabilityInfoInner object itself. + */ + public NameAvailabilityInfoInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/OperationInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/OperationInner.java new file mode 100644 index 000000000000..db024a14b8f1 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/OperationInner.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Provisioning Service REST API operation. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Operation name: {provider}/{resource}/{read | write | action | delete} + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name property: Operation name: {provider}/{resource}/{read | write | action | delete}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that represents the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateEndpointConnectionInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 000000000000..8763a68b2cd4 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.PrivateEndpointConnectionProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The private endpoint connection of a provisioning service. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionInner.class); + + /* + * The properties of a private endpoint connection + */ + @JsonProperty(value = "properties", required = true) + private PrivateEndpointConnectionProperties properties; + + /** + * Get the properties property: The properties of a private endpoint connection. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of a private endpoint connection. + * + * @param properties the properties value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withProperties(PrivateEndpointConnectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model PrivateEndpointConnectionInner")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateLinkResourcesInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateLinkResourcesInner.java new file mode 100644 index 000000000000..ef5e59a6fee6 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/PrivateLinkResourcesInner.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.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The available private link resources for a provisioning service. */ +@Fluent +public final class PrivateLinkResourcesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesInner.class); + + /* + * The list of available private link resources for a provisioning service + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of available private link resources for a provisioning service. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of available private link resources for a provisioning service. + * + * @param value the value value to set. + * @return the PrivateLinkResourcesInner object itself. + */ + public PrivateLinkResourcesInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/ProvisioningServiceDescriptionInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/ProvisioningServiceDescriptionInner.java new file mode 100644 index 000000000000..8146e3b23c53 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/ProvisioningServiceDescriptionInner.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsPropertiesDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSkuInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The description of the provisioning service. */ +@Fluent +public final class ProvisioningServiceDescriptionInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProvisioningServiceDescriptionInner.class); + + /* + * The Etag field is *not* required. If it is provided in the response + * body, it must also be provided as a header per the normal ETag + * convention. + */ + @JsonProperty(value = "etag") + private String etag; + + /* + * Service specific properties for a provisioning service + */ + @JsonProperty(value = "properties", required = true) + private IotDpsPropertiesDescription properties; + + /* + * Sku info for a provisioning Service. + */ + @JsonProperty(value = "sku", required = true) + private IotDpsSkuInfo sku; + + /** + * Get the etag property: The Etag field is *not* required. If it is provided in the response body, it must also be + * provided as a header per the normal ETag convention. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag field is *not* required. If it is provided in the response body, it must also be + * provided as a header per the normal ETag convention. + * + * @param etag the etag value to set. + * @return the ProvisioningServiceDescriptionInner object itself. + */ + public ProvisioningServiceDescriptionInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the properties property: Service specific properties for a provisioning service. + * + * @return the properties value. + */ + public IotDpsPropertiesDescription properties() { + return this.properties; + } + + /** + * Set the properties property: Service specific properties for a provisioning service. + * + * @param properties the properties value to set. + * @return the ProvisioningServiceDescriptionInner object itself. + */ + public ProvisioningServiceDescriptionInner withProperties(IotDpsPropertiesDescription properties) { + this.properties = properties; + return this; + } + + /** + * Get the sku property: Sku info for a provisioning Service. + * + * @return the sku value. + */ + public IotDpsSkuInfo sku() { + return this.sku; + } + + /** + * Set the sku property: Sku info for a provisioning Service. + * + * @param sku the sku value to set. + * @return the ProvisioningServiceDescriptionInner object itself. + */ + public ProvisioningServiceDescriptionInner withSku(IotDpsSkuInfo sku) { + this.sku = sku; + return this; + } + + /** {@inheritDoc} */ + @Override + public ProvisioningServiceDescriptionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ProvisioningServiceDescriptionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model ProvisioningServiceDescriptionInner")); + } else { + properties().validate(); + } + if (sku() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sku in model ProvisioningServiceDescriptionInner")); + } else { + sku().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/SharedAccessSignatureAuthorizationRuleInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/SharedAccessSignatureAuthorizationRuleInner.java new file mode 100644 index 000000000000..ca8d2b11b673 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/SharedAccessSignatureAuthorizationRuleInner.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.AccessRightsDescription; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Description of the shared access key. */ +@Fluent +public final class SharedAccessSignatureAuthorizationRuleInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedAccessSignatureAuthorizationRuleInner.class); + + /* + * Name of the key. + */ + @JsonProperty(value = "keyName", required = true) + private String keyName; + + /* + * Primary SAS key value. + */ + @JsonProperty(value = "primaryKey") + private String primaryKey; + + /* + * Secondary SAS key value. + */ + @JsonProperty(value = "secondaryKey") + private String secondaryKey; + + /* + * Rights that this key has. + */ + @JsonProperty(value = "rights", required = true) + private AccessRightsDescription rights; + + /** + * Get the keyName property: Name of the key. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName property: Name of the key. + * + * @param keyName the keyName value to set. + * @return the SharedAccessSignatureAuthorizationRuleInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleInner withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the primaryKey property: Primary SAS key value. + * + * @return the primaryKey value. + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Set the primaryKey property: Primary SAS key value. + * + * @param primaryKey the primaryKey value to set. + * @return the SharedAccessSignatureAuthorizationRuleInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleInner withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get the secondaryKey property: Secondary SAS key value. + * + * @return the secondaryKey value. + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set the secondaryKey property: Secondary SAS key value. + * + * @param secondaryKey the secondaryKey value to set. + * @return the SharedAccessSignatureAuthorizationRuleInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleInner withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get the rights property: Rights that this key has. + * + * @return the rights value. + */ + public AccessRightsDescription rights() { + return this.rights; + } + + /** + * Set the rights property: Rights that this key has. + * + * @param rights the rights value to set. + * @return the SharedAccessSignatureAuthorizationRuleInner object itself. + */ + public SharedAccessSignatureAuthorizationRuleInner withRights(AccessRightsDescription rights) { + this.rights = rights; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property keyName in model SharedAccessSignatureAuthorizationRuleInner")); + } + if (rights() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property rights in model SharedAccessSignatureAuthorizationRuleInner")); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/VerificationCodeResponseInner.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/VerificationCodeResponseInner.java new file mode 100644 index 000000000000..0ba30315dc40 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/VerificationCodeResponseInner.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeResponseProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Description of the response of the verification code. */ +@Fluent +public final class VerificationCodeResponseInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VerificationCodeResponseInner.class); + + /* + * Request etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private VerificationCodeResponseProperties properties; + + /** + * Get the etag property: Request etag. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public VerificationCodeResponseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the VerificationCodeResponseInner object itself. + */ + public VerificationCodeResponseInner withProperties(VerificationCodeResponseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/package-info.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/package-info.java new file mode 100644 index 000000000000..8c49d558e8e2 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for IotDpsClient. API for using the Azure IoT Hub Device Provisioning + * Service features. + */ +package com.azure.resourcemanager.deviceprovisioningservices.fluent.models; diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/package-info.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/package-info.java new file mode 100644 index 000000000000..80be674d46c5 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for IotDpsClient. API for using the Azure IoT Hub Device Provisioning Service + * features. + */ +package com.azure.resourcemanager.deviceprovisioningservices.fluent; diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/AsyncOperationResultImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/AsyncOperationResultImpl.java new file mode 100644 index 000000000000..092f2aa20f3e --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/AsyncOperationResultImpl.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.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.AsyncOperationResultInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.AsyncOperationResult; +import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorMesssage; + +public final class AsyncOperationResultImpl implements AsyncOperationResult { + private AsyncOperationResultInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + AsyncOperationResultImpl( + AsyncOperationResultInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String status() { + return this.innerModel().status(); + } + + public ErrorMesssage error() { + return this.innerModel().error(); + } + + public AsyncOperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateListDescriptionImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateListDescriptionImpl.java new file mode 100644 index 000000000000..fc152f565908 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateListDescriptionImpl.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.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateListDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateListDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateResponse; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class CertificateListDescriptionImpl implements CertificateListDescription { + private CertificateListDescriptionInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + CertificateListDescriptionImpl( + CertificateListDescriptionInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new CertificateResponseImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public CertificateListDescriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateResponseImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateResponseImpl.java new file mode 100644 index 000000000000..99569d2f2691 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/CertificateResponseImpl.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateBodyDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateProperties; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateResponse; + +public final class CertificateResponseImpl + implements CertificateResponse, CertificateResponse.Definition, CertificateResponse.Update { + private CertificateResponseInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public CertificateProperties properties() { + return this.innerModel().properties(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public CertificateResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String provisioningServiceName; + + private String certificateName; + + private String createIfMatch; + + private CertificateBodyDescription createCertificateDescription; + + private String updateIfMatch; + + private CertificateBodyDescription updateCertificateDescription; + + public CertificateResponseImpl withExistingProvisioningService( + String resourceGroupName, String provisioningServiceName) { + this.resourceGroupName = resourceGroupName; + this.provisioningServiceName = provisioningServiceName; + return this; + } + + public CertificateResponse create() { + this.innerObject = + serviceManager + .serviceClient() + .getDpsCertificates() + .createOrUpdateWithResponse( + resourceGroupName, + provisioningServiceName, + certificateName, + createCertificateDescription, + createIfMatch, + Context.NONE) + .getValue(); + return this; + } + + public CertificateResponse create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDpsCertificates() + .createOrUpdateWithResponse( + resourceGroupName, + provisioningServiceName, + certificateName, + createCertificateDescription, + createIfMatch, + context) + .getValue(); + return this; + } + + CertificateResponseImpl( + String name, com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = new CertificateResponseInner(); + this.serviceManager = serviceManager; + this.certificateName = name; + this.createIfMatch = null; + this.createCertificateDescription = new CertificateBodyDescription(); + } + + public CertificateResponseImpl update() { + this.updateIfMatch = null; + this.updateCertificateDescription = new CertificateBodyDescription(); + return this; + } + + public CertificateResponse apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDpsCertificates() + .createOrUpdateWithResponse( + resourceGroupName, + provisioningServiceName, + certificateName, + updateCertificateDescription, + updateIfMatch, + Context.NONE) + .getValue(); + return this; + } + + public CertificateResponse apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDpsCertificates() + .createOrUpdateWithResponse( + resourceGroupName, + provisioningServiceName, + certificateName, + updateCertificateDescription, + updateIfMatch, + context) + .getValue(); + return this; + } + + CertificateResponseImpl( + CertificateResponseInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.provisioningServiceName = Utils.getValueFromIdByName(innerObject.id(), "provisioningServices"); + this.certificateName = Utils.getValueFromIdByName(innerObject.id(), "certificates"); + } + + public CertificateResponse refresh() { + String localIfMatch = null; + this.innerObject = + serviceManager + .serviceClient() + .getDpsCertificates() + .getWithResponse( + certificateName, resourceGroupName, provisioningServiceName, localIfMatch, Context.NONE) + .getValue(); + return this; + } + + public CertificateResponse refresh(Context context) { + String localIfMatch = null; + this.innerObject = + serviceManager + .serviceClient() + .getDpsCertificates() + .getWithResponse(certificateName, resourceGroupName, provisioningServiceName, localIfMatch, context) + .getValue(); + return this; + } + + public CertificateResponseImpl withCertificate(String certificate) { + if (isInCreateMode()) { + this.createCertificateDescription.withCertificate(certificate); + return this; + } else { + this.updateCertificateDescription.withCertificate(certificate); + return this; + } + } + + public CertificateResponseImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.createIfMatch = ifMatch; + return this; + } else { + this.updateIfMatch = ifMatch; + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesClientImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesClientImpl.java new file mode 100644 index 000000000000..b5a1f8362807 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesClientImpl.java @@ -0,0 +1,1984 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Base64Util; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.DpsCertificatesClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateListDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.VerificationCodeResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateBodyDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificatePurpose; +import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeRequest; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DpsCertificatesClient. */ +public final class DpsCertificatesClientImpl implements DpsCertificatesClient { + private final ClientLogger logger = new ClientLogger(DpsCertificatesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DpsCertificatesService service; + + /** The service client containing this operation class. */ + private final IotDpsClientImpl client; + + /** + * Initializes an instance of DpsCertificatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DpsCertificatesClientImpl(IotDpsClientImpl client) { + this.service = + RestProxy.create(DpsCertificatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotDpsClientDpsCertificates to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotDpsClientDpsCerti") + private interface DpsCertificatesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/certificates/{certificateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("certificateName") String certificateName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @HeaderParam("If-Match") String ifMatch, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/certificates/{certificateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @PathParam("certificateName") String certificateName, + @HeaderParam("If-Match") String ifMatch, + @BodyParam("application/json") CertificateBodyDescription certificateDescription, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/certificates/{certificateName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("If-Match") String ifMatch, + @PathParam("provisioningServiceName") String provisioningServiceName, + @PathParam("certificateName") String certificateName, + @QueryParam("certificate.name") String certificateName1, + @QueryParam("certificate.rawBytes") String certificateRawBytes, + @QueryParam("certificate.isVerified") Boolean certificateIsVerified, + @QueryParam("certificate.purpose") CertificatePurpose certificatePurpose, + @QueryParam("certificate.created") OffsetDateTime certificateCreated, + @QueryParam("certificate.lastUpdated") OffsetDateTime certificateLastUpdated, + @QueryParam("certificate.hasPrivateKey") Boolean certificateHasPrivateKey, + @QueryParam("certificate.nonce") String certificateNonce, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/certificates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/certificates/{certificateName}" + + "/generateVerificationCode") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> generateVerificationCode( + @HostParam("$host") String endpoint, + @PathParam("certificateName") String certificateName, + @HeaderParam("If-Match") String ifMatch, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("certificate.name") String certificateName1, + @QueryParam("certificate.rawBytes") String certificateRawBytes, + @QueryParam("certificate.isVerified") Boolean certificateIsVerified, + @QueryParam("certificate.purpose") CertificatePurpose certificatePurpose, + @QueryParam("certificate.created") OffsetDateTime certificateCreated, + @QueryParam("certificate.lastUpdated") OffsetDateTime certificateLastUpdated, + @QueryParam("certificate.hasPrivateKey") Boolean certificateHasPrivateKey, + @QueryParam("certificate.nonce") String certificateNonce, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/verify") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> verifyCertificate( + @HostParam("$host") String endpoint, + @PathParam("certificateName") String certificateName, + @HeaderParam("If-Match") String ifMatch, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("certificate.name") String certificateName1, + @QueryParam("certificate.rawBytes") String certificateRawBytes, + @QueryParam("certificate.isVerified") Boolean certificateIsVerified, + @QueryParam("certificate.purpose") CertificatePurpose certificatePurpose, + @QueryParam("certificate.created") OffsetDateTime certificateCreated, + @QueryParam("certificate.lastUpdated") OffsetDateTime certificateLastUpdated, + @QueryParam("certificate.hasPrivateKey") Boolean certificateHasPrivateKey, + @QueryParam("certificate.nonce") String certificateNonce, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VerificationCodeRequest request, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + certificateName, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + ifMatch, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String certificateName, + String resourceGroupName, + String provisioningServiceName, + String ifMatch, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + certificateName, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + ifMatch, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String certificateName, String resourceGroupName, String provisioningServiceName, String ifMatch) { + return getWithResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String certificateName, String resourceGroupName, String provisioningServiceName) { + final String ifMatch = null; + return getWithResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateResponseInner get( + String certificateName, String resourceGroupName, String provisioningServiceName) { + final String ifMatch = null; + return getAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch).block(); + } + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String certificateName, + String resourceGroupName, + String provisioningServiceName, + String ifMatch, + Context context) { + return getWithResponseAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch, context) + .block(); + } + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription, + String ifMatch) { + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (certificateDescription == null) { + return Mono + .error( + new IllegalArgumentException("Parameter certificateDescription is required and cannot be null.")); + } else { + certificateDescription.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + certificateName, + ifMatch, + certificateDescription, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription, + String ifMatch, + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (certificateDescription == null) { + return Mono + .error( + new IllegalArgumentException("Parameter certificateDescription is required and cannot be null.")); + } else { + certificateDescription.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + certificateName, + ifMatch, + certificateDescription, + accept, + context); + } + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription, + String ifMatch) { + return createOrUpdateWithResponseAsync( + resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription) { + final String ifMatch = null; + return createOrUpdateWithResponseAsync( + resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateResponseInner createOrUpdate( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription) { + final String ifMatch = null; + return createOrUpdateAsync( + resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch) + .block(); + } + + /** + * Add new certificate or update an existing certificate. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName The name of the certificate create or update. + * @param certificateDescription The certificate body. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String provisioningServiceName, + String certificateName, + CertificateBodyDescription certificateDescription, + String ifMatch, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch, context) + .block(); + } + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce) { + 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 (ifMatch == null) { + return Mono.error(new IllegalArgumentException("Parameter ifMatch is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + final String accept = "application/json"; + String certificateRawBytesConverted = Base64Util.encodeToString(certificateRawBytes); + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytesConverted, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + 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 (ifMatch == null) { + return Mono.error(new IllegalArgumentException("Parameter ifMatch is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + final String accept = "application/json"; + String certificateRawBytesConverted = Base64Util.encodeToString(certificateRawBytes); + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytesConverted, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce) { + return deleteWithResponseAsync( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String ifMatch, String provisioningServiceName, String certificateName) { + final String certificateName1 = null; + final byte[] certificateRawBytes = new byte[0]; + final Boolean certificateIsVerified = null; + final CertificatePurpose certificatePurpose = null; + final OffsetDateTime certificateCreated = null; + final OffsetDateTime certificateLastUpdated = null; + final Boolean certificateHasPrivateKey = null; + final String certificateNonce = null; + return deleteWithResponseAsync( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 ifMatch, String provisioningServiceName, String certificateName) { + final String certificateName1 = null; + final byte[] certificateRawBytes = new byte[0]; + final Boolean certificateIsVerified = null; + final CertificatePurpose certificatePurpose = null; + final OffsetDateTime certificateCreated = null; + final OffsetDateTime certificateLastUpdated = null; + final Boolean certificateHasPrivateKey = null; + final String certificateNonce = null; + deleteAsync( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .block(); + } + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context) + .block(); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String provisioningServiceName) { + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String provisioningServiceName, 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceGroupName, String provisioningServiceName) { + return listWithResponseAsync(resourceGroupName, provisioningServiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateListDescriptionInner list(String resourceGroupName, String provisioningServiceName) { + return listAsync(resourceGroupName, provisioningServiceName).block(); + } + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the certificates tied to the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceGroupName, String provisioningServiceName, Context context) { + return listWithResponseAsync(resourceGroupName, provisioningServiceName, context).block(); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Description mentioning the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateVerificationCodeWithResponseAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (ifMatch == null) { + return Mono.error(new IllegalArgumentException("Parameter ifMatch 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + String certificateRawBytesConverted = Base64Util.encodeToString(certificateRawBytes); + return FluxUtil + .withContext( + context -> + service + .generateVerificationCode( + this.client.getEndpoint(), + certificateName, + ifMatch, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytesConverted, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Description mentioning the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateVerificationCodeWithResponseAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (ifMatch == null) { + return Mono.error(new IllegalArgumentException("Parameter ifMatch 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + String certificateRawBytesConverted = Base64Util.encodeToString(certificateRawBytes); + context = this.client.mergeContext(context); + return service + .generateVerificationCode( + this.client.getEndpoint(), + certificateName, + ifMatch, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytesConverted, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Description mentioning the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateVerificationCodeAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce) { + return generateVerificationCodeWithResponseAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateVerificationCodeAsync( + String certificateName, String ifMatch, String resourceGroupName, String provisioningServiceName) { + final String certificateName1 = null; + final byte[] certificateRawBytes = new byte[0]; + final Boolean certificateIsVerified = null; + final CertificatePurpose certificatePurpose = null; + final OffsetDateTime certificateCreated = null; + final OffsetDateTime certificateLastUpdated = null; + final Boolean certificateHasPrivateKey = null; + final String certificateNonce = null; + return generateVerificationCodeWithResponseAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VerificationCodeResponseInner generateVerificationCode( + String certificateName, String ifMatch, String resourceGroupName, String provisioningServiceName) { + final String certificateName1 = null; + final byte[] certificateRawBytes = new byte[0]; + final Boolean certificateIsVerified = null; + final CertificatePurpose certificatePurpose = null; + final OffsetDateTime certificateCreated = null; + final OffsetDateTime certificateLastUpdated = null; + final Boolean certificateHasPrivateKey = null; + final String certificateNonce = null; + return generateVerificationCodeAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .block(); + } + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Description mentioning the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generateVerificationCodeWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + return generateVerificationCodeWithResponseAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context) + .block(); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Describe the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> verifyCertificateWithResponseAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (ifMatch == null) { + return Mono.error(new IllegalArgumentException("Parameter ifMatch 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName 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"; + String certificateRawBytesConverted = Base64Util.encodeToString(certificateRawBytes); + return FluxUtil + .withContext( + context -> + service + .verifyCertificate( + this.client.getEndpoint(), + certificateName, + ifMatch, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytesConverted, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + this.client.getApiVersion(), + request, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Describe the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> verifyCertificateWithResponseAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (ifMatch == null) { + return Mono.error(new IllegalArgumentException("Parameter ifMatch 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName 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"; + String certificateRawBytesConverted = Base64Util.encodeToString(certificateRawBytes); + context = this.client.mergeContext(context); + return service + .verifyCertificate( + this.client.getEndpoint(), + certificateName, + ifMatch, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytesConverted, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + this.client.getApiVersion(), + request, + accept, + context); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Describe the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono verifyCertificateAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce) { + return verifyCertificateWithResponseAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + request, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono verifyCertificateAsync( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request) { + final String certificateName1 = null; + final byte[] certificateRawBytes = new byte[0]; + final Boolean certificateIsVerified = null; + final CertificatePurpose certificatePurpose = null; + final OffsetDateTime certificateCreated = null; + final OffsetDateTime certificateLastUpdated = null; + final Boolean certificateHasPrivateKey = null; + final String certificateNonce = null; + return verifyCertificateWithResponseAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + request, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateResponseInner verifyCertificate( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request) { + final String certificateName1 = null; + final byte[] certificateRawBytes = new byte[0]; + final Boolean certificateIsVerified = null; + final CertificatePurpose certificatePurpose = null; + final OffsetDateTime certificateCreated = null; + final OffsetDateTime certificateLastUpdated = null; + final Boolean certificateHasPrivateKey = null; + final String certificateNonce = null; + return verifyCertificateAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + request, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce) + .block(); + } + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Describe the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyCertificateWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + return verifyCertificateWithResponseAsync( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + request, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context) + .block(); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesImpl.java new file mode 100644 index 000000000000..4557136f8700 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/DpsCertificatesImpl.java @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.DpsCertificatesClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateListDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.VerificationCodeResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateListDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificatePurpose; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateResponse; +import com.azure.resourcemanager.deviceprovisioningservices.models.DpsCertificates; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeRequest; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeResponse; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.OffsetDateTime; + +public final class DpsCertificatesImpl implements DpsCertificates { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DpsCertificatesImpl.class); + + private final DpsCertificatesClient innerClient; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + public DpsCertificatesImpl( + DpsCertificatesClient innerClient, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CertificateResponse get(String certificateName, String resourceGroupName, String provisioningServiceName) { + CertificateResponseInner inner = + this.serviceClient().get(certificateName, resourceGroupName, provisioningServiceName); + if (inner != null) { + return new CertificateResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String certificateName, + String resourceGroupName, + String provisioningServiceName, + String ifMatch, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(certificateName, resourceGroupName, provisioningServiceName, ifMatch, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, String ifMatch, String provisioningServiceName, String certificateName) { + this.serviceClient().delete(resourceGroupName, ifMatch, provisioningServiceName, certificateName); + } + + public Response deleteWithResponse( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context); + } + + public CertificateListDescription list(String resourceGroupName, String provisioningServiceName) { + CertificateListDescriptionInner inner = this.serviceClient().list(resourceGroupName, provisioningServiceName); + if (inner != null) { + return new CertificateListDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String resourceGroupName, String provisioningServiceName, Context context) { + Response inner = + this.serviceClient().listWithResponse(resourceGroupName, provisioningServiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateListDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VerificationCodeResponse generateVerificationCode( + String certificateName, String ifMatch, String resourceGroupName, String provisioningServiceName) { + VerificationCodeResponseInner inner = + this + .serviceClient() + .generateVerificationCode(certificateName, ifMatch, resourceGroupName, provisioningServiceName); + if (inner != null) { + return new VerificationCodeResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response generateVerificationCodeWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + Response inner = + this + .serviceClient() + .generateVerificationCodeWithResponse( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VerificationCodeResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CertificateResponse verifyCertificate( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request) { + CertificateResponseInner inner = + this + .serviceClient() + .verifyCertificate(certificateName, ifMatch, resourceGroupName, provisioningServiceName, request); + if (inner != null) { + return new CertificateResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response verifyCertificateWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context) { + Response inner = + this + .serviceClient() + .verifyCertificateWithResponse( + certificateName, + ifMatch, + resourceGroupName, + provisioningServiceName, + request, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CertificateResponse getById(String id) { + String certificateName = Utils.getValueFromIdByName(id, "certificates"); + if (certificateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificates'.", 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String localIfMatch = null; + return this + .getWithResponse(certificateName, resourceGroupName, provisioningServiceName, localIfMatch, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, String ifMatch, Context context) { + String certificateName = Utils.getValueFromIdByName(id, "certificates"); + if (certificateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificates'.", 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + return this.getWithResponse(certificateName, resourceGroupName, provisioningServiceName, ifMatch, 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String certificateName = Utils.getValueFromIdByName(id, "certificates"); + if (certificateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificates'.", id))); + } + String localIfMatch = null; + String localCertificateName1 = null; + byte[] localCertificateRawBytes = null; + Boolean localCertificateIsVerified = null; + CertificatePurpose localCertificatePurpose = null; + OffsetDateTime localCertificateCreated = null; + OffsetDateTime localCertificateLastUpdated = null; + Boolean localCertificateHasPrivateKey = null; + String localCertificateNonce = null; + this + .deleteWithResponse( + resourceGroupName, + localIfMatch, + provisioningServiceName, + certificateName, + localCertificateName1, + localCertificateRawBytes, + localCertificateIsVerified, + localCertificatePurpose, + localCertificateCreated, + localCertificateLastUpdated, + localCertificateHasPrivateKey, + localCertificateNonce, + Context.NONE) + .getValue(); + } + + public Response deleteByIdWithResponse( + String id, + String ifMatch, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String certificateName = Utils.getValueFromIdByName(id, "certificates"); + if (certificateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificates'.", id))); + } + return this + .deleteWithResponse( + resourceGroupName, + ifMatch, + provisioningServiceName, + certificateName, + certificateName1, + certificateRawBytes, + certificateIsVerified, + certificatePurpose, + certificateCreated, + certificateLastUpdated, + certificateHasPrivateKey, + certificateNonce, + context); + } + + private DpsCertificatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } + + public CertificateResponseImpl define(String name) { + return new CertificateResponseImpl(name, this.manager()); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/GroupIdInformationImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/GroupIdInformationImpl.java new file mode 100644 index 000000000000..2164f4fb1d7a --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/GroupIdInformationImpl.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.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.GroupIdInformation; +import com.azure.resourcemanager.deviceprovisioningservices.models.GroupIdInformationProperties; + +public final class GroupIdInformationImpl implements GroupIdInformation { + private GroupIdInformationInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + GroupIdInformationImpl( + GroupIdInformationInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager 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 GroupIdInformationProperties properties() { + return this.innerModel().properties(); + } + + public GroupIdInformationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientBuilder.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientBuilder.java new file mode 100644 index 000000000000..7d1a86c22847 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the IotDpsClientImpl type. */ +@ServiceClientBuilder(serviceClients = {IotDpsClientImpl.class}) +public final class IotDpsClientBuilder { + /* + * The subscription identifier. + */ + private String subscriptionId; + + /** + * Sets The subscription identifier. + * + * @param subscriptionId the subscriptionId value. + * @return the IotDpsClientBuilder. + */ + public IotDpsClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the IotDpsClientBuilder. + */ + public IotDpsClientBuilder 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 IotDpsClientBuilder. + */ + public IotDpsClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the IotDpsClientBuilder. + */ + public IotDpsClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the IotDpsClientBuilder. + */ + public IotDpsClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the IotDpsClientBuilder. + */ + public IotDpsClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of IotDpsClientImpl with the provided parameters. + * + * @return an instance of IotDpsClientImpl. + */ + public IotDpsClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + IotDpsClientImpl client = + new IotDpsClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientImpl.java new file mode 100644 index 000000000000..2b0b4eb2cb30 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsClientImpl.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.DpsCertificatesClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.IotDpsClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.IotDpsResourcesClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.OperationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the IotDpsClientImpl type. */ +@ServiceClient(builder = IotDpsClientBuilder.class) +public final class IotDpsClientImpl implements IotDpsClient { + private final ClientLogger logger = new ClientLogger(IotDpsClientImpl.class); + + /** The subscription identifier. */ + private final String subscriptionId; + + /** + * Gets The subscription identifier. + * + * @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 DpsCertificatesClient object to access its operations. */ + private final DpsCertificatesClient dpsCertificates; + + /** + * Gets the DpsCertificatesClient object to access its operations. + * + * @return the DpsCertificatesClient object. + */ + public DpsCertificatesClient getDpsCertificates() { + return this.dpsCertificates; + } + + /** The IotDpsResourcesClient object to access its operations. */ + private final IotDpsResourcesClient iotDpsResources; + + /** + * Gets the IotDpsResourcesClient object to access its operations. + * + * @return the IotDpsResourcesClient object. + */ + public IotDpsResourcesClient getIotDpsResources() { + return this.iotDpsResources; + } + + /** + * Initializes an instance of IotDpsClient 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 subscription identifier. + * @param endpoint server parameter. + */ + IotDpsClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2020-03-01"; + this.operations = new OperationsClientImpl(this); + this.dpsCertificates = new DpsCertificatesClientImpl(this); + this.iotDpsResources = new IotDpsResourcesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesClientImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesClientImpl.java new file mode 100644 index 000000000000..3e0199ee9ff6 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesClientImpl.java @@ -0,0 +1,4158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.IotDpsResourcesClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.AsyncOperationResultInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.NameAvailabilityInfoInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateLinkResourcesInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSkuDefinitionListResult; +import com.azure.resourcemanager.deviceprovisioningservices.models.OperationInputs; +import com.azure.resourcemanager.deviceprovisioningservices.models.ProvisioningServiceDescriptionListResult; +import com.azure.resourcemanager.deviceprovisioningservices.models.SharedAccessSignatureAuthorizationRuleListResult; +import com.azure.resourcemanager.deviceprovisioningservices.models.TagsResource; +import java.nio.ByteBuffer; +import java.util.List; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IotDpsResourcesClient. */ +public final class IotDpsResourcesClientImpl implements IotDpsResourcesClient { + private final ClientLogger logger = new ClientLogger(IotDpsResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final IotDpsResourcesService service; + + /** The service client containing this operation class. */ + private final IotDpsClientImpl client; + + /** + * Initializes an instance of IotDpsResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IotDpsResourcesClientImpl(IotDpsClientImpl client) { + this.service = + RestProxy.create(IotDpsResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotDpsClientIotDpsResources to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotDpsClientIotDpsRe") + private interface IotDpsResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ProvisioningServiceDescriptionInner iotDpsDescription, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TagsResource provisioningServiceTags, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}") + @ExpectedResponses({200, 202, 204, 404}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/operationresults/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getOperationResult( + @HostParam("$host") String endpoint, + @PathParam("operationId") String operationId, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("provisioningServiceName") String provisioningServiceName, + @QueryParam("asyncinfo") String asyncinfo, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/skus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listValidSkus( + @HostParam("$host") String endpoint, + @PathParam("provisioningServiceName") String provisioningServiceName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> checkProvisioningServiceNameAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") OperationInputs arguments, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/listkeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listKeys( + @HostParam("$host") String endpoint, + @PathParam("provisioningServiceName") String provisioningServiceName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listKeysForKeyName( + @HostParam("$host") String endpoint, + @PathParam("provisioningServiceName") String provisioningServiceName, + @PathParam("keyName") String keyName, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{resourceName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> listPrivateLinkResources( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{resourceName}/privateLinkResources/{groupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getPrivateLinkResources( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("groupId") String groupId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{resourceName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> listPrivateEndpointConnections( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono> getPrivateEndpointConnection( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> createOrUpdatePrivateEndpointConnection( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") PrivateEndpointConnectionInner privateEndpointConnection, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + + "/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ErrorDetailsException.class) + Mono>> deletePrivateEndpointConnection( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.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(ErrorDetailsException.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(ErrorDetailsException.class) + Mono> listValidSkusNext( + @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(ErrorDetailsException.class) + Mono> listKeysNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String provisioningServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + provisioningServiceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String provisioningServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + provisioningServiceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String provisioningServiceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, provisioningServiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProvisioningServiceDescriptionInner getByResourceGroup( + String resourceGroupName, String provisioningServiceName) { + return getByResourceGroupAsync(resourceGroupName, provisioningServiceName).block(); + } + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String provisioningServiceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, provisioningServiceName, context).block(); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription) { + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (iotDpsDescription == null) { + return Mono + .error(new IllegalArgumentException("Parameter iotDpsDescription is required and cannot be null.")); + } else { + iotDpsDescription.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + this.client.getApiVersion(), + iotDpsDescription, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (iotDpsDescription == null) { + return Mono + .error(new IllegalArgumentException("Parameter iotDpsDescription is required and cannot be null.")); + } else { + iotDpsDescription.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + this.client.getApiVersion(), + iotDpsDescription, + accept, + context); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ProvisioningServiceDescriptionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, provisioningServiceName, iotDpsDescription); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ProvisioningServiceDescriptionInner.class, + ProvisioningServiceDescriptionInner.class, + Context.NONE); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ProvisioningServiceDescriptionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ProvisioningServiceDescriptionInner.class, + ProvisioningServiceDescriptionInner.class, + context); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ProvisioningServiceDescriptionInner> + beginCreateOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription) { + return beginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).getSyncPoller(); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ProvisioningServiceDescriptionInner> + beginCreateOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, context) + .getSyncPoller(); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription) { + return beginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProvisioningServiceDescriptionInner createOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription) { + return createOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).block(); + } + + /** + * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve + * the provisioning service metadata and security metadata, and then combine them with the modified values in a new + * body to update the provisioning service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param iotDpsDescription Description of the provisioning service to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProvisioningServiceDescriptionInner createOrUpdate( + String resourceGroupName, + String provisioningServiceName, + ProvisioningServiceDescriptionInner iotDpsDescription, + Context context) { + return createOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, context).block(); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (provisioningServiceTags == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceTags is required and cannot be null.")); + } else { + provisioningServiceTags.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + this.client.getApiVersion(), + provisioningServiceTags, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (provisioningServiceTags == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceTags is required and cannot be null.")); + } else { + provisioningServiceTags.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + this.client.getApiVersion(), + provisioningServiceTags, + accept, + context); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ProvisioningServiceDescriptionInner> + beginUpdateAsync( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ProvisioningServiceDescriptionInner.class, + ProvisioningServiceDescriptionInner.class, + Context.NONE); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ProvisioningServiceDescriptionInner> + beginUpdateAsync( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ProvisioningServiceDescriptionInner.class, + ProvisioningServiceDescriptionInner.class, + context); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ProvisioningServiceDescriptionInner> beginUpdate( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { + return beginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags).getSyncPoller(); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ProvisioningServiceDescriptionInner> beginUpdate( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + Context context) { + return beginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, context) + .getSyncPoller(); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { + return beginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + Context context) { + return beginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProvisioningServiceDescriptionInner update( + String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { + return updateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags).block(); + } + + /** + * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to create or update. + * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the description of the provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProvisioningServiceDescriptionInner update( + String resourceGroupName, + String provisioningServiceName, + TagsResource provisioningServiceTags, + Context context) { + return updateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, context).block(); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String provisioningServiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + provisioningServiceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String provisioningServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + provisioningServiceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String provisioningServiceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, provisioningServiceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String provisioningServiceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, provisioningServiceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String provisioningServiceName) { + return beginDeleteAsync(resourceGroupName, provisioningServiceName).getSyncPoller(); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String provisioningServiceName, Context context) { + return beginDeleteAsync(resourceGroupName, provisioningServiceName, context).getSyncPoller(); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String provisioningServiceName) { + return beginDeleteAsync(resourceGroupName, provisioningServiceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String provisioningServiceName, Context context) { + return beginDeleteAsync(resourceGroupName, provisioningServiceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioningServiceName) { + deleteAsync(resourceGroupName, provisioningServiceName).block(); + } + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioningServiceName, Context context) { + deleteAsync(resourceGroupName, provisioningServiceName, context).block(); + } + + /** + * List all the provisioning services for a given subscription id. + * + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the provisioning services for a given subscription id. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the provisioning services for a given subscription id. + * + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List all the provisioning services for a given subscription id. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the provisioning services for a given subscription id. + * + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all the provisioning services for a given subscription id. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 all provisioning services in the given resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationResultWithResponseAsync( + String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (asyncinfo == null) { + return Mono.error(new IllegalArgumentException("Parameter asyncinfo is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getOperationResult( + this.client.getEndpoint(), + operationId, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + asyncinfo, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOperationResultWithResponseAsync( + String operationId, + String resourceGroupName, + String provisioningServiceName, + String asyncinfo, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (asyncinfo == null) { + return Mono.error(new IllegalArgumentException("Parameter asyncinfo is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getOperationResult( + this.client.getEndpoint(), + operationId, + this.client.getSubscriptionId(), + resourceGroupName, + provisioningServiceName, + asyncinfo, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getOperationResultAsync( + String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { + return getOperationResultWithResponseAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AsyncOperationResultInner getOperationResult( + String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { + return getOperationResultAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo).block(); + } + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationResultWithResponse( + String operationId, + String resourceGroupName, + String provisioningServiceName, + String asyncinfo, + Context context) { + return getOperationResultWithResponseAsync( + operationId, resourceGroupName, provisioningServiceName, asyncinfo, context) + .block(); + } + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listValidSkusSinglePageAsync( + String provisioningServiceName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName 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 + .listValidSkus( + this.client.getEndpoint(), + provisioningServiceName, + this.client.getSubscriptionId(), + resourceGroupName, + 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())); + } + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listValidSkusSinglePageAsync( + String provisioningServiceName, 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName 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 + .listValidSkus( + this.client.getEndpoint(), + provisioningServiceName, + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listValidSkusAsync( + String provisioningServiceName, String resourceGroupName) { + return new PagedFlux<>( + () -> listValidSkusSinglePageAsync(provisioningServiceName, resourceGroupName), + nextLink -> listValidSkusNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listValidSkusAsync( + String provisioningServiceName, String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listValidSkusSinglePageAsync(provisioningServiceName, resourceGroupName, context), + nextLink -> listValidSkusNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listValidSkus( + String provisioningServiceName, String resourceGroupName) { + return new PagedIterable<>(listValidSkusAsync(provisioningServiceName, resourceGroupName)); + } + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listValidSkus( + String provisioningServiceName, String resourceGroupName, Context context) { + return new PagedIterable<>(listValidSkusAsync(provisioningServiceName, resourceGroupName, context)); + } + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkProvisioningServiceNameAvailabilityWithResponseAsync( + OperationInputs arguments) { + 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 (arguments == null) { + return Mono.error(new IllegalArgumentException("Parameter arguments is required and cannot be null.")); + } else { + arguments.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkProvisioningServiceNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + arguments, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkProvisioningServiceNameAvailabilityWithResponseAsync( + OperationInputs arguments, 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 (arguments == null) { + return Mono.error(new IllegalArgumentException("Parameter arguments is required and cannot be null.")); + } else { + arguments.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkProvisioningServiceNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + arguments, + accept, + context); + } + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkProvisioningServiceNameAvailabilityAsync(OperationInputs arguments) { + return checkProvisioningServiceNameAvailabilityWithResponseAsync(arguments) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NameAvailabilityInfoInner checkProvisioningServiceNameAvailability(OperationInputs arguments) { + return checkProvisioningServiceNameAvailabilityAsync(arguments).block(); + } + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkProvisioningServiceNameAvailabilityWithResponse( + OperationInputs arguments, Context context) { + return checkProvisioningServiceNameAvailabilityWithResponseAsync(arguments, context).block(); + } + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysSinglePageAsync( + String provisioningServiceName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName 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 + .listKeys( + this.client.getEndpoint(), + provisioningServiceName, + this.client.getSubscriptionId(), + resourceGroupName, + 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 primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysSinglePageAsync( + String provisioningServiceName, 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName 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 + .listKeys( + this.client.getEndpoint(), + provisioningServiceName, + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listKeysAsync( + String provisioningServiceName, String resourceGroupName) { + return new PagedFlux<>( + () -> listKeysSinglePageAsync(provisioningServiceName, resourceGroupName), + nextLink -> listKeysNextSinglePageAsync(nextLink)); + } + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listKeysAsync( + String provisioningServiceName, String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listKeysSinglePageAsync(provisioningServiceName, resourceGroupName, context), + nextLink -> listKeysNextSinglePageAsync(nextLink, context)); + } + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName) { + return new PagedIterable<>(listKeysAsync(provisioningServiceName, resourceGroupName)); + } + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName, Context context) { + return new PagedIterable<>(listKeysAsync(provisioningServiceName, resourceGroupName, context)); + } + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysForKeyNameWithResponseAsync( + String provisioningServiceName, String keyName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName 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 + .listKeysForKeyName( + this.client.getEndpoint(), + provisioningServiceName, + keyName, + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysForKeyNameWithResponseAsync( + String provisioningServiceName, String keyName, 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 (provisioningServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName 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 + .listKeysForKeyName( + this.client.getEndpoint(), + provisioningServiceName, + keyName, + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listKeysForKeyNameAsync( + String provisioningServiceName, String keyName, String resourceGroupName) { + return listKeysForKeyNameWithResponseAsync(provisioningServiceName, keyName, resourceGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedAccessSignatureAuthorizationRuleInner listKeysForKeyName( + String provisioningServiceName, String keyName, String resourceGroupName) { + return listKeysForKeyNameAsync(provisioningServiceName, keyName, resourceGroupName).block(); + } + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listKeysForKeyNameWithResponse( + String provisioningServiceName, String keyName, String resourceGroupName, Context context) { + return listKeysForKeyNameWithResponseAsync(provisioningServiceName, keyName, resourceGroupName, context) + .block(); + } + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPrivateLinkResourcesWithResponseAsync( + String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listPrivateLinkResources( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPrivateLinkResourcesWithResponseAsync( + String resourceGroupName, String resourceName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listPrivateLinkResources( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listPrivateLinkResourcesAsync( + String resourceGroupName, String resourceName) { + return listPrivateLinkResourcesWithResponseAsync(resourceGroupName, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourcesInner listPrivateLinkResources(String resourceGroupName, String resourceName) { + return listPrivateLinkResourcesAsync(resourceGroupName, resourceName).block(); + } + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, Context context) { + return listPrivateLinkResourcesWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPrivateLinkResourcesWithResponseAsync( + String resourceGroupName, String resourceName, String groupId) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getPrivateLinkResources( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + groupId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPrivateLinkResourcesWithResponseAsync( + String resourceGroupName, String resourceName, String groupId, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (groupId == null) { + return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getPrivateLinkResources( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + groupId, + accept, + context); + } + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getPrivateLinkResourcesAsync( + String resourceGroupName, String resourceName, String groupId) { + return getPrivateLinkResourcesWithResponseAsync(resourceGroupName, resourceName, groupId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GroupIdInformationInner getPrivateLinkResources( + String resourceGroupName, String resourceName, String groupId) { + return getPrivateLinkResourcesAsync(resourceGroupName, resourceName, groupId).block(); + } + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, String groupId, Context context) { + return getPrivateLinkResourcesWithResponseAsync(resourceGroupName, resourceName, groupId, context).block(); + } + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listPrivateEndpointConnectionsWithResponseAsync( + String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listPrivateEndpointConnections( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listPrivateEndpointConnectionsWithResponseAsync( + String resourceGroupName, String resourceName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listPrivateEndpointConnections( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listPrivateEndpointConnectionsAsync( + String resourceGroupName, String resourceName) { + return listPrivateEndpointConnectionsWithResponseAsync(resourceGroupName, resourceName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listPrivateEndpointConnections( + String resourceGroupName, String resourceName) { + return listPrivateEndpointConnectionsAsync(resourceGroupName, resourceName).block(); + } + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listPrivateEndpointConnectionsWithResponse( + String resourceGroupName, String resourceName, Context context) { + return listPrivateEndpointConnectionsWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getPrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getPrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getPrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + accept, + context); + } + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getPrivateEndpointConnectionAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return getPrivateEndpointConnectionWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner getPrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return getPrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName) + .block(); + } + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPrivateEndpointConnectionWithResponse( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + return getPrivateEndpointConnectionWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, context) + .block(); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdatePrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (privateEndpointConnection == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnection is required and cannot be null.")); + } else { + privateEndpointConnection.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdatePrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdatePrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (privateEndpointConnection == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnection is required and cannot be null.")); + } else { + privateEndpointConnection.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdatePrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection, + accept, + context); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdatePrivateEndpointConnectionAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + Mono>> mono = + createOrUpdatePrivateEndpointConnectionWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdatePrivateEndpointConnectionAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdatePrivateEndpointConnectionWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> + beginCreateOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + return beginCreateOrUpdatePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) + .getSyncPoller(); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> + beginCreateOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return beginCreateOrUpdatePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context) + .getSyncPoller(); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdatePrivateEndpointConnectionAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + return beginCreateOrUpdatePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdatePrivateEndpointConnectionAsync( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return beginCreateOrUpdatePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + return createOrUpdatePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) + .block(); + } + + /** + * Create or update the status of a private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdatePrivateEndpointConnection( + String resourceGroupName, + String resourceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + Context context) { + return createOrUpdatePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context) + .block(); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deletePrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deletePrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deletePrivateEndpointConnectionWithResponseAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deletePrivateEndpointConnection( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + privateEndpointConnectionName, + accept, + context); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginDeletePrivateEndpointConnectionAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + Mono>> mono = + deletePrivateEndpointConnectionWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginDeletePrivateEndpointConnectionAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deletePrivateEndpointConnectionWithResponseAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> + beginDeletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return beginDeletePrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName) + .getSyncPoller(); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> + beginDeletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + return beginDeletePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, context) + .getSyncPoller(); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deletePrivateEndpointConnectionAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return beginDeletePrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deletePrivateEndpointConnectionAsync( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + return beginDeletePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + return deletePrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName) + .block(); + } + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + return deletePrivateEndpointConnectionAsync( + resourceGroupName, resourceName, privateEndpointConnectionName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @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 nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 provisioning service descriptions. + */ + @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 nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 available SKUs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listValidSkusNextSinglePageAsync(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.listValidSkusNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 available SKUs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listValidSkusNextSinglePageAsync( + 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 + .listValidSkusNext(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 nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysNextSinglePageAsync( + 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.listKeysNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException 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 shared access keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysNextSinglePageAsync( + 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 + .listKeysNext(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/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesImpl.java new file mode 100644 index 000000000000..c12efbf31755 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesImpl.java @@ -0,0 +1,601 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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.deviceprovisioningservices.fluent.IotDpsResourcesClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.AsyncOperationResultInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.NameAvailabilityInfoInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateLinkResourcesInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.AsyncOperationResult; +import com.azure.resourcemanager.deviceprovisioningservices.models.GroupIdInformation; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsResources; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSkuDefinition; +import com.azure.resourcemanager.deviceprovisioningservices.models.NameAvailabilityInfo; +import com.azure.resourcemanager.deviceprovisioningservices.models.OperationInputs; +import com.azure.resourcemanager.deviceprovisioningservices.models.PrivateEndpointConnection; +import com.azure.resourcemanager.deviceprovisioningservices.models.PrivateLinkResources; +import com.azure.resourcemanager.deviceprovisioningservices.models.ProvisioningServiceDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.SharedAccessSignatureAuthorizationRule; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class IotDpsResourcesImpl implements IotDpsResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotDpsResourcesImpl.class); + + private final IotDpsResourcesClient innerClient; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + public IotDpsResourcesImpl( + IotDpsResourcesClient innerClient, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ProvisioningServiceDescription getByResourceGroup(String resourceGroupName, String provisioningServiceName) { + ProvisioningServiceDescriptionInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, provisioningServiceName); + if (inner != null) { + return new ProvisioningServiceDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String provisioningServiceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, provisioningServiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProvisioningServiceDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String provisioningServiceName) { + this.serviceClient().delete(resourceGroupName, provisioningServiceName); + } + + public void delete(String resourceGroupName, String provisioningServiceName, Context context) { + this.serviceClient().delete(resourceGroupName, provisioningServiceName, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ProvisioningServiceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ProvisioningServiceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ProvisioningServiceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ProvisioningServiceDescriptionImpl(inner1, this.manager())); + } + + public AsyncOperationResult getOperationResult( + String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { + AsyncOperationResultInner inner = + this.serviceClient().getOperationResult(operationId, resourceGroupName, provisioningServiceName, asyncinfo); + if (inner != null) { + return new AsyncOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getOperationResultWithResponse( + String operationId, + String resourceGroupName, + String provisioningServiceName, + String asyncinfo, + Context context) { + Response inner = + this + .serviceClient() + .getOperationResultWithResponse( + operationId, resourceGroupName, provisioningServiceName, asyncinfo, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AsyncOperationResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listValidSkus(String provisioningServiceName, String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listValidSkus(provisioningServiceName, resourceGroupName); + return Utils.mapPage(inner, inner1 -> new IotDpsSkuDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listValidSkus( + String provisioningServiceName, String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listValidSkus(provisioningServiceName, resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new IotDpsSkuDefinitionImpl(inner1, this.manager())); + } + + public NameAvailabilityInfo checkProvisioningServiceNameAvailability(OperationInputs arguments) { + NameAvailabilityInfoInner inner = this.serviceClient().checkProvisioningServiceNameAvailability(arguments); + if (inner != null) { + return new NameAvailabilityInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkProvisioningServiceNameAvailabilityWithResponse( + OperationInputs arguments, Context context) { + Response inner = + this.serviceClient().checkProvisioningServiceNameAvailabilityWithResponse(arguments, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NameAvailabilityInfoImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listKeys(provisioningServiceName, resourceGroupName); + return Utils.mapPage(inner, inner1 -> new SharedAccessSignatureAuthorizationRuleImpl(inner1, this.manager())); + } + + public PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listKeys(provisioningServiceName, resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new SharedAccessSignatureAuthorizationRuleImpl(inner1, this.manager())); + } + + public SharedAccessSignatureAuthorizationRule listKeysForKeyName( + String provisioningServiceName, String keyName, String resourceGroupName) { + SharedAccessSignatureAuthorizationRuleInner inner = + this.serviceClient().listKeysForKeyName(provisioningServiceName, keyName, resourceGroupName); + if (inner != null) { + return new SharedAccessSignatureAuthorizationRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listKeysForKeyNameWithResponse( + String provisioningServiceName, String keyName, String resourceGroupName, Context context) { + Response inner = + this + .serviceClient() + .listKeysForKeyNameWithResponse(provisioningServiceName, keyName, resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SharedAccessSignatureAuthorizationRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateLinkResources listPrivateLinkResources(String resourceGroupName, String resourceName) { + PrivateLinkResourcesInner inner = + this.serviceClient().listPrivateLinkResources(resourceGroupName, resourceName); + if (inner != null) { + return new PrivateLinkResourcesImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().listPrivateLinkResourcesWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourcesImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GroupIdInformation getPrivateLinkResources(String resourceGroupName, String resourceName, String groupId) { + GroupIdInformationInner inner = + this.serviceClient().getPrivateLinkResources(resourceGroupName, resourceName, groupId); + if (inner != null) { + return new GroupIdInformationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, String groupId, Context context) { + Response inner = + this.serviceClient().getPrivateLinkResourcesWithResponse(resourceGroupName, resourceName, groupId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GroupIdInformationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public List listPrivateEndpointConnections( + String resourceGroupName, String resourceName) { + List inner = + this.serviceClient().listPrivateEndpointConnections(resourceGroupName, resourceName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listPrivateEndpointConnectionsWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response> inner = + this.serviceClient().listPrivateEndpointConnectionsWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public PrivateEndpointConnection getPrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this + .serviceClient() + .getPrivateEndpointConnection(resourceGroupName, resourceName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getPrivateEndpointConnectionWithResponse( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + Response inner = + this + .serviceClient() + .getPrivateEndpointConnectionWithResponse( + resourceGroupName, resourceName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnection deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this + .serviceClient() + .deletePrivateEndpointConnection(resourceGroupName, resourceName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnection deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { + PrivateEndpointConnectionInner inner = + this + .serviceClient() + .deletePrivateEndpointConnection( + resourceGroupName, resourceName, privateEndpointConnectionName, context); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public ProvisioningServiceDescription 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, provisioningServiceName, 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, provisioningServiceName, context); + } + + public PrivateEndpointConnection getPrivateEndpointConnectionById(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 resourceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getPrivateEndpointConnectionWithResponse( + resourceGroupName, resourceName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getPrivateEndpointConnectionByIdWithResponse( + 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 resourceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getPrivateEndpointConnectionWithResponse( + resourceGroupName, resourceName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + this.delete(resourceGroupName, provisioningServiceName, 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 provisioningServiceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (provisioningServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + this.delete(resourceGroupName, provisioningServiceName, context); + } + + public PrivateEndpointConnection deletePrivateEndpointConnectionById(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 resourceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .deletePrivateEndpointConnection( + resourceGroupName, resourceName, privateEndpointConnectionName, Context.NONE); + } + + public PrivateEndpointConnection deletePrivateEndpointConnectionByIdWithResponse(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 resourceName = Utils.getValueFromIdByName(id, "provisioningServices"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'provisioningServices'.", + id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .deletePrivateEndpointConnection(resourceGroupName, resourceName, privateEndpointConnectionName, context); + } + + private IotDpsResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } + + public ProvisioningServiceDescriptionImpl define(String name) { + return new ProvisioningServiceDescriptionImpl(name, this.manager()); + } + + public PrivateEndpointConnectionImpl definePrivateEndpointConnection(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsSkuDefinitionImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsSkuDefinitionImpl.java new file mode 100644 index 000000000000..2bc090342024 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsSkuDefinitionImpl.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.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSku; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSkuDefinition; + +public final class IotDpsSkuDefinitionImpl implements IotDpsSkuDefinition { + private IotDpsSkuDefinitionInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + IotDpsSkuDefinitionImpl( + IotDpsSkuDefinitionInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public IotDpsSku name() { + return this.innerModel().name(); + } + + public IotDpsSkuDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/NameAvailabilityInfoImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/NameAvailabilityInfoImpl.java new file mode 100644 index 000000000000..2290f12371dd --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/NameAvailabilityInfoImpl.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.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.NameAvailabilityInfoInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.NameAvailabilityInfo; +import com.azure.resourcemanager.deviceprovisioningservices.models.NameUnavailabilityReason; + +public final class NameAvailabilityInfoImpl implements NameAvailabilityInfo { + private NameAvailabilityInfoInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + NameAvailabilityInfoImpl( + NameAvailabilityInfoInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public NameUnavailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public NameAvailabilityInfoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationImpl.java new file mode 100644 index 000000000000..0549b35aeb5f --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationImpl.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.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.OperationInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.Operation; +import com.azure.resourcemanager.deviceprovisioningservices.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsClientImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..e897c4b68bab --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.OperationsClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.OperationInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException; +import com.azure.resourcemanager.deviceprovisioningservices.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 { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final IotDpsClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(IotDpsClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for IotDpsClientOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "IotDpsClientOperatio") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Devices/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorDetailsException.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(ErrorDetailsException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @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())); + } + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @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)); + } + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorDetailsException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + @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/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b31fd27b31ce --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/OperationsImpl.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.deviceprovisioningservices.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.deviceprovisioningservices.fluent.OperationsClient; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.OperationInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.Operation; +import com.azure.resourcemanager.deviceprovisioningservices.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager 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.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateEndpointConnectionImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 000000000000..035aaf8ea243 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateEndpointConnectionImpl.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.deviceprovisioningservices.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.PrivateEndpointConnection; +import com.azure.resourcemanager.deviceprovisioningservices.models.PrivateEndpointConnectionProperties; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointConnectionProperties properties() { + return this.innerModel().properties(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingProvisioningService( + String resourceGroupName, String resourceName) { + this.resourceGroupName = resourceGroupName; + this.resourceName = resourceName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .createOrUpdatePrivateEndpointConnection( + resourceGroupName, resourceName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .createOrUpdatePrivateEndpointConnection( + resourceGroupName, resourceName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + String name, com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .createOrUpdatePrivateEndpointConnection( + resourceGroupName, resourceName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .createOrUpdatePrivateEndpointConnection( + resourceGroupName, resourceName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceName = Utils.getValueFromIdByName(innerObject.id(), "provisioningServices"); + this.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .getPrivateEndpointConnectionWithResponse( + resourceGroupName, resourceName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .getPrivateEndpointConnectionWithResponse( + resourceGroupName, resourceName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withProperties(PrivateEndpointConnectionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateLinkResourcesImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 000000000000..8110da66f3e9 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/PrivateLinkResourcesImpl.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.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateLinkResourcesInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.GroupIdInformation; +import com.azure.resourcemanager.deviceprovisioningservices.models.PrivateLinkResources; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + private PrivateLinkResourcesInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + PrivateLinkResourcesImpl( + PrivateLinkResourcesInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new GroupIdInformationImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkResourcesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/ProvisioningServiceDescriptionImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/ProvisioningServiceDescriptionImpl.java new file mode 100644 index 000000000000..b8ddff345f16 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/ProvisioningServiceDescriptionImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsPropertiesDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSkuInfo; +import com.azure.resourcemanager.deviceprovisioningservices.models.ProvisioningServiceDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.SharedAccessSignatureAuthorizationRule; +import com.azure.resourcemanager.deviceprovisioningservices.models.TagsResource; +import java.util.Collections; +import java.util.Map; + +public final class ProvisioningServiceDescriptionImpl + implements ProvisioningServiceDescription, + ProvisioningServiceDescription.Definition, + ProvisioningServiceDescription.Update { + private ProvisioningServiceDescriptionInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public IotDpsPropertiesDescription properties() { + return this.innerModel().properties(); + } + + public IotDpsSkuInfo sku() { + return this.innerModel().sku(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ProvisioningServiceDescriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String provisioningServiceName; + + private TagsResource updateProvisioningServiceTags; + + public ProvisioningServiceDescriptionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ProvisioningServiceDescription create() { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .createOrUpdate(resourceGroupName, provisioningServiceName, this.innerModel(), Context.NONE); + return this; + } + + public ProvisioningServiceDescription create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .createOrUpdate(resourceGroupName, provisioningServiceName, this.innerModel(), context); + return this; + } + + ProvisioningServiceDescriptionImpl( + String name, com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = new ProvisioningServiceDescriptionInner(); + this.serviceManager = serviceManager; + this.provisioningServiceName = name; + } + + public ProvisioningServiceDescriptionImpl update() { + this.updateProvisioningServiceTags = new TagsResource(); + return this; + } + + public ProvisioningServiceDescription apply() { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .update(resourceGroupName, provisioningServiceName, updateProvisioningServiceTags, Context.NONE); + return this; + } + + public ProvisioningServiceDescription apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .update(resourceGroupName, provisioningServiceName, updateProvisioningServiceTags, context); + return this; + } + + ProvisioningServiceDescriptionImpl( + ProvisioningServiceDescriptionInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.provisioningServiceName = Utils.getValueFromIdByName(innerObject.id(), "provisioningServices"); + } + + public ProvisioningServiceDescription refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .getByResourceGroupWithResponse(resourceGroupName, provisioningServiceName, Context.NONE) + .getValue(); + return this; + } + + public ProvisioningServiceDescription refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotDpsResources() + .getByResourceGroupWithResponse(resourceGroupName, provisioningServiceName, context) + .getValue(); + return this; + } + + public PagedIterable listKeys() { + return serviceManager.iotDpsResources().listKeys(provisioningServiceName, resourceGroupName); + } + + public PagedIterable listKeys(Context context) { + return serviceManager.iotDpsResources().listKeys(provisioningServiceName, resourceGroupName, context); + } + + public ProvisioningServiceDescriptionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ProvisioningServiceDescriptionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ProvisioningServiceDescriptionImpl withProperties(IotDpsPropertiesDescription properties) { + this.innerModel().withProperties(properties); + return this; + } + + public ProvisioningServiceDescriptionImpl withSku(IotDpsSkuInfo sku) { + this.innerModel().withSku(sku); + return this; + } + + public ProvisioningServiceDescriptionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProvisioningServiceTags.withTags(tags); + return this; + } + } + + public ProvisioningServiceDescriptionImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/SharedAccessSignatureAuthorizationRuleImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/SharedAccessSignatureAuthorizationRuleImpl.java new file mode 100644 index 000000000000..6083a639a2a2 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/SharedAccessSignatureAuthorizationRuleImpl.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.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.AccessRightsDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.SharedAccessSignatureAuthorizationRule; + +public final class SharedAccessSignatureAuthorizationRuleImpl implements SharedAccessSignatureAuthorizationRule { + private SharedAccessSignatureAuthorizationRuleInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + SharedAccessSignatureAuthorizationRuleImpl( + SharedAccessSignatureAuthorizationRuleInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String keyName() { + return this.innerModel().keyName(); + } + + public String primaryKey() { + return this.innerModel().primaryKey(); + } + + public String secondaryKey() { + return this.innerModel().secondaryKey(); + } + + public AccessRightsDescription rights() { + return this.innerModel().rights(); + } + + public SharedAccessSignatureAuthorizationRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/Utils.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/Utils.java new file mode 100644 index 000000000000..fd7138811290 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/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.deviceprovisioningservices.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/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/VerificationCodeResponseImpl.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/VerificationCodeResponseImpl.java new file mode 100644 index 000000000000..07306a5bd6ef --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/VerificationCodeResponseImpl.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.deviceprovisioningservices.implementation; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.VerificationCodeResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeResponse; +import com.azure.resourcemanager.deviceprovisioningservices.models.VerificationCodeResponseProperties; + +public final class VerificationCodeResponseImpl implements VerificationCodeResponse { + private VerificationCodeResponseInner innerObject; + + private final com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager serviceManager; + + VerificationCodeResponseImpl( + VerificationCodeResponseInner innerObject, + com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager 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 String etag() { + return this.innerModel().etag(); + } + + public VerificationCodeResponseProperties properties() { + return this.innerModel().properties(); + } + + public VerificationCodeResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceprovisioningservices.IotDpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/package-info.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/package-info.java new file mode 100644 index 000000000000..0df76d0a9398 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for IotDpsClient. API for using the Azure IoT Hub Device Provisioning Service + * features. + */ +package com.azure.resourcemanager.deviceprovisioningservices.implementation; diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AccessRightsDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AccessRightsDescription.java new file mode 100644 index 000000000000..62829da8b9c0 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AccessRightsDescription.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.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AccessRightsDescription. */ +public final class AccessRightsDescription extends ExpandableStringEnum { + /** Static value ServiceConfig for AccessRightsDescription. */ + public static final AccessRightsDescription SERVICE_CONFIG = fromString("ServiceConfig"); + + /** Static value EnrollmentRead for AccessRightsDescription. */ + public static final AccessRightsDescription ENROLLMENT_READ = fromString("EnrollmentRead"); + + /** Static value EnrollmentWrite for AccessRightsDescription. */ + public static final AccessRightsDescription ENROLLMENT_WRITE = fromString("EnrollmentWrite"); + + /** Static value DeviceConnect for AccessRightsDescription. */ + public static final AccessRightsDescription DEVICE_CONNECT = fromString("DeviceConnect"); + + /** Static value RegistrationStatusRead for AccessRightsDescription. */ + public static final AccessRightsDescription REGISTRATION_STATUS_READ = fromString("RegistrationStatusRead"); + + /** Static value RegistrationStatusWrite for AccessRightsDescription. */ + public static final AccessRightsDescription REGISTRATION_STATUS_WRITE = fromString("RegistrationStatusWrite"); + + /** + * Creates or finds a AccessRightsDescription from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessRightsDescription. + */ + @JsonCreator + public static AccessRightsDescription fromString(String name) { + return fromString(name, AccessRightsDescription.class); + } + + /** @return known AccessRightsDescription values. */ + public static Collection values() { + return values(AccessRightsDescription.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AllocationPolicy.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AllocationPolicy.java new file mode 100644 index 000000000000..daaa0e7506da --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AllocationPolicy.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.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AllocationPolicy. */ +public final class AllocationPolicy extends ExpandableStringEnum { + /** Static value Hashed for AllocationPolicy. */ + public static final AllocationPolicy HASHED = fromString("Hashed"); + + /** Static value GeoLatency for AllocationPolicy. */ + public static final AllocationPolicy GEO_LATENCY = fromString("GeoLatency"); + + /** Static value Static for AllocationPolicy. */ + public static final AllocationPolicy STATIC = fromString("Static"); + + /** + * Creates or finds a AllocationPolicy from its string representation. + * + * @param name a name to look for. + * @return the corresponding AllocationPolicy. + */ + @JsonCreator + public static AllocationPolicy fromString(String name) { + return fromString(name, AllocationPolicy.class); + } + + /** @return known AllocationPolicy values. */ + public static Collection values() { + return values(AllocationPolicy.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AsyncOperationResult.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AsyncOperationResult.java new file mode 100644 index 000000000000..1af5f07ac98c --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/AsyncOperationResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.AsyncOperationResultInner; + +/** An immutable client-side representation of AsyncOperationResult. */ +public interface AsyncOperationResult { + /** + * Gets the status property: current status of a long running operation. + * + * @return the status value. + */ + String status(); + + /** + * Gets the error property: Error message containing code, description and details. + * + * @return the error value. + */ + ErrorMesssage error(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.AsyncOperationResultInner + * object. + * + * @return the inner object. + */ + AsyncOperationResultInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateBodyDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateBodyDescription.java new file mode 100644 index 000000000000..5912ba99e132 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateBodyDescription.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.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The JSON-serialized X509 Certificate. */ +@Fluent +public final class CertificateBodyDescription { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateBodyDescription.class); + + /* + * Base-64 representation of the X509 leaf certificate .cer file or just + * .pem file content. + */ + @JsonProperty(value = "certificate") + private String certificate; + + /** + * Get the certificate property: Base-64 representation of the X509 leaf certificate .cer file or just .pem file + * content. + * + * @return the certificate value. + */ + public String certificate() { + return this.certificate; + } + + /** + * Set the certificate property: Base-64 representation of the X509 leaf certificate .cer file or just .pem file + * content. + * + * @param certificate the certificate value to set. + * @return the CertificateBodyDescription object itself. + */ + public CertificateBodyDescription withCertificate(String certificate) { + this.certificate = certificate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateListDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateListDescription.java new file mode 100644 index 000000000000..90e81a804b1a --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateListDescription.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.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateListDescriptionInner; +import java.util.List; + +/** An immutable client-side representation of CertificateListDescription. */ +public interface CertificateListDescription { + /** + * Gets the value property: The array of Certificate objects. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateListDescriptionInner + * object. + * + * @return the inner object. + */ + CertificateListDescriptionInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateProperties.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateProperties.java new file mode 100644 index 000000000000..9f8642c4945c --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateProperties.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.deviceprovisioningservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The description of an X509 CA Certificate. */ +@Immutable +public final class CertificateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateProperties.class); + + /* + * The certificate's subject name. + */ + @JsonProperty(value = "subject", access = JsonProperty.Access.WRITE_ONLY) + private String subject; + + /* + * The certificate's expiration date and time. + */ + @JsonProperty(value = "expiry", access = JsonProperty.Access.WRITE_ONLY) + private DateTimeRfc1123 expiry; + + /* + * The certificate's thumbprint. + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * Determines whether certificate has been verified. + */ + @JsonProperty(value = "isVerified", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isVerified; + + /* + * base-64 representation of X509 certificate .cer file or just .pem file + * content. + */ + @JsonProperty(value = "certificate", access = JsonProperty.Access.WRITE_ONLY) + private byte[] certificate; + + /* + * The certificate's creation date and time. + */ + @JsonProperty(value = "created", access = JsonProperty.Access.WRITE_ONLY) + private DateTimeRfc1123 created; + + /* + * The certificate's last update date and time. + */ + @JsonProperty(value = "updated", access = JsonProperty.Access.WRITE_ONLY) + private DateTimeRfc1123 updated; + + /** + * Get the subject property: The certificate's subject name. + * + * @return the subject value. + */ + public String subject() { + return this.subject; + } + + /** + * Get the expiry property: The certificate's expiration date and time. + * + * @return the expiry value. + */ + public OffsetDateTime expiry() { + if (this.expiry == null) { + return null; + } + return this.expiry.getDateTime(); + } + + /** + * Get the thumbprint property: The certificate's thumbprint. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the isVerified property: Determines whether certificate has been verified. + * + * @return the isVerified value. + */ + public Boolean isVerified() { + return this.isVerified; + } + + /** + * Get the certificate property: base-64 representation of X509 certificate .cer file or just .pem file content. + * + * @return the certificate value. + */ + public byte[] certificate() { + return CoreUtils.clone(this.certificate); + } + + /** + * Get the created property: The certificate's creation date and time. + * + * @return the created value. + */ + public OffsetDateTime created() { + if (this.created == null) { + return null; + } + return this.created.getDateTime(); + } + + /** + * Get the updated property: The certificate's last update date and time. + * + * @return the updated value. + */ + public OffsetDateTime updated() { + if (this.updated == null) { + return null; + } + return this.updated.getDateTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificatePurpose.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificatePurpose.java new file mode 100644 index 000000000000..0c544924f612 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificatePurpose.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.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CertificatePurpose. */ +public final class CertificatePurpose extends ExpandableStringEnum { + /** Static value clientAuthentication for CertificatePurpose. */ + public static final CertificatePurpose CLIENT_AUTHENTICATION = fromString("clientAuthentication"); + + /** Static value serverAuthentication for CertificatePurpose. */ + public static final CertificatePurpose SERVER_AUTHENTICATION = fromString("serverAuthentication"); + + /** + * Creates or finds a CertificatePurpose from its string representation. + * + * @param name a name to look for. + * @return the corresponding CertificatePurpose. + */ + @JsonCreator + public static CertificatePurpose fromString(String name) { + return fromString(name, CertificatePurpose.class); + } + + /** @return known CertificatePurpose values. */ + public static Collection values() { + return values(CertificatePurpose.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateResponse.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateResponse.java new file mode 100644 index 000000000000..dcf67db6a5b5 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/CertificateResponse.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner; + +/** An immutable client-side representation of CertificateResponse. */ +public interface CertificateResponse { + /** + * 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 properties property: properties of a certificate. + * + * @return the properties value. + */ + CertificateProperties properties(); + + /** + * Gets the etag property: The entity tag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner + * object. + * + * @return the inner object. + */ + CertificateResponseInner innerModel(); + + /** The entirety of the CertificateResponse definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The CertificateResponse definition stages. */ + interface DefinitionStages { + /** The first stage of the CertificateResponse definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the CertificateResponse definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, provisioningServiceName. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName The name of the provisioning service. + * @return the next definition stage. + */ + WithCreate withExistingProvisioningService(String resourceGroupName, String provisioningServiceName); + } + /** + * The stage of the CertificateResponse 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.WithCertificate, DefinitionStages.WithIfMatch { + /** + * Executes the create request. + * + * @return the created resource. + */ + CertificateResponse create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CertificateResponse create(Context context); + } + /** The stage of the CertificateResponse definition allowing to specify certificate. */ + interface WithCertificate { + /** + * Specifies the certificate property: Base-64 representation of the X509 leaf certificate .cer file or just + * .pem file content.. + * + * @param certificate Base-64 representation of the X509 leaf certificate .cer file or just .pem file + * content. + * @return the next definition stage. + */ + WithCreate withCertificate(String certificate); + } + /** The stage of the CertificateResponse definition allowing to specify ifMatch. */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: ETag of the certificate. This is required to update an existing + * certificate, and ignored while creating a brand new certificate.. + * + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored + * while creating a brand new certificate. + * @return the next definition stage. + */ + WithCreate withIfMatch(String ifMatch); + } + } + /** + * Begins update for the CertificateResponse resource. + * + * @return the stage of resource update. + */ + CertificateResponse.Update update(); + + /** The template for CertificateResponse update. */ + interface Update extends UpdateStages.WithCertificate, UpdateStages.WithIfMatch { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CertificateResponse apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CertificateResponse apply(Context context); + } + /** The CertificateResponse update stages. */ + interface UpdateStages { + /** The stage of the CertificateResponse update allowing to specify certificate. */ + interface WithCertificate { + /** + * Specifies the certificate property: Base-64 representation of the X509 leaf certificate .cer file or just + * .pem file content.. + * + * @param certificate Base-64 representation of the X509 leaf certificate .cer file or just .pem file + * content. + * @return the next definition stage. + */ + Update withCertificate(String certificate); + } + /** The stage of the CertificateResponse update allowing to specify ifMatch. */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: ETag of the certificate. This is required to update an existing + * certificate, and ignored while creating a brand new certificate.. + * + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored + * while creating a brand new certificate. + * @return the next definition stage. + */ + Update withIfMatch(String ifMatch); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CertificateResponse refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CertificateResponse refresh(Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/DpsCertificates.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/DpsCertificates.java new file mode 100644 index 000000000000..a247a6c07db9 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/DpsCertificates.java @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Resource collection API of DpsCertificates. */ +public interface DpsCertificates { + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + CertificateResponse get(String certificateName, String resourceGroupName, String provisioningServiceName); + + /** + * Get the certificate from the provisioning service. + * + * @param certificateName Name of the certificate to retrieve. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of the provisioning service the certificate is associated with. + * @param ifMatch ETag of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + Response getWithResponse( + String certificateName, + String resourceGroupName, + String provisioningServiceName, + String ifMatch, + Context context); + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 ifMatch, String provisioningServiceName, String certificateName); + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param ifMatch ETag of the certificate. + * @param provisioningServiceName The name of the provisioning service. + * @param certificateName This is a mandatory field, and is the logical name of the certificate that the + * provisioning service will access by. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, + String ifMatch, + String provisioningServiceName, + String certificateName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the certificates tied to the provisioning service. + */ + CertificateListDescription list(String resourceGroupName, String provisioningServiceName); + + /** + * Get all the certificates tied to the provisioning service. + * + * @param resourceGroupName Name of resource group. + * @param provisioningServiceName Name of provisioning service to retrieve certificates for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the certificates tied to the provisioning service. + */ + Response listWithResponse( + String resourceGroupName, String provisioningServiceName, Context context); + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + VerificationCodeResponse generateVerificationCode( + String certificateName, String ifMatch, String resourceGroupName, String provisioningServiceName); + + /** + * Generate verification code for Proof of Possession. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. This is required to update an existing certificate, and ignored while + * creating a brand new certificate. + * @param resourceGroupName name of resource group. + * @param provisioningServiceName Name of provisioning service. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Description mentioning the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the response of the verification code. + */ + Response generateVerificationCodeWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + CertificateResponse verifyCertificate( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request); + + /** + * Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded + * certificate. + * + * @param certificateName The mandatory logical name of the certificate, that the provisioning service uses to + * access. + * @param ifMatch ETag of the certificate. + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Provisioning service name. + * @param request The name of the certificate. + * @param certificateName1 Common Name for the certificate. + * @param certificateRawBytes Raw data of certificate. + * @param certificateIsVerified Indicates if the certificate has been verified by owner of the private key. + * @param certificatePurpose Describe the purpose of the certificate. + * @param certificateCreated Certificate creation time. + * @param certificateLastUpdated Certificate last updated time. + * @param certificateHasPrivateKey Indicates if the certificate contains private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the X509 Certificate. + */ + Response verifyCertificateWithResponse( + String certificateName, + String ifMatch, + String resourceGroupName, + String provisioningServiceName, + VerificationCodeRequest request, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); + + /** + * Get the certificate from the provisioning service. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + CertificateResponse getById(String id); + + /** + * Get the certificate from the provisioning service. + * + * @param id the resource ID. + * @param ifMatch ETag of the certificate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the certificate from the provisioning service. + */ + Response getByIdWithResponse(String id, String ifMatch, Context context); + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the specified certificate associated with the Provisioning Service. + * + * @param id the resource ID. + * @param ifMatch ETag of the certificate. + * @param certificateName1 This is optional, and it is the Common Name of the certificate. + * @param certificateRawBytes Raw data within the certificate. + * @param certificateIsVerified Indicates if certificate has been verified by owner of the private key. + * @param certificatePurpose A description that mentions the purpose of the certificate. + * @param certificateCreated Time the certificate is created. + * @param certificateLastUpdated Time the certificate is last updated. + * @param certificateHasPrivateKey Indicates if the certificate contains a private key. + * @param certificateNonce Random number generated to indicate Proof of Possession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse( + String id, + String ifMatch, + String certificateName1, + byte[] certificateRawBytes, + Boolean certificateIsVerified, + CertificatePurpose certificatePurpose, + OffsetDateTime certificateCreated, + OffsetDateTime certificateLastUpdated, + Boolean certificateHasPrivateKey, + String certificateNonce, + Context context); + + /** + * Begins definition for a new CertificateResponse resource. + * + * @param name resource name. + * @return the first stage of the new CertificateResponse definition. + */ + CertificateResponse.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetails.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetails.java new file mode 100644 index 000000000000..db40c21476a8 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetails.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.deviceprovisioningservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Error details. */ +@Immutable +public final class ErrorDetails extends ManagementError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorDetails.class); + + /* + * The HTTP status code. + */ + @JsonProperty(value = "httpStatusCode", access = JsonProperty.Access.WRITE_ONLY) + private String httpStatusCode; + + /** + * Get the httpStatusCode property: The HTTP status code. + * + * @return the httpStatusCode value. + */ + public String getHttpStatusCode() { + return this.httpStatusCode; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetailsException.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetailsException.java new file mode 100644 index 000000000000..aa035cedaeb5 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorDetailsException.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.deviceprovisioningservices.models; + +import com.azure.core.http.HttpResponse; +import com.azure.core.management.exception.ManagementException; + +/** Exception thrown for an invalid response with ErrorDetails information. */ +public final class ErrorDetailsException extends ManagementException { + /** + * Initializes a new instance of the ErrorDetailsException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public ErrorDetailsException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorDetailsException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public ErrorDetailsException(String message, HttpResponse response, ErrorDetails value) { + super(message, response, value); + } + + @Override + public ErrorDetails getValue() { + return (ErrorDetails) super.getValue(); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorMesssage.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorMesssage.java new file mode 100644 index 000000000000..5c778550fd57 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ErrorMesssage.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.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Error response containing message and code. */ +@Fluent +public final class ErrorMesssage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorMesssage.class); + + /* + * standard error code + */ + @JsonProperty(value = "code") + private String code; + + /* + * standard error description + */ + @JsonProperty(value = "message") + private String message; + + /* + * detailed summary of error + */ + @JsonProperty(value = "details") + private String details; + + /** + * Get the code property: standard error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: standard error code. + * + * @param code the code value to set. + * @return the ErrorMesssage object itself. + */ + public ErrorMesssage withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: standard error description. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: standard error description. + * + * @param message the message value to set. + * @return the ErrorMesssage object itself. + */ + public ErrorMesssage withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the details property: detailed summary of error. + * + * @return the details value. + */ + public String details() { + return this.details; + } + + /** + * Set the details property: detailed summary of error. + * + * @param details the details value to set. + * @return the ErrorMesssage object itself. + */ + public ErrorMesssage withDetails(String details) { + this.details = details; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformation.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformation.java new file mode 100644 index 000000000000..dbcc09fb0414 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformation.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.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner; + +/** An immutable client-side representation of GroupIdInformation. */ +public interface GroupIdInformation { + /** + * Gets the id property: The resource identifier. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The properties for a group information object. + * + * @return the properties value. + */ + GroupIdInformationProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner object. + * + * @return the inner object. + */ + GroupIdInformationInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformationProperties.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformationProperties.java new file mode 100644 index 000000000000..e733e30b8da3 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/GroupIdInformationProperties.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.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties for a group information object. */ +@Fluent +public final class GroupIdInformationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GroupIdInformationProperties.class); + + /* + * The group id + */ + @JsonProperty(value = "groupId") + private String groupId; + + /* + * The required members for a specific group id + */ + @JsonProperty(value = "requiredMembers") + private List requiredMembers; + + /* + * The required DNS zones for a specific group id + */ + @JsonProperty(value = "requiredZoneNames") + private List requiredZoneNames; + + /** + * Get the groupId property: The group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Set the groupId property: The group id. + * + * @param groupId the groupId value to set. + * @return the GroupIdInformationProperties object itself. + */ + public GroupIdInformationProperties withGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get the requiredMembers property: The required members for a specific group id. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Set the requiredMembers property: The required members for a specific group id. + * + * @param requiredMembers the requiredMembers value to set. + * @return the GroupIdInformationProperties object itself. + */ + public GroupIdInformationProperties withRequiredMembers(List requiredMembers) { + this.requiredMembers = requiredMembers; + return this; + } + + /** + * Get the requiredZoneNames property: The required DNS zones for a specific group id. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Set the requiredZoneNames property: The required DNS zones for a specific group id. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the GroupIdInformationProperties object itself. + */ + public GroupIdInformationProperties withRequiredZoneNames(List requiredZoneNames) { + this.requiredZoneNames = requiredZoneNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsPropertiesDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsPropertiesDescription.java new file mode 100644 index 000000000000..839201b3cdc9 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsPropertiesDescription.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * the service specific properties of a provisioning service, including keys, linked iot hubs, current state, and system + * generated properties such as hostname and idScope. + */ +@Fluent +public final class IotDpsPropertiesDescription { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotDpsPropertiesDescription.class); + + /* + * Current state of the provisioning service. + */ + @JsonProperty(value = "state") + private State state; + + /* + * Whether requests from Public Network are allowed + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * The IP filter rules. + */ + @JsonProperty(value = "ipFilterRules") + private List ipFilterRules; + + /* + * Private endpoint connections created on this IotHub + */ + @JsonProperty(value = "privateEndpointConnections") + private List privateEndpointConnections; + + /* + * The ARM provisioning state of the provisioning service. + */ + @JsonProperty(value = "provisioningState") + private String provisioningState; + + /* + * List of IoT hubs associated with this provisioning service. + */ + @JsonProperty(value = "iotHubs") + private List iotHubs; + + /* + * Allocation policy to be used by this provisioning service. + */ + @JsonProperty(value = "allocationPolicy") + private AllocationPolicy allocationPolicy; + + /* + * Service endpoint for provisioning service. + */ + @JsonProperty(value = "serviceOperationsHostName", access = JsonProperty.Access.WRITE_ONLY) + private String serviceOperationsHostname; + + /* + * Device endpoint for this provisioning service. + */ + @JsonProperty(value = "deviceProvisioningHostName", access = JsonProperty.Access.WRITE_ONLY) + private String deviceProvisioningHostname; + + /* + * Unique identifier of this provisioning service. + */ + @JsonProperty(value = "idScope", access = JsonProperty.Access.WRITE_ONLY) + private String idScope; + + /* + * List of authorization keys for a provisioning service. + */ + @JsonProperty(value = "authorizationPolicies") + private List authorizationPolicies; + + /** + * Get the state property: Current state of the provisioning service. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Set the state property: Current state of the provisioning service. + * + * @param state the state value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withState(State state) { + this.state = state; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether requests from Public Network are allowed. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the ipFilterRules property: The IP filter rules. + * + * @return the ipFilterRules value. + */ + public List ipFilterRules() { + return this.ipFilterRules; + } + + /** + * Set the ipFilterRules property: The IP filter rules. + * + * @param ipFilterRules the ipFilterRules value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withIpFilterRules(List ipFilterRules) { + this.ipFilterRules = ipFilterRules; + return this; + } + + /** + * Get the privateEndpointConnections property: Private endpoint connections created on this IotHub. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Set the privateEndpointConnections property: Private endpoint connections created on this IotHub. + * + * @param privateEndpointConnections the privateEndpointConnections value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withPrivateEndpointConnections( + List privateEndpointConnections) { + this.privateEndpointConnections = privateEndpointConnections; + return this; + } + + /** + * Get the provisioningState property: The ARM provisioning state of the provisioning service. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The ARM provisioning state of the provisioning service. + * + * @param provisioningState the provisioningState value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the iotHubs property: List of IoT hubs associated with this provisioning service. + * + * @return the iotHubs value. + */ + public List iotHubs() { + return this.iotHubs; + } + + /** + * Set the iotHubs property: List of IoT hubs associated with this provisioning service. + * + * @param iotHubs the iotHubs value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withIotHubs(List iotHubs) { + this.iotHubs = iotHubs; + return this; + } + + /** + * Get the allocationPolicy property: Allocation policy to be used by this provisioning service. + * + * @return the allocationPolicy value. + */ + public AllocationPolicy allocationPolicy() { + return this.allocationPolicy; + } + + /** + * Set the allocationPolicy property: Allocation policy to be used by this provisioning service. + * + * @param allocationPolicy the allocationPolicy value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withAllocationPolicy(AllocationPolicy allocationPolicy) { + this.allocationPolicy = allocationPolicy; + return this; + } + + /** + * Get the serviceOperationsHostname property: Service endpoint for provisioning service. + * + * @return the serviceOperationsHostname value. + */ + public String serviceOperationsHostname() { + return this.serviceOperationsHostname; + } + + /** + * Get the deviceProvisioningHostname property: Device endpoint for this provisioning service. + * + * @return the deviceProvisioningHostname value. + */ + public String deviceProvisioningHostname() { + return this.deviceProvisioningHostname; + } + + /** + * Get the idScope property: Unique identifier of this provisioning service. + * + * @return the idScope value. + */ + public String idScope() { + return this.idScope; + } + + /** + * Get the authorizationPolicies property: List of authorization keys for a provisioning service. + * + * @return the authorizationPolicies value. + */ + public List authorizationPolicies() { + return this.authorizationPolicies; + } + + /** + * Set the authorizationPolicies property: List of authorization keys for a provisioning service. + * + * @param authorizationPolicies the authorizationPolicies value to set. + * @return the IotDpsPropertiesDescription object itself. + */ + public IotDpsPropertiesDescription withAuthorizationPolicies( + List authorizationPolicies) { + this.authorizationPolicies = authorizationPolicies; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipFilterRules() != null) { + ipFilterRules().forEach(e -> e.validate()); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + if (iotHubs() != null) { + iotHubs().forEach(e -> e.validate()); + } + if (authorizationPolicies() != null) { + authorizationPolicies().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsResources.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsResources.java new file mode 100644 index 000000000000..cd7892d32781 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsResources.java @@ -0,0 +1,532 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of IotDpsResources. */ +public interface IotDpsResources { + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + ProvisioningServiceDescription getByResourceGroup(String resourceGroupName, String provisioningServiceName); + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param resourceGroupName Resource group name. + * @param provisioningServiceName Name of the provisioning service to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String provisioningServiceName, Context context); + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String provisioningServiceName); + + /** + * Deletes the Provisioning Service. + * + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioningServiceName, Context context); + + /** + * List all the provisioning services for a given subscription id. + * + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioning service descriptions. + */ + PagedIterable list(); + + /** + * List all the provisioning services for a given subscription id. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 provisioning service descriptions. + */ + PagedIterable list(Context context); + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 all provisioning services in the given resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of all provisioning services in the given resource group. + * + * @param resourceGroupName Resource group identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 all provisioning services in the given resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + AsyncOperationResult getOperationResult( + String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo); + + /** + * Gets the status of a long running operation, such as create, update or delete a provisioning service. + * + * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. + * @param resourceGroupName Resource group identifier. + * @param provisioningServiceName Name of provisioning service that the operation is running on. + * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long + * running operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long running operation, such as create, update or delete a provisioning service. + */ + Response getOperationResultWithResponse( + String operationId, + String resourceGroupName, + String provisioningServiceName, + String asyncinfo, + Context context); + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + PagedIterable listValidSkus(String provisioningServiceName, String resourceGroupName); + + /** + * Gets the list of valid SKUs and tiers for a provisioning service. + * + * @param provisioningServiceName Name of provisioning service. + * @param resourceGroupName Name of resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of valid SKUs and tiers for a provisioning service. + */ + PagedIterable listValidSkus( + String provisioningServiceName, String resourceGroupName, Context context); + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + NameAvailabilityInfo checkProvisioningServiceNameAvailability(OperationInputs arguments); + + /** + * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if + * the name is usable. + * + * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service + * to check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of name availability. + */ + Response checkProvisioningServiceNameAvailabilityWithResponse( + OperationInputs arguments, Context context); + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 shared access keys. + */ + PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName); + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param provisioningServiceName The provisioning service name to get the shared access keys for. + * @param resourceGroupName resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 shared access keys. + */ + PagedIterable listKeys( + String provisioningServiceName, String resourceGroupName, Context context); + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + SharedAccessSignatureAuthorizationRule listKeysForKeyName( + String provisioningServiceName, String keyName, String resourceGroupName); + + /** + * List primary and secondary keys for a specific key name. + * + * @param provisioningServiceName Name of the provisioning service. + * @param keyName Logical key name to get key-values for. + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return description of the shared access key. + */ + Response listKeysForKeyNameWithResponse( + String provisioningServiceName, String keyName, String resourceGroupName, Context context); + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + PrivateLinkResources listPrivateLinkResources(String resourceGroupName, String resourceName); + + /** + * List private link resources for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the available private link resources for a provisioning service. + */ + Response listPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + GroupIdInformation getPrivateLinkResources(String resourceGroupName, String resourceName, String groupId); + + /** + * Get the specified private link resource for the given provisioning service. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param groupId The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private link resource for the given provisioning service. + */ + Response getPrivateLinkResourcesWithResponse( + String resourceGroupName, String resourceName, String groupId, Context context); + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + List listPrivateEndpointConnections(String resourceGroupName, String resourceName); + + /** + * List private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of private endpoint connections for a provisioning service. + */ + Response> listPrivateEndpointConnectionsWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + PrivateEndpointConnection getPrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName); + + /** + * Get private endpoint connection properties. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + Response getPrivateEndpointConnectionWithResponse( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + PrivateEndpointConnection deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName); + + /** + * Delete private endpoint connection with the specified name. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + PrivateEndpointConnection deletePrivateEndpointConnection( + String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context); + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + ProvisioningServiceDescription getById(String id); + + /** + * Get the metadata of the provisioning service without SAS keys. + * + * @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.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata of the provisioning service without SAS keys. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Get private endpoint connection properties. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + PrivateEndpointConnection getPrivateEndpointConnectionById(String id); + + /** + * Get private endpoint connection properties. + * + * @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.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return private endpoint connection properties. + */ + Response getPrivateEndpointConnectionByIdWithResponse(String id, Context context); + + /** + * Deletes the Provisioning Service. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the Provisioning Service. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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); + + /** + * Delete private endpoint connection with the specified name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + PrivateEndpointConnection deletePrivateEndpointConnectionById(String id); + + /** + * Delete private endpoint connection with the specified name. + * + * @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.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection of a provisioning service. + */ + PrivateEndpointConnection deletePrivateEndpointConnectionByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ProvisioningServiceDescription resource. + * + * @param name resource name. + * @return the first stage of the new ProvisioningServiceDescription definition. + */ + ProvisioningServiceDescription.DefinitionStages.Blank define(String name); + + /** + * Begins definition for a new PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank definePrivateEndpointConnection(String name); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSku.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSku.java new file mode 100644 index 000000000000..cd48f30a8ad8 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSku.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.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IotDpsSku. */ +public final class IotDpsSku extends ExpandableStringEnum { + /** Static value S1 for IotDpsSku. */ + public static final IotDpsSku S1 = fromString("S1"); + + /** + * Creates or finds a IotDpsSku from its string representation. + * + * @param name a name to look for. + * @return the corresponding IotDpsSku. + */ + @JsonCreator + public static IotDpsSku fromString(String name) { + return fromString(name, IotDpsSku.class); + } + + /** @return known IotDpsSku values. */ + public static Collection values() { + return values(IotDpsSku.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinition.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinition.java new file mode 100644 index 000000000000..6f7a82eca133 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinition.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.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner; + +/** An immutable client-side representation of IotDpsSkuDefinition. */ +public interface IotDpsSkuDefinition { + /** + * Gets the name property: Sku name. + * + * @return the name value. + */ + IotDpsSku name(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner + * object. + * + * @return the inner object. + */ + IotDpsSkuDefinitionInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinitionListResult.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinitionListResult.java new file mode 100644 index 000000000000..3a4c0c233d1d --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuDefinitionListResult.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of available SKUs. */ +@Fluent +public final class IotDpsSkuDefinitionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotDpsSkuDefinitionListResult.class); + + /* + * The list of SKUs + */ + @JsonProperty(value = "value") + private List value; + + /* + * The next link. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of SKUs. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of SKUs. + * + * @param value the value value to set. + * @return the IotDpsSkuDefinitionListResult object itself. + */ + public IotDpsSkuDefinitionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The next link. + * + * @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/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuInfo.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuInfo.java new file mode 100644 index 000000000000..ef58310c6f06 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotDpsSkuInfo.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.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** List of possible provisioning service SKUs. */ +@Fluent +public final class IotDpsSkuInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotDpsSkuInfo.class); + + /* + * Sku name. + */ + @JsonProperty(value = "name") + private IotDpsSku name; + + /* + * Pricing tier name of the provisioning service. + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private String tier; + + /* + * The number of units to provision + */ + @JsonProperty(value = "capacity") + private Long capacity; + + /** + * Get the name property: Sku name. + * + * @return the name value. + */ + public IotDpsSku name() { + return this.name; + } + + /** + * Set the name property: Sku name. + * + * @param name the name value to set. + * @return the IotDpsSkuInfo object itself. + */ + public IotDpsSkuInfo withName(IotDpsSku name) { + this.name = name; + return this; + } + + /** + * Get the tier property: Pricing tier name of the provisioning service. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Get the capacity property: The number of units to provision. + * + * @return the capacity value. + */ + public Long capacity() { + return this.capacity; + } + + /** + * Set the capacity property: The number of units to provision. + * + * @param capacity the capacity value to set. + * @return the IotDpsSkuInfo object itself. + */ + public IotDpsSkuInfo withCapacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotHubDefinitionDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotHubDefinitionDescription.java new file mode 100644 index 000000000000..5e6bf27fca15 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IotHubDefinitionDescription.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Description of the IoT hub. */ +@Fluent +public final class IotHubDefinitionDescription { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubDefinitionDescription.class); + + /* + * flag for applying allocationPolicy or not for a given iot hub. + */ + @JsonProperty(value = "applyAllocationPolicy") + private Boolean applyAllocationPolicy; + + /* + * weight to apply for a given iot h. + */ + @JsonProperty(value = "allocationWeight") + private Integer allocationWeight; + + /* + * Host name of the IoT hub. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Connection string of the IoT hub. + */ + @JsonProperty(value = "connectionString", required = true) + private String connectionString; + + /* + * ARM region of the IoT hub. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Get the applyAllocationPolicy property: flag for applying allocationPolicy or not for a given iot hub. + * + * @return the applyAllocationPolicy value. + */ + public Boolean applyAllocationPolicy() { + return this.applyAllocationPolicy; + } + + /** + * Set the applyAllocationPolicy property: flag for applying allocationPolicy or not for a given iot hub. + * + * @param applyAllocationPolicy the applyAllocationPolicy value to set. + * @return the IotHubDefinitionDescription object itself. + */ + public IotHubDefinitionDescription withApplyAllocationPolicy(Boolean applyAllocationPolicy) { + this.applyAllocationPolicy = applyAllocationPolicy; + return this; + } + + /** + * Get the allocationWeight property: weight to apply for a given iot h. + * + * @return the allocationWeight value. + */ + public Integer allocationWeight() { + return this.allocationWeight; + } + + /** + * Set the allocationWeight property: weight to apply for a given iot h. + * + * @param allocationWeight the allocationWeight value to set. + * @return the IotHubDefinitionDescription object itself. + */ + public IotHubDefinitionDescription withAllocationWeight(Integer allocationWeight) { + this.allocationWeight = allocationWeight; + return this; + } + + /** + * Get the name property: Host name of the IoT hub. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the connectionString property: Connection string of the IoT hub. + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: Connection string of the IoT hub. + * + * @param connectionString the connectionString value to set. + * @return the IotHubDefinitionDescription object itself. + */ + public IotHubDefinitionDescription withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the location property: ARM region of the IoT hub. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: ARM region of the IoT hub. + * + * @param location the location value to set. + * @return the IotHubDefinitionDescription object itself. + */ + public IotHubDefinitionDescription withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectionString() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property connectionString in model IotHubDefinitionDescription")); + } + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property location in model IotHubDefinitionDescription")); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterActionType.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterActionType.java new file mode 100644 index 000000000000..35885518f949 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterActionType.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.deviceprovisioningservices.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for IpFilterActionType. */ +public enum IpFilterActionType { + /** Enum value Accept. */ + ACCEPT("Accept"), + + /** Enum value Reject. */ + REJECT("Reject"); + + /** The actual serialized value for a IpFilterActionType instance. */ + private final String value; + + IpFilterActionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IpFilterActionType instance. + * + * @param value the serialized value to parse. + * @return the parsed IpFilterActionType object, or null if unable to parse. + */ + @JsonCreator + public static IpFilterActionType fromString(String value) { + IpFilterActionType[] items = IpFilterActionType.values(); + for (IpFilterActionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterRule.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterRule.java new file mode 100644 index 000000000000..6cf7022ae858 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterRule.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.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The IP filter rules for a provisioning Service. */ +@Fluent +public final class IpFilterRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IpFilterRule.class); + + /* + * The name of the IP filter rule. + */ + @JsonProperty(value = "filterName", required = true) + private String filterName; + + /* + * The desired action for requests captured by this rule. + */ + @JsonProperty(value = "action", required = true) + private IpFilterActionType action; + + /* + * A string that contains the IP address range in CIDR notation for the + * rule. + */ + @JsonProperty(value = "ipMask", required = true) + private String ipMask; + + /* + * Target for requests captured by this rule. + */ + @JsonProperty(value = "target") + private IpFilterTargetType target; + + /** + * Get the filterName property: The name of the IP filter rule. + * + * @return the filterName value. + */ + public String filterName() { + return this.filterName; + } + + /** + * Set the filterName property: The name of the IP filter rule. + * + * @param filterName the filterName value to set. + * @return the IpFilterRule object itself. + */ + public IpFilterRule withFilterName(String filterName) { + this.filterName = filterName; + return this; + } + + /** + * Get the action property: The desired action for requests captured by this rule. + * + * @return the action value. + */ + public IpFilterActionType action() { + return this.action; + } + + /** + * Set the action property: The desired action for requests captured by this rule. + * + * @param action the action value to set. + * @return the IpFilterRule object itself. + */ + public IpFilterRule withAction(IpFilterActionType action) { + this.action = action; + return this; + } + + /** + * Get the ipMask property: A string that contains the IP address range in CIDR notation for the rule. + * + * @return the ipMask value. + */ + public String ipMask() { + return this.ipMask; + } + + /** + * Set the ipMask property: A string that contains the IP address range in CIDR notation for the rule. + * + * @param ipMask the ipMask value to set. + * @return the IpFilterRule object itself. + */ + public IpFilterRule withIpMask(String ipMask) { + this.ipMask = ipMask; + return this; + } + + /** + * Get the target property: Target for requests captured by this rule. + * + * @return the target value. + */ + public IpFilterTargetType target() { + return this.target; + } + + /** + * Set the target property: Target for requests captured by this rule. + * + * @param target the target value to set. + * @return the IpFilterRule object itself. + */ + public IpFilterRule withTarget(IpFilterTargetType target) { + this.target = target; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (filterName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property filterName in model IpFilterRule")); + } + if (action() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property action in model IpFilterRule")); + } + if (ipMask() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property ipMask in model IpFilterRule")); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterTargetType.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterTargetType.java new file mode 100644 index 000000000000..f0eac5bd167f --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/IpFilterTargetType.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.deviceprovisioningservices.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for IpFilterTargetType. */ +public enum IpFilterTargetType { + /** Enum value all. */ + ALL("all"), + + /** Enum value serviceApi. */ + SERVICE_API("serviceApi"), + + /** Enum value deviceApi. */ + DEVICE_API("deviceApi"); + + /** The actual serialized value for a IpFilterTargetType instance. */ + private final String value; + + IpFilterTargetType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IpFilterTargetType instance. + * + * @param value the serialized value to parse. + * @return the parsed IpFilterTargetType object, or null if unable to parse. + */ + @JsonCreator + public static IpFilterTargetType fromString(String value) { + IpFilterTargetType[] items = IpFilterTargetType.values(); + for (IpFilterTargetType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameAvailabilityInfo.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameAvailabilityInfo.java new file mode 100644 index 000000000000..026bd80348a4 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameAvailabilityInfo.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.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.NameAvailabilityInfoInner; + +/** An immutable client-side representation of NameAvailabilityInfo. */ +public interface NameAvailabilityInfo { + /** + * Gets the nameAvailable property: specifies if a name is available or not. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: specifies the reason a name is unavailable. + * + * @return the reason value. + */ + NameUnavailabilityReason reason(); + + /** + * Gets the message property: message containing a detailed reason name is unavailable. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.NameAvailabilityInfoInner + * object. + * + * @return the inner object. + */ + NameAvailabilityInfoInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameUnavailabilityReason.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameUnavailabilityReason.java new file mode 100644 index 000000000000..bd8ad76bbbc5 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/NameUnavailabilityReason.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.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NameUnavailabilityReason. */ +public final class NameUnavailabilityReason extends ExpandableStringEnum { + /** Static value Invalid for NameUnavailabilityReason. */ + public static final NameUnavailabilityReason INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for NameUnavailabilityReason. */ + public static final NameUnavailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates or finds a NameUnavailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding NameUnavailabilityReason. + */ + @JsonCreator + public static NameUnavailabilityReason fromString(String name) { + return fromString(name, NameUnavailabilityReason.class); + } + + /** @return known NameUnavailabilityReason values. */ + public static Collection values() { + return values(NameUnavailabilityReason.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/Operation.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/Operation.java new file mode 100644 index 000000000000..0666b25ae648 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/Operation.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.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{read | write | action | delete}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationDisplay.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationDisplay.java new file mode 100644 index 000000000000..35cddad91ec4 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationDisplay.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Service provider: Microsoft Devices. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * Resource Type: ProvisioningServices. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * Name of the operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get the provider property: Service provider: Microsoft Devices. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: Resource Type: ProvisioningServices. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: Name of the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationInputs.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationInputs.java new file mode 100644 index 000000000000..fd7df2b06c23 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationInputs.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.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Input values for operation results call. */ +@Fluent +public final class OperationInputs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInputs.class); + + /* + * The name of the Provisioning Service to check. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the name property: The name of the Provisioning Service to check. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the Provisioning Service to check. + * + * @param name the name value to set. + * @return the OperationInputs object itself. + */ + public OperationInputs withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model OperationInputs")); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationListResult.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationListResult.java new file mode 100644 index 000000000000..1cfd2dbc00b8 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/OperationListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list provisioning service operations. It contains a list of operations and a URL link to get + * the next set of results. + */ +@Immutable +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * Provisioning service operations supported by the Microsoft.Devices + * 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; + + /** + * Get the value property: Provisioning service operations supported by the Microsoft.Devices 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/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/Operations.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/Operations.java new file mode 100644 index 000000000000..c7e9ed2b0a7b --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/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.deviceprovisioningservices.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + PagedIterable list(); + + /** + * Lists all of the available Microsoft.Devices REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException thrown if the request + * is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list provisioning service operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpoint.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpoint.java new file mode 100644 index 000000000000..b3dce2500658 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpoint.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The private endpoint property of a private endpoint connection. */ +@Immutable +public final class PrivateEndpoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpoint.class); + + /* + * The resource identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get the id property: The resource identifier. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnection.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnection.java new file mode 100644 index 000000000000..69d8c72cd19b --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnection.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner; + +/** An immutable client-side representation of PrivateEndpointConnection. */ +public interface PrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The properties of a private endpoint connection. + * + * @return the properties value. + */ + PrivateEndpointConnectionProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner + * object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** The entirety of the PrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithParentResource, + DefinitionStages.WithProperties, + DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, resourceName. + * + * @param resourceGroupName The name of the resource group that contains the provisioning service. + * @param resourceName The name of the provisioning service. + * @return the next definition stage. + */ + WithProperties withExistingProvisioningService(String resourceGroupName, String resourceName); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties of a private endpoint connection. + * + * @param properties The properties of a private endpoint connection. + * @return the next definition stage. + */ + WithCreate withProperties(PrivateEndpointConnectionProperties properties); + } + /** + * The stage of the PrivateEndpointConnection definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + } + /** + * Begins update for the PrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnection.Update update(); + + /** The template for PrivateEndpointConnection update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnection apply(Context context); + } + /** The PrivateEndpointConnection update stages. */ + interface UpdateStages { + /** The stage of the PrivateEndpointConnection update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties of a private endpoint connection. + * + * @param properties The properties of a private endpoint connection. + * @return the next definition stage. + */ + Update withProperties(PrivateEndpointConnectionProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnectionProperties.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..b353bc695f5e --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateEndpointConnectionProperties.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.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionProperties.class); + + /* + * The private endpoint property of a private endpoint connection + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpoint privateEndpoint; + + /* + * The current state of a private endpoint connection + */ + @JsonProperty(value = "privateLinkServiceConnectionState", required = true) + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /** + * Get the privateEndpoint property: The private endpoint property of a private endpoint connection. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: The private endpoint property of a private endpoint connection. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: The current state of a private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: The current state of a private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property privateLinkServiceConnectionState in model" + + " PrivateEndpointConnectionProperties")); + } else { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkResources.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkResources.java new file mode 100644 index 000000000000..94a6763a6981 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkResources.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.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateLinkResourcesInner; +import java.util.List; + +/** An immutable client-side representation of PrivateLinkResources. */ +public interface PrivateLinkResources { + /** + * Gets the value property: The list of available private link resources for a provisioning service. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateLinkResourcesInner + * object. + * + * @return the inner object. + */ + PrivateLinkResourcesInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionState.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 000000000000..8ed69f31563f --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionState.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The current state of a private endpoint connection. */ +@Fluent +public final class PrivateLinkServiceConnectionState { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnectionState.class); + + /* + * The status of a private endpoint connection + */ + @JsonProperty(value = "status", required = true) + private PrivateLinkServiceConnectionStatus status; + + /* + * The description for the current state of a private endpoint connection + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * Actions required for a private endpoint connection + */ + @JsonProperty(value = "actionsRequired") + private String actionsRequired; + + /** + * Get the status property: The status of a private endpoint connection. + * + * @return the status value. + */ + public PrivateLinkServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: The status of a private endpoint connection. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withStatus(PrivateLinkServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The description for the current state of a private endpoint connection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description for the current state of a private endpoint connection. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: Actions required for a private endpoint connection. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Set the actionsRequired property: Actions required for a private endpoint connection. + * + * @param actionsRequired the actionsRequired value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withActionsRequired(String actionsRequired) { + this.actionsRequired = actionsRequired; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model PrivateLinkServiceConnectionState")); + } + if (description() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model PrivateLinkServiceConnectionState")); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionStatus.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionStatus.java new file mode 100644 index 000000000000..057213e26296 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PrivateLinkServiceConnectionStatus.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.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateLinkServiceConnectionStatus. */ +public final class PrivateLinkServiceConnectionStatus extends ExpandableStringEnum { + /** Static value Pending for PrivateLinkServiceConnectionStatus. */ + public static final PrivateLinkServiceConnectionStatus PENDING = fromString("Pending"); + + /** Static value Approved for PrivateLinkServiceConnectionStatus. */ + public static final PrivateLinkServiceConnectionStatus APPROVED = fromString("Approved"); + + /** Static value Rejected for PrivateLinkServiceConnectionStatus. */ + public static final PrivateLinkServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** Static value Disconnected for PrivateLinkServiceConnectionStatus. */ + public static final PrivateLinkServiceConnectionStatus DISCONNECTED = fromString("Disconnected"); + + /** + * Creates or finds a PrivateLinkServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkServiceConnectionStatus. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStatus fromString(String name) { + return fromString(name, PrivateLinkServiceConnectionStatus.class); + } + + /** @return known PrivateLinkServiceConnectionStatus values. */ + public static Collection values() { + return values(PrivateLinkServiceConnectionStatus.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescription.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescription.java new file mode 100644 index 000000000000..840c844ee04f --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescription.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.deviceprovisioningservices.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import java.util.Map; + +/** An immutable client-side representation of ProvisioningServiceDescription. */ +public interface ProvisioningServiceDescription { + /** + * 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 etag property: The Etag field is *not* required. If it is provided in the response body, it must also be + * provided as a header per the normal ETag convention. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the properties property: Service specific properties for a provisioning service. + * + * @return the properties value. + */ + IotDpsPropertiesDescription properties(); + + /** + * Gets the sku property: Sku info for a provisioning Service. + * + * @return the sku value. + */ + IotDpsSkuInfo sku(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner + * com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner object. + * + * @return the inner object. + */ + ProvisioningServiceDescriptionInner innerModel(); + + /** The entirety of the ProvisioningServiceDescription definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithProperties, + DefinitionStages.WithSku, + DefinitionStages.WithCreate { + } + /** The ProvisioningServiceDescription definition stages. */ + interface DefinitionStages { + /** The first stage of the ProvisioningServiceDescription definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ProvisioningServiceDescription 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 ProvisioningServiceDescription definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Resource group identifier. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the ProvisioningServiceDescription definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Service specific properties for a provisioning service. + * + * @param properties Service specific properties for a provisioning service. + * @return the next definition stage. + */ + WithSku withProperties(IotDpsPropertiesDescription properties); + } + /** The stage of the ProvisioningServiceDescription definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: Sku info for a provisioning Service.. + * + * @param sku Sku info for a provisioning Service. + * @return the next definition stage. + */ + WithCreate withSku(IotDpsSkuInfo sku); + } + /** + * The stage of the ProvisioningServiceDescription 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.WithEtag { + /** + * Executes the create request. + * + * @return the created resource. + */ + ProvisioningServiceDescription create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ProvisioningServiceDescription create(Context context); + } + /** The stage of the ProvisioningServiceDescription 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 ProvisioningServiceDescription definition allowing to specify etag. */ + interface WithEtag { + /** + * Specifies the etag property: The Etag field is *not* required. If it is provided in the response body, it + * must also be provided as a header per the normal ETag convention.. + * + * @param etag The Etag field is *not* required. If it is provided in the response body, it must also be + * provided as a header per the normal ETag convention. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + } + /** + * Begins update for the ProvisioningServiceDescription resource. + * + * @return the stage of resource update. + */ + ProvisioningServiceDescription.Update update(); + + /** The template for ProvisioningServiceDescription update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ProvisioningServiceDescription apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ProvisioningServiceDescription apply(Context context); + } + /** The ProvisioningServiceDescription update stages. */ + interface UpdateStages { + /** The stage of the ProvisioningServiceDescription 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); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ProvisioningServiceDescription refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ProvisioningServiceDescription refresh(Context context); + + /** + * List the primary and secondary keys for a provisioning service. + * + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 shared access keys. + */ + PagedIterable listKeys(); + + /** + * List the primary and secondary keys for a provisioning service. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException 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 shared access keys. + */ + PagedIterable listKeys(Context context); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescriptionListResult.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescriptionListResult.java new file mode 100644 index 000000000000..4510504b38ee --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescriptionListResult.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of provisioning service descriptions. */ +@Fluent +public final class ProvisioningServiceDescriptionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProvisioningServiceDescriptionListResult.class); + + /* + * List of provisioning service descriptions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * the next link + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of provisioning service descriptions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of provisioning service descriptions. + * + * @param value the value value to set. + * @return the ProvisioningServiceDescriptionListResult object itself. + */ + public ProvisioningServiceDescriptionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: the next link. + * + * @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/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PublicNetworkAccess.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PublicNetworkAccess.java new file mode 100644 index 000000000000..3e57aed1daa1 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/PublicNetworkAccess.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.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PublicNetworkAccess. */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** Static value Enabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess ENABLED = fromString("Enabled"); + + /** Static value Disabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess DISABLED = fromString("Disabled"); + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + @JsonCreator + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** @return known PublicNetworkAccess values. */ + public static Collection values() { + return values(PublicNetworkAccess.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRule.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRule.java new file mode 100644 index 000000000000..da8e665406ef --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRule.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.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleInner; + +/** An immutable client-side representation of SharedAccessSignatureAuthorizationRule. */ +public interface SharedAccessSignatureAuthorizationRule { + /** + * Gets the keyName property: Name of the key. + * + * @return the keyName value. + */ + String keyName(); + + /** + * Gets the primaryKey property: Primary SAS key value. + * + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * Gets the secondaryKey property: Secondary SAS key value. + * + * @return the secondaryKey value. + */ + String secondaryKey(); + + /** + * Gets the rights property: Rights that this key has. + * + * @return the rights value. + */ + AccessRightsDescription rights(); + + /** + * Gets the inner + * com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleInner + * object. + * + * @return the inner object. + */ + SharedAccessSignatureAuthorizationRuleInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRuleListResult.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRuleListResult.java new file mode 100644 index 000000000000..067fab53b69c --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/SharedAccessSignatureAuthorizationRuleListResult.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of shared access keys. */ +@Fluent +public final class SharedAccessSignatureAuthorizationRuleListResult { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(SharedAccessSignatureAuthorizationRuleListResult.class); + + /* + * The list of shared access policies. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The next link. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of shared access policies. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of shared access policies. + * + * @param value the value value to set. + * @return the SharedAccessSignatureAuthorizationRuleListResult object itself. + */ + public SharedAccessSignatureAuthorizationRuleListResult withValue( + List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The next link. + * + * @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/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/State.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/State.java new file mode 100644 index 000000000000..7172f0c00a6c --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/State.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.deviceprovisioningservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for State. */ +public final class State extends ExpandableStringEnum { + /** Static value Activating for State. */ + public static final State ACTIVATING = fromString("Activating"); + + /** Static value Active for State. */ + public static final State ACTIVE = fromString("Active"); + + /** Static value Deleting for State. */ + public static final State DELETING = fromString("Deleting"); + + /** Static value Deleted for State. */ + public static final State DELETED = fromString("Deleted"); + + /** Static value ActivationFailed for State. */ + public static final State ACTIVATION_FAILED = fromString("ActivationFailed"); + + /** Static value DeletionFailed for State. */ + public static final State DELETION_FAILED = fromString("DeletionFailed"); + + /** Static value Transitioning for State. */ + public static final State TRANSITIONING = fromString("Transitioning"); + + /** Static value Suspending for State. */ + public static final State SUSPENDING = fromString("Suspending"); + + /** Static value Suspended for State. */ + public static final State SUSPENDED = fromString("Suspended"); + + /** Static value Resuming for State. */ + public static final State RESUMING = fromString("Resuming"); + + /** Static value FailingOver for State. */ + public static final State FAILING_OVER = fromString("FailingOver"); + + /** Static value FailoverFailed for State. */ + public static final State FAILOVER_FAILED = fromString("FailoverFailed"); + + /** + * Creates or finds a State from its string representation. + * + * @param name a name to look for. + * @return the corresponding State. + */ + @JsonCreator + public static State fromString(String name) { + return fromString(name, State.class); + } + + /** @return known State values. */ + public static Collection values() { + return values(State.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/TagsResource.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/TagsResource.java new file mode 100644 index 000000000000..79db3f22497e --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/TagsResource.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.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * A container holding only the Tags for a resource, allowing the user to update the tags on a Provisioning Service + * instance. + */ +@Fluent +public final class TagsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagsResource.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * 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 TagsResource object itself. + */ + public TagsResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeRequest.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeRequest.java new file mode 100644 index 000000000000..6fe1d7dfe585 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeRequest.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.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The JSON-serialized leaf certificate. */ +@Fluent +public final class VerificationCodeRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VerificationCodeRequest.class); + + /* + * base-64 representation of X509 certificate .cer file or just .pem file + * content. + */ + @JsonProperty(value = "certificate") + private String certificate; + + /** + * Get the certificate property: base-64 representation of X509 certificate .cer file or just .pem file content. + * + * @return the certificate value. + */ + public String certificate() { + return this.certificate; + } + + /** + * Set the certificate property: base-64 representation of X509 certificate .cer file or just .pem file content. + * + * @param certificate the certificate value to set. + * @return the VerificationCodeRequest object itself. + */ + public VerificationCodeRequest withCertificate(String certificate) { + this.certificate = certificate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponse.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponse.java new file mode 100644 index 000000000000..837f69b8fd87 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponse.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.deviceprovisioningservices.models; + +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.VerificationCodeResponseInner; + +/** An immutable client-side representation of VerificationCodeResponse. */ +public interface VerificationCodeResponse { + /** + * 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 etag property: Request etag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the properties property: The properties property. + * + * @return the properties value. + */ + VerificationCodeResponseProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.deviceprovisioningservices.fluent.models.VerificationCodeResponseInner + * object. + * + * @return the inner object. + */ + VerificationCodeResponseInner innerModel(); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponseProperties.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponseProperties.java new file mode 100644 index 000000000000..307a472724bc --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/VerificationCodeResponseProperties.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deviceprovisioningservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The VerificationCodeResponseProperties model. */ +@Fluent +public final class VerificationCodeResponseProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VerificationCodeResponseProperties.class); + + /* + * Verification code. + */ + @JsonProperty(value = "verificationCode") + private String verificationCode; + + /* + * Certificate subject. + */ + @JsonProperty(value = "subject") + private String subject; + + /* + * Code expiry. + */ + @JsonProperty(value = "expiry") + private String expiry; + + /* + * Certificate thumbprint. + */ + @JsonProperty(value = "thumbprint") + private String thumbprint; + + /* + * Indicate if the certificate is verified by owner of private key. + */ + @JsonProperty(value = "isVerified") + private Boolean isVerified; + + /* + * base-64 representation of X509 certificate .cer file or just .pem file + * content. + */ + @JsonProperty(value = "certificate") + private byte[] certificate; + + /* + * Certificate created time. + */ + @JsonProperty(value = "created") + private String created; + + /* + * Certificate updated time. + */ + @JsonProperty(value = "updated") + private String updated; + + /** + * Get the verificationCode property: Verification code. + * + * @return the verificationCode value. + */ + public String verificationCode() { + return this.verificationCode; + } + + /** + * Set the verificationCode property: Verification code. + * + * @param verificationCode the verificationCode value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withVerificationCode(String verificationCode) { + this.verificationCode = verificationCode; + return this; + } + + /** + * Get the subject property: Certificate subject. + * + * @return the subject value. + */ + public String subject() { + return this.subject; + } + + /** + * Set the subject property: Certificate subject. + * + * @param subject the subject value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withSubject(String subject) { + this.subject = subject; + return this; + } + + /** + * Get the expiry property: Code expiry. + * + * @return the expiry value. + */ + public String expiry() { + return this.expiry; + } + + /** + * Set the expiry property: Code expiry. + * + * @param expiry the expiry value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withExpiry(String expiry) { + this.expiry = expiry; + return this; + } + + /** + * Get the thumbprint property: Certificate thumbprint. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set the thumbprint property: Certificate thumbprint. + * + * @param thumbprint the thumbprint value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the isVerified property: Indicate if the certificate is verified by owner of private key. + * + * @return the isVerified value. + */ + public Boolean isVerified() { + return this.isVerified; + } + + /** + * Set the isVerified property: Indicate if the certificate is verified by owner of private key. + * + * @param isVerified the isVerified value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withIsVerified(Boolean isVerified) { + this.isVerified = isVerified; + return this; + } + + /** + * Get the certificate property: base-64 representation of X509 certificate .cer file or just .pem file content. + * + * @return the certificate value. + */ + public byte[] certificate() { + return CoreUtils.clone(this.certificate); + } + + /** + * Set the certificate property: base-64 representation of X509 certificate .cer file or just .pem file content. + * + * @param certificate the certificate value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withCertificate(byte[] certificate) { + this.certificate = CoreUtils.clone(certificate); + return this; + } + + /** + * Get the created property: Certificate created time. + * + * @return the created value. + */ + public String created() { + return this.created; + } + + /** + * Set the created property: Certificate created time. + * + * @param created the created value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withCreated(String created) { + this.created = created; + return this; + } + + /** + * Get the updated property: Certificate updated time. + * + * @return the updated value. + */ + public String updated() { + return this.updated; + } + + /** + * Set the updated property: Certificate updated time. + * + * @param updated the updated value to set. + * @return the VerificationCodeResponseProperties object itself. + */ + public VerificationCodeResponseProperties withUpdated(String updated) { + this.updated = updated; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/package-info.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/package-info.java new file mode 100644 index 000000000000..54fb7f454b54 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for IotDpsClient. API for using the Azure IoT Hub Device Provisioning Service + * features. + */ +package com.azure.resourcemanager.deviceprovisioningservices.models; diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/package-info.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/package-info.java new file mode 100644 index 000000000000..b472705c7cfe --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for IotDpsClient. API for using the Azure IoT Hub Device Provisioning Service + * features. + */ +package com.azure.resourcemanager.deviceprovisioningservices; diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/module-info.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/module-info.java new file mode 100644 index 000000000000..225be0fc4135 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/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.deviceprovisioningservices { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.deviceprovisioningservices; + exports com.azure.resourcemanager.deviceprovisioningservices.fluent; + exports com.azure.resourcemanager.deviceprovisioningservices.fluent.models; + exports com.azure.resourcemanager.deviceprovisioningservices.models; + + opens com.azure.resourcemanager.deviceprovisioningservices.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.deviceprovisioningservices.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/AllocationPolicyTests.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/AllocationPolicyTests.java new file mode 100644 index 000000000000..fbfc2e6f1851 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/AllocationPolicyTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.deviceprovisioningservices; + +import com.azure.core.test.annotation.DoNotRecord; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.AllocationPolicy; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsPropertiesDescription; +import com.azure.resourcemanager.resources.ResourceManager; +import com.azure.resourcemanager.resources.models.ResourceGroup; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class AllocationPolicyTests extends DeviceProvisioningTestBase +{ + @Test + @DoNotRecord(skipInPlayback = true) + public void Get() { + ResourceManager resourceManager = createResourceManager(); + IotDpsManager iotDpsManager = createIotDpsManager(); + ResourceGroup resourceGroup = createResourceGroup(resourceManager); + + try { + ProvisioningServiceDescriptionInner provisioningServiceDescription = + createProvisioningService(iotDpsManager, resourceGroup); + + AllocationPolicy allocationPolicy = + provisioningServiceDescription + .properties() + .allocationPolicy(); + + assertTrue(Constants.ALLOCATION_POLICIES.contains(allocationPolicy)); + } finally { + // No matter if the test fails or not, delete the resource group that contains these test resources + resourceManager.resourceGroups().beginDeleteByName(resourceGroup.name()); + } + } + + @Test + @DoNotRecord(skipInPlayback = true) + public void Update() { + ResourceManager resourceManager = createResourceManager(); + IotDpsManager iotDpsManager = createIotDpsManager(); + ResourceGroup resourceGroup = createResourceGroup(resourceManager); + + try { + ProvisioningServiceDescriptionInner provisioningServiceDescription = + createProvisioningService(iotDpsManager, resourceGroup); + + // pick a new allocation policy that is different from the current allocation policy + AllocationPolicy newAllocationPolicy = AllocationPolicy.GEO_LATENCY; + if (provisioningServiceDescription.properties().allocationPolicy() == AllocationPolicy.GEO_LATENCY) + { + newAllocationPolicy = AllocationPolicy.HASHED; + } + + // update the service's allocation policy to the new policy + IotDpsPropertiesDescription propertiesDescription = + provisioningServiceDescription + .properties() + .withAllocationPolicy(newAllocationPolicy); + + provisioningServiceDescription.withProperties(propertiesDescription); + + iotDpsManager + .serviceClient() + .getIotDpsResources() + .createOrUpdate( + resourceGroup.name(), + provisioningServiceDescription.name(), + provisioningServiceDescription); + + } finally { + // No matter if the test fails or not, delete the resource group that contains these test resources + resourceManager.resourceGroups().beginDeleteByName(resourceGroup.name()); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/CertificatesTests.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/CertificatesTests.java new file mode 100644 index 000000000000..00e1f0831a2c --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/CertificatesTests.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.deviceprovisioningservices; + +import com.azure.core.test.annotation.DoNotRecord; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateListDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.CertificateResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.VerificationCodeResponseInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.CertificateBodyDescription; +import com.azure.resourcemanager.resources.ResourceManager; +import com.azure.resourcemanager.resources.models.ResourceGroup; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +public class CertificatesTests extends DeviceProvisioningTestBase +{ + @Test + @DoNotRecord(skipInPlayback = true) + public void CertificateCRUD() { + ResourceManager resourceManager = createResourceManager(); + IotDpsManager iotDpsManager = createIotDpsManager(); + ResourceGroup resourceGroup = createResourceGroup(resourceManager); + + try { + ProvisioningServiceDescriptionInner provisioningServiceDescription = + createProvisioningService(iotDpsManager, resourceGroup); + + CertificateBodyDescription certificateBodyDescription = + new CertificateBodyDescription().withCertificate(Constants.Certificate.CONTENT); + + // create a new certificate + iotDpsManager + .serviceClient() + .getDpsCertificates() + .createOrUpdate( + resourceGroup.name(), + provisioningServiceDescription.name(), + Constants.Certificate.NAME, + certificateBodyDescription); + + CertificateListDescriptionInner certificateListDescription = + iotDpsManager + .serviceClient() + .getDpsCertificates() + .list( + resourceGroup.name(), + provisioningServiceDescription.name()); + + assertEquals(1, certificateListDescription.value().size()); + + CertificateResponseInner certificate = certificateListDescription.value().get(0); + assertFalse(certificate.properties().isVerified()); + assertEquals(Constants.Certificate.SUBJECT, certificate.properties().subject()); + assertEquals(Constants.Certificate.THUMBPRINT, certificate.properties().thumbprint()); + + // verify that you can generate certificate verification codes + VerificationCodeResponseInner verificationCodeResponse = + iotDpsManager + .serviceClient() + .getDpsCertificates() + .generateVerificationCode( + certificate.name(), + certificate.etag(), + resourceGroup.name(), + provisioningServiceDescription.name()); + + assertNotNull(verificationCodeResponse.properties().verificationCode()); + + // delete the certificate + iotDpsManager + .serviceClient() + .getDpsCertificates() + .delete( + resourceGroup.name(), + verificationCodeResponse.etag(), + provisioningServiceDescription.name(), + certificate.name()); + + // verify that the certificate isn't listed anymore + certificateListDescription = + iotDpsManager + .serviceClient() + .getDpsCertificates() + .list( + resourceGroup.name(), + provisioningServiceDescription.name()); + + assertEquals(0, certificateListDescription.value().size()); + + } finally { + // No matter if the test fails or not, delete the resource group that contains these test resources + resourceManager.resourceGroups().beginDeleteByName(resourceGroup.name()); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/Constants.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/Constants.java new file mode 100644 index 000000000000..58ce02525dde --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/Constants.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.deviceprovisioningservices; + +import com.azure.resourcemanager.deviceprovisioningservices.models.AllocationPolicy; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSku; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSkuInfo; + +import java.util.Arrays; +import java.util.List; + +public class Constants +{ + static final String DEFAULT_LOCATION = "WestUS2"; + static final String OWNER_ACCESS_KEY_NAME = "provisioningserviceowner"; + static final String IOTHUB_OWNER_ACCESS_KEY_NAME = "iothubowner"; + + public static class DefaultSku + { + static final String NAME = "S1"; + static final Long CAPACITY = 1L; + static IotDpsSkuInfo INSTANCE = new IotDpsSkuInfo() + .withCapacity(Constants.DefaultSku.CAPACITY) + .withName(IotDpsSku.fromString(Constants.DefaultSku.NAME)); + } + + public static class Certificate + { + static final String CONTENT = + "MIIBvjCCAWOgAwIBAgIQG6PoBFT6GLJGNKn/EaxltTAKBggqhkjOPQQDAjAcMRow" + + "GAYDVQQDDBFBenVyZSBJb1QgUm9vdCBDQTAeFw0xNzExMDMyMDUyNDZaFw0xNzEy" + + "MDMyMTAyNDdaMBwxGjAYBgNVBAMMEUF6dXJlIElvVCBSb290IENBMFkwEwYHKoZI" + + "zj0CAQYIKoZIzj0DAQcDQgAE+CgpnW3K+KRNIi/U6Zqe/Al9m8PExHX2KgakmGTf" + + "E04nNBwnSoygWb0ekqpT+Lm+OP56LMMe9ynVNryDEr9OSKOBhjCBgzAOBgNVHQ8B" + + "Af8EBAMCAgQwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMBMB8GA1UdEQQY" + + "MBaCFENOPUF6dXJlIElvVCBSb290IENBMBIGA1UdEwEB/wQIMAYBAf8CAQwwHQYD" + + "VR0OBBYEFDjiklfHQzw1G0A33BcmRQTjAivTMAoGCCqGSM49BAMCA0kAMEYCIQCt" + + "jJ4bAvoYuDhwr92Kk+OkvpPF+qBFiRfrA/EC4YGtzQIhAO79WPtbUnBQ5fsQnW2a" + + "UAT4yJGWL+7l4/qfmqblb96n"; + + static final String NAME = "DPStestCert"; + static final String SUBJECT = "Azure IoT Root CA"; + static final String THUMBPRINT = "9F0983E8F2DB2DB3582997FEF331247D872DEE32"; + } + + static final List ALLOCATION_POLICIES = Arrays.asList(AllocationPolicy.GEO_LATENCY, AllocationPolicy.HASHED, AllocationPolicy.STATIC); +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/DeviceProvisioningResourceManagementTests.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/DeviceProvisioningResourceManagementTests.java new file mode 100644 index 000000000000..2c726f091ba1 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/DeviceProvisioningResourceManagementTests.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.deviceprovisioningservices; + +import com.azure.core.test.annotation.DoNotRecord; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsPropertiesDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSkuInfo; +import com.azure.resourcemanager.deviceprovisioningservices.models.NameAvailabilityInfo; +import com.azure.resourcemanager.deviceprovisioningservices.models.OperationInputs; +import com.azure.resourcemanager.deviceprovisioningservices.models.ProvisioningServiceDescription; +import com.azure.resourcemanager.resources.ResourceManager; +import com.azure.resourcemanager.resources.models.ResourceGroup; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +public class DeviceProvisioningResourceManagementTests extends DeviceProvisioningTestBase +{ + @Test + @DoNotRecord(skipInPlayback = true) + public void ServiceCRUD() { + ResourceManager resourceManager = createResourceManager(); + IotDpsManager iotDpsManager = createIotDpsManager(); + ResourceGroup resourceGroup = createResourceGroup(resourceManager); + + String serviceName = DEFAULT_INSTANCE_NAME + "-" + createRandomSuffix(); + try { + try { + iotDpsManager.iotDpsResources() + .checkProvisioningServiceNameAvailability(new OperationInputs().withName(serviceName)); + } catch (ErrorDetailsException ex) { + // error code signifies that the resource name is not available, need to delete it before creating a + // new one. + if (ex.getValue().getHttpStatusCode().equals("404307")) { + // Delete the service if it already exists + iotDpsManager.iotDpsResources().delete(resourceGroup.name(), serviceName, Context.NONE); + + // After deleting the existing service, check that the name is now available to use + NameAvailabilityInfo availabilityInfo = iotDpsManager.iotDpsResources() + .checkProvisioningServiceNameAvailability(new OperationInputs().withName(serviceName)); + + assertTrue( + availabilityInfo.nameAvailable(), + "Service name was unavailable even after deleting the existing service with the name"); + } + } + + ProvisioningServiceDescription createServiceDescription = iotDpsManager + .iotDpsResources() + .define(serviceName) + .withRegion(DEFAULT_REGION) + .withExistingResourceGroup(resourceGroup.name()) + .withProperties(new IotDpsPropertiesDescription()) + .withSku(Constants.DefaultSku.INSTANCE) + .create(); + + ProvisioningServiceDescriptionInner updatedProvisioningServiceDescriptionInner = + iotDpsManager + .serviceClient() + .getIotDpsResources() + .createOrUpdate(resourceGroup.name(), serviceName, createServiceDescription.innerModel()); + + assertNotNull(updatedProvisioningServiceDescriptionInner); + assertEquals(Constants.DefaultSku.NAME, updatedProvisioningServiceDescriptionInner.sku().name().toString()); + assertEquals(serviceName, updatedProvisioningServiceDescriptionInner.name()); + + // Try getting the newly created resource + ProvisioningServiceDescription getResponse = iotDpsManager + .iotDpsResources() + .getByResourceGroup(resourceGroup.name(), serviceName); + + assertNotNull(getResponse); + assertNotNull(getResponse.etag()); + assertEquals(Constants.DefaultSku.INSTANCE.name().toString(), getResponse.sku().name().toString()); + assertEquals(Constants.DefaultSku.INSTANCE.capacity().longValue(), getResponse.sku().capacity().longValue()); + assertEquals(DEFAULT_REGION.toString(), getResponse.location()); + + // Delete the service + iotDpsManager.iotDpsResources().delete(resourceGroup.name(), serviceName, Context.NONE); + } finally { + // No matter if the test fails or not, delete the resource group that contains these test resources + resourceManager.resourceGroups().beginDeleteByName(resourceGroup.name()); + } + } + + @Test + @DoNotRecord(skipInPlayback = true) + public void updateSKU() { + ResourceManager resourceManager = createResourceManager(); + IotDpsManager iotDpsManager = createIotDpsManager(); + ResourceGroup resourceGroup = createResourceGroup(resourceManager); + + try { + // create the provisioning service + ProvisioningServiceDescriptionInner provisioningServiceDescription = + createProvisioningService(iotDpsManager, resourceGroup); + + // locally increase the SKU capacity by 1 + long expectedSkuCapacity = provisioningServiceDescription.sku().capacity() + 1; + IotDpsSkuInfo newSku = + provisioningServiceDescription + .sku() + .withCapacity(expectedSkuCapacity); + + // update the service representation to use the new SKU + provisioningServiceDescription = iotDpsManager + .serviceClient() + .getIotDpsResources() + .createOrUpdate( + resourceGroup.name(), + provisioningServiceDescription.name(), + provisioningServiceDescription.withSku(newSku)); + + assertEquals(expectedSkuCapacity, provisioningServiceDescription.sku().capacity()); + } finally { + // No matter if the test fails or not, delete the resource group that contains these test resources + resourceManager.resourceGroups().beginDeleteByName(resourceGroup.name()); + } + } + + @Test + @DoNotRecord(skipInPlayback = true) + public void CreateFailure() { + ResourceManager resourceManager = createResourceManager(); + IotDpsManager iotDpsManager = createIotDpsManager(); + ResourceGroup resourceGroup = createResourceGroup(resourceManager); + + try { + iotDpsManager + .iotDpsResources() + .define("some invalid service name *&^-#2?") + .withRegion(DEFAULT_REGION) + .withExistingResourceGroup(resourceGroup.name()) + .withProperties(new IotDpsPropertiesDescription()) + .withSku(Constants.DefaultSku.INSTANCE) + .create(); + + fail("Creating a device provisioning service with an invalid name should have thrown an exception"); + } catch (ErrorDetailsException ex) { + // expected throw + } finally { + // No matter if the test fails or not, delete the resource group that contains these test resources + resourceManager.resourceGroups().beginDeleteByName(resourceGroup.name()); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/DeviceProvisioningTestBase.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/DeviceProvisioningTestBase.java new file mode 100644 index 000000000000..d5fa45bd5092 --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/DeviceProvisioningTestBase.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.deviceprovisioningservices; + +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.Region; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.TestBase; +import com.azure.core.util.Context; +import com.azure.identity.DefaultAzureCredentialBuilder; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsPropertiesDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.NameAvailabilityInfo; +import com.azure.resourcemanager.deviceprovisioningservices.models.OperationInputs; +import com.azure.resourcemanager.deviceprovisioningservices.models.ProvisioningServiceDescription; +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.resources.ResourceManager; +import com.azure.resourcemanager.resources.models.ResourceGroup; + +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class DeviceProvisioningTestBase extends TestBase { + protected static final String DEFAULT_INSTANCE_NAME = "JavaDpsControlPlaneSDKTest"; + protected static final Region DEFAULT_REGION = Region.US_WEST_CENTRAL; + + public ResourceManager createResourceManager() { + return ResourceManager + .authenticate(new DefaultAzureCredentialBuilder().build(), new AzureProfile(AzureEnvironment.AZURE)) + .withDefaultSubscription(); + } + + public IotDpsManager createIotDpsManager() { + return IotDpsManager + .authenticate(new DefaultAzureCredentialBuilder().build(), new AzureProfile(AzureEnvironment.AZURE)); + } + + public ResourceGroup createResourceGroup(ResourceManager resourceManager) { + String resourceGroupName = DEFAULT_INSTANCE_NAME + "-" + createRandomSuffix(); + return resourceManager.resourceGroups() + .define(resourceGroupName) + .withRegion(DEFAULT_REGION) + .create(); + } + + public IotHubManager createIotHubManager() { + return IotHubManager + .authenticate(new DefaultAzureCredentialBuilder().build(), new AzureProfile(AzureEnvironment.AZURE)); + } + + public ProvisioningServiceDescriptionInner createProvisioningService(IotDpsManager iotDpsManager, ResourceGroup resourceGroup) { + String serviceName = DEFAULT_INSTANCE_NAME + "-" + createRandomSuffix(); + + try { + iotDpsManager.iotDpsResources() + .checkProvisioningServiceNameAvailability(new OperationInputs().withName(serviceName)); + } catch (ErrorDetailsException ex) { + // error code signifies that the resource name is not available, need to delete it before creating a + // new one. + if (ex.getValue().getHttpStatusCode().equals("404307")) { + // Delete the service if it already exists + iotDpsManager.iotDpsResources().delete(resourceGroup.name(), serviceName, Context.NONE); + + // After deleting the existing service, check that the name is now available to use + NameAvailabilityInfo availabilityInfo = iotDpsManager.iotDpsResources() + .checkProvisioningServiceNameAvailability(new OperationInputs().withName(serviceName)); + + assertTrue( + availabilityInfo.nameAvailable(), + "Service name was unavailable even after deleting the existing service with the name"); + } + } + + ProvisioningServiceDescription provisioningServiceDescription = iotDpsManager + .iotDpsResources() + .define(serviceName) + .withRegion(DEFAULT_REGION) + .withExistingResourceGroup(resourceGroup.name()) + .withProperties(new IotDpsPropertiesDescription()) + .withSku(Constants.DefaultSku.INSTANCE) + .create(); + + ProvisioningServiceDescriptionInner inner = iotDpsManager + .serviceClient() + .getIotDpsResources() + .createOrUpdate(resourceGroup.name(), serviceName, provisioningServiceDescription.innerModel()); + + return inner; + } + + public String createRandomSuffix() { + // need to shorten the UUID since max service name is 50 characters + return UUID.randomUUID().toString().substring(0, 18); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/LinkedHubTests.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/LinkedHubTests.java new file mode 100644 index 000000000000..01b9dff8ab2f --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/LinkedHubTests.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.deviceprovisioningservices; + +import com.azure.core.test.annotation.DoNotRecord; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsPropertiesDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotHubDefinitionDescription; +import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.fluent.models.IotHubDescriptionInner; +import com.azure.resourcemanager.iothub.models.IotHubSku; +import com.azure.resourcemanager.iothub.models.IotHubSkuInfo; +import com.azure.resourcemanager.resources.ResourceManager; +import com.azure.resourcemanager.resources.models.ResourceGroup; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static com.azure.resourcemanager.deviceprovisioningservices.Constants.DEFAULT_LOCATION; +import static com.azure.resourcemanager.deviceprovisioningservices.Constants.IOTHUB_OWNER_ACCESS_KEY_NAME; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class LinkedHubTests extends DeviceProvisioningTestBase +{ + @Test + @DoNotRecord(skipInPlayback = true) + public void LinkedHubsCRUD() { + ResourceManager resourceManager = createResourceManager(); + IotDpsManager iotDpsManager = createIotDpsManager(); + IotHubManager iotHubManager = createIotHubManager(); + ResourceGroup resourceGroup = createResourceGroup(resourceManager); + + try { + ProvisioningServiceDescriptionInner provisioningServiceDescription = + createProvisioningService(iotDpsManager, resourceGroup); + + // Create an Iot Hub in the same resource group as the DPS instance + String hubName = "JavaDpsControlPlaneSDKTestHub" + createRandomSuffix(); + IotHubDescriptionInner iotHubDescriptionInner = + new IotHubDescriptionInner() + .withLocation(DEFAULT_LOCATION) + .withSku(new IotHubSkuInfo().withCapacity(1L).withName(IotHubSku.B1)); + + iotHubDescriptionInner = iotHubManager + .serviceClient() + .getIotHubResources() + .createOrUpdate(resourceGroup.name(), hubName, iotHubDescriptionInner); + + // Link that Iot Hub to the DPS instance + List linkedHubs = new ArrayList<>(); + String hubKey = iotHubManager.iotHubResources().getKeysForKeyName(resourceGroup.name(), iotHubDescriptionInner.name(), IOTHUB_OWNER_ACCESS_KEY_NAME).primaryKey(); + String hubConnectionString = "HostName=" + hubName + ".azure-devices.net;SharedAccessKeyName=" + IOTHUB_OWNER_ACCESS_KEY_NAME + ";SharedAccessKey=" + hubKey; + + linkedHubs.add( + new IotHubDefinitionDescription() + .withConnectionString(hubConnectionString) + .withLocation(iotHubDescriptionInner.location()) + .withAllocationWeight(1) + .withApplyAllocationPolicy(true)); + + IotDpsPropertiesDescription propertiesDescription = new IotDpsPropertiesDescription(); + propertiesDescription.withIotHubs(linkedHubs); + + provisioningServiceDescription = iotDpsManager + .serviceClient() + .getIotDpsResources() + .createOrUpdate( + resourceGroup.name(), + provisioningServiceDescription.name(), + provisioningServiceDescription.withProperties(propertiesDescription)); + + // verify that the service returned view of the DPS instance has the right linked hubs + assertEquals(1, provisioningServiceDescription.properties().iotHubs().size()); + assertEquals(hubName + ".azure-devices.net", provisioningServiceDescription.properties().iotHubs().iterator().next().name()); + } finally { + // No matter if the test fails or not, delete the resource group that contains these test resources + resourceManager.resourceGroups().beginDeleteByName(resourceGroup.name()); + } + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/SharedAccessPolicyTests.java b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/SharedAccessPolicyTests.java new file mode 100644 index 000000000000..d97d7e69068d --- /dev/null +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/test/com/azure/resourcemanager/deviceprovisioningservices/SharedAccessPolicyTests.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.deviceprovisioningservices; + +import com.azure.core.test.annotation.DoNotRecord; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; +import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleInner; +import com.azure.resourcemanager.deviceprovisioningservices.models.AccessRightsDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException; +import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsPropertiesDescription; +import com.azure.resourcemanager.deviceprovisioningservices.models.SharedAccessSignatureAuthorizationRule; +import com.azure.resourcemanager.resources.ResourceManager; +import com.azure.resourcemanager.resources.models.ResourceGroup; +import org.junit.jupiter.api.Test; + +import java.net.HttpURLConnection; +import java.util.ArrayList; +import java.util.List; + +import static com.azure.resourcemanager.deviceprovisioningservices.Constants.OWNER_ACCESS_KEY_NAME; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; + +public class SharedAccessPolicyTests extends DeviceProvisioningTestBase +{ + @Test + @DoNotRecord(skipInPlayback = true) + public void SharedAccessPolicyCRUD() { + ResourceManager resourceManager = createResourceManager(); + IotDpsManager iotDpsManager = createIotDpsManager(); + ResourceGroup resourceGroup = createResourceGroup(resourceManager); + + try { + ProvisioningServiceDescriptionInner provisioningServiceDescription = + createProvisioningService(iotDpsManager, resourceGroup); + + // verify owner key has been created + SharedAccessSignatureAuthorizationRule ownerKey = + iotDpsManager + .iotDpsResources() + .listKeysForKeyName(provisioningServiceDescription.name(), OWNER_ACCESS_KEY_NAME, resourceGroup.name()); + + assertEquals(OWNER_ACCESS_KEY_NAME, ownerKey.keyName()); + + // verify that getting an undefined key makes listKeysForKeyName throw + try { + iotDpsManager + .iotDpsResources() + .listKeysForKeyName(provisioningServiceDescription.name(), "thisKeyDoesNotExist", resourceGroup.name()); + + fail("Getting a key that does not exist should have thrown an exception"); + } catch (ErrorDetailsException ex) { + assertEquals(HttpURLConnection.HTTP_NOT_FOUND, ex.getResponse().getStatusCode()); + } + + // verify that you can create a new key + String newKeyName = "someNewKey"; + AccessRightsDescription expectedAccessRights = AccessRightsDescription.DEVICE_CONNECT; + SharedAccessSignatureAuthorizationRuleInner newKey = + new SharedAccessSignatureAuthorizationRuleInner() + .withKeyName(newKeyName) + .withRights(expectedAccessRights); + + List authorizationPolicies = new ArrayList<>(2); + authorizationPolicies.add(ownerKey.innerModel()); + authorizationPolicies.add(newKey); + + IotDpsPropertiesDescription propertiesWithNewKey = provisioningServiceDescription + .properties() + .withAuthorizationPolicies(authorizationPolicies); + + ProvisioningServiceDescriptionInner serviceWithNewProperties = + provisioningServiceDescription.withProperties(propertiesWithNewKey); + + iotDpsManager + .serviceClient() + .getIotDpsResources() + .createOrUpdate( + resourceGroup.name(), + serviceWithNewProperties.name(), + serviceWithNewProperties); + + // after updating the service, the key should be retrievable + SharedAccessSignatureAuthorizationRule retrievedNewKey = iotDpsManager + .iotDpsResources() + .listKeysForKeyName(provisioningServiceDescription.name(), newKeyName, resourceGroup.name()); + + assertEquals(expectedAccessRights, retrievedNewKey.rights()); + + // verify that the new key can be deleted + provisioningServiceDescription.properties().authorizationPolicies().remove(newKey); + + iotDpsManager + .serviceClient() + .getIotDpsResources() + .createOrUpdate( + resourceGroup.name(), + provisioningServiceDescription.name(), + provisioningServiceDescription); + + // verify that the new key was deleted by attempting to retrieve it + try { + iotDpsManager + .iotDpsResources() + .listKeysForKeyName(provisioningServiceDescription.name(), newKeyName, resourceGroup.name()); + + fail("Getting a key that does not exist should have thrown an exception"); + } catch (ErrorDetailsException ex) { + assertEquals(HttpURLConnection.HTTP_NOT_FOUND, ex.getResponse().getStatusCode()); + } + } finally { + // No matter if the test fails or not, delete the resource group that contains these test resources + resourceManager.resourceGroups().beginDeleteByName(resourceGroup.name()); + } + } +} diff --git a/sdk/deviceprovisioningservices/ci.yml b/sdk/deviceprovisioningservices/ci.yml new file mode 100644 index 000000000000..db5137729054 --- /dev/null +++ b/sdk/deviceprovisioningservices/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/deviceprovisioningservices/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceprovisioningservices/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: deviceprovisioningservices + Artifacts: + - name: azure-resourcemanager-deviceprovisioningservices + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdeviceprovisioningservices diff --git a/sdk/deviceprovisioningservices/pom.xml b/sdk/deviceprovisioningservices/pom.xml new file mode 100644 index 000000000000..40af7c335f82 --- /dev/null +++ b/sdk/deviceprovisioningservices/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-deviceprovisioningservices-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-deviceprovisioningservices + + + + From 851796e2d21ed05093b84a3626555093c1912fd9 Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Tue, 1 Jun 2021 11:11:32 -0700 Subject: [PATCH 07/53] Adds AsyncCloseable (#21991) * Adding AsyncCloseable with codesnippet. * Implementing AsyncCloseable and deleting AsyncAutoCloseable. * Add CHANGELOG entry. * Removing azure-core as an explicit dependency. * Fix use in AmqpReceiveLinkProcessor. --- .../implementation/AmqpChannelProcessor.java | 5 +- .../implementation/AsyncAutoCloseable.java | 19 ----- .../amqp/implementation/ReactorReceiver.java | 3 +- .../amqp/implementation/ReactorSender.java | 3 +- .../RequestResponseChannel.java | 3 +- sdk/core/azure-core/CHANGELOG.md | 3 + .../com/azure/core/util/AsyncCloseable.java | 27 +++++++ .../AsyncCloseableJavaDocCodeSnippet.java | 79 +++++++++++++++++++ .../azure-messaging-eventhubs/pom.xml | 2 +- .../AmqpReceiveLinkProcessor.java | 6 +- .../azure-messaging-servicebus/pom.xml | 2 +- .../servicebus/ServiceBusSessionReceiver.java | 4 +- .../implementation/ServiceBusReceiveLink.java | 4 +- .../ServiceBusReceiveLinkProcessor.java | 6 +- .../servicebus/IntegrationTestBase.java | 6 +- 15 files changed, 133 insertions(+), 39 deletions(-) delete mode 100644 sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/AsyncAutoCloseable.java create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/util/AsyncCloseable.java create mode 100644 sdk/core/azure-core/src/samples/java/com/azure/core/util/AsyncCloseableJavaDocCodeSnippet.java diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/AmqpChannelProcessor.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/AmqpChannelProcessor.java index 02400669c49d..e8dac4df57b4 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/AmqpChannelProcessor.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/AmqpChannelProcessor.java @@ -6,6 +6,7 @@ import com.azure.core.amqp.AmqpEndpointState; import com.azure.core.amqp.AmqpRetryPolicy; import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.util.AsyncCloseable; import com.azure.core.util.logging.ClientLogger; import org.reactivestreams.Processor; import org.reactivestreams.Subscription; @@ -298,8 +299,8 @@ private void setAndClearChannel() { } private void close(T channel) { - if (channel instanceof AsyncAutoCloseable) { - ((AsyncAutoCloseable) channel).closeAsync().subscribe(); + if (channel instanceof AsyncCloseable) { + ((AsyncCloseable) channel).closeAsync().subscribe(); } else if (channel instanceof AutoCloseable) { try { ((AutoCloseable) channel).close(); diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/AsyncAutoCloseable.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/AsyncAutoCloseable.java deleted file mode 100644 index 391ed693174c..000000000000 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/AsyncAutoCloseable.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.amqp.implementation; - -import reactor.core.publisher.Mono; - -/** - * Asynchronous class to close resources. - */ -public interface AsyncAutoCloseable { - - /** - * Begins the close operation. If one is in progress, will return that existing close operation. - * - * @return A mono representing the close operation. - */ - Mono closeAsync(); -} diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorReceiver.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorReceiver.java index 17f76c3fafe6..b363954e0877 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorReceiver.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorReceiver.java @@ -8,6 +8,7 @@ import com.azure.core.amqp.AmqpRetryOptions; import com.azure.core.amqp.exception.AmqpErrorCondition; import com.azure.core.amqp.implementation.handler.ReceiveLinkHandler; +import com.azure.core.util.AsyncCloseable; import com.azure.core.util.logging.ClientLogger; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.amqp.Symbol; @@ -37,7 +38,7 @@ /** * Handles receiving events from Event Hubs service and translating them to proton-j messages. */ -public class ReactorReceiver implements AmqpReceiveLink, AsyncAutoCloseable, AutoCloseable { +public class ReactorReceiver implements AmqpReceiveLink, AsyncCloseable, AutoCloseable { private final String entityPath; private final Receiver receiver; private final ReceiveLinkHandler handler; diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorSender.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorSender.java index 2ee4b2eb2dfc..25e0988831e0 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorSender.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorSender.java @@ -12,6 +12,7 @@ import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.exception.OperationCancelledException; import com.azure.core.amqp.implementation.handler.SendLinkHandler; +import com.azure.core.util.AsyncCloseable; import com.azure.core.util.logging.ClientLogger; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.amqp.Binary; @@ -62,7 +63,7 @@ /** * Handles scheduling and transmitting events through proton-j to Event Hubs service. */ -class ReactorSender implements AmqpSendLink, AsyncAutoCloseable, AutoCloseable { +class ReactorSender implements AmqpSendLink, AsyncCloseable, AutoCloseable { private final String entityPath; private final Sender sender; private final SendLinkHandler handler; diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/RequestResponseChannel.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/RequestResponseChannel.java index 54704eb86d58..f7bed8c8242d 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/RequestResponseChannel.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/RequestResponseChannel.java @@ -9,6 +9,7 @@ import com.azure.core.amqp.exception.AmqpErrorContext; import com.azure.core.amqp.implementation.handler.ReceiveLinkHandler; import com.azure.core.amqp.implementation.handler.SendLinkHandler; +import com.azure.core.util.AsyncCloseable; import com.azure.core.util.logging.ClientLogger; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.amqp.UnsignedLong; @@ -50,7 +51,7 @@ * Represents a bidirectional link between the message broker and the client. Allows client to send a request to the * broker and receive the associated response. */ -public class RequestResponseChannel implements AsyncAutoCloseable { +public class RequestResponseChannel implements AsyncCloseable { private final ConcurrentSkipListMap> unconfirmedSends = new ConcurrentSkipListMap<>(); private final AtomicBoolean hasError = new AtomicBoolean(); diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 7f5fa70d1549..0e9031ee19ea 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -2,6 +2,9 @@ ## 1.17.0-beta.1 (Unreleased) +### Features Added + +- Added `AsyncCloseable` ## 1.16.0 (2021-05-07) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/AsyncCloseable.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/AsyncCloseable.java new file mode 100644 index 000000000000..2eede858adb3 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/AsyncCloseable.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.util; + +import reactor.core.publisher.Mono; + +/** + * Interface for close operations that are asynchronous. + * + *

Asynchronously closing a class

+ *

In the snippet below, we have a long-lived {@code NetworkResource} class. There are some operations such + * as closing {@literal I/O}. Instead of returning a sync {@code close()}, we use {@code closeAsync()} so users' + * programs don't block waiting for this operation to complete.

+ * + * {@codesnippet com.azure.core.util.AsyncCloseable.closeAsync} + */ +public interface AsyncCloseable { + /** + * Begins the close operation. If one is in progress, will return that existing close operation. If the close + * operation is unsuccessful, the Mono completes with an error. + * + * @return A Mono representing the close operation. If the close operation is unsuccessful, the Mono completes with + * an error. + */ + Mono closeAsync(); +} diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/AsyncCloseableJavaDocCodeSnippet.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/AsyncCloseableJavaDocCodeSnippet.java new file mode 100644 index 000000000000..b5f5a21aed64 --- /dev/null +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/AsyncCloseableJavaDocCodeSnippet.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.util; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.publisher.Sinks; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.IntStream; + +/** + * Code snippets for {@link AsyncCloseable}. + */ +public class AsyncCloseableJavaDocCodeSnippet { + public void asyncResource() throws IOException { + // BEGIN: com.azure.core.util.AsyncCloseable.closeAsync + NetworkResource resource = new NetworkResource(); + resource.longRunningDownload("https://longdownload.com") + .subscribe( + byteBuffer -> System.out.println("Buffer received: " + byteBuffer), + error -> System.err.printf("Error occurred while downloading: %s%n", error), + () -> System.out.println("Completed download operation.")); + + System.out.println("Press enter to stop downloading."); + System.in.read(); + + // We block here because it is the end of the main Program function. A real-life program may chain this + // with some other close operations like save download/program state, etc. + resource.closeAsync().block(); + // END: com.azure.core.util.AsyncCloseable.closeAsync + } + + /** + * A long lived network resource. + */ + static class NetworkResource implements AsyncCloseable { + private final AtomicBoolean isClosed = new AtomicBoolean(); + private final Sinks.Empty closeMono = Sinks.empty(); + + /** + * Downloads a resource. + * + * @param url URL for the download. + * + * @return A stream of bytes. + */ + Flux longRunningDownload(String url) { + final byte[] bytes = url.getBytes(StandardCharsets.UTF_8); + + // Does nothing real but it represents taking from this possibly infinite Flux until + // the closeMono emits a signal. + return Flux.fromStream(IntStream.range(0, bytes.length) + .mapToObj(index -> ByteBuffer.wrap(bytes))) + .takeUntilOther(closeMono.asMono()); + } + + @Override + public Mono closeAsync() { + // If the close operation has started, then + if (isClosed.getAndSet(true)) { + return closeMono.asMono(); + } + + return startAsyncClose().then(closeMono.asMono()); + } + + private Mono startAsyncClose() { + return Mono.delay(Duration.ofSeconds(10)).then() + .doOnError(error -> closeMono.emitError(error, Sinks.EmitFailureHandler.FAIL_FAST)) + .doOnSuccess(unused -> closeMono.emitEmpty(Sinks.EmitFailureHandler.FAIL_FAST)); + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml index eeaf6c5b01ae..54f6df929347 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml @@ -37,7 +37,7 @@ com.azure azure-core - 1.16.0 + 1.17.0-beta.1 com.azure diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLinkProcessor.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLinkProcessor.java index 6699224b71d4..abceceef10d3 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLinkProcessor.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLinkProcessor.java @@ -9,7 +9,7 @@ import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.exception.LinkErrorContext; import com.azure.core.amqp.implementation.AmqpReceiveLink; -import com.azure.core.amqp.implementation.AsyncAutoCloseable; +import com.azure.core.util.AsyncCloseable; import com.azure.core.util.logging.ClientLogger; import org.apache.qpid.proton.message.Message; import org.reactivestreams.Subscription; @@ -599,8 +599,8 @@ private void disposeReceiver(AmqpReceiveLink link) { } try { - if (link instanceof AsyncAutoCloseable) { - ((AsyncAutoCloseable) link).closeAsync().subscribe(); + if (link instanceof AsyncCloseable) { + ((AsyncCloseable) link).closeAsync().subscribe(); } else { link.dispose(); } diff --git a/sdk/servicebus/azure-messaging-servicebus/pom.xml b/sdk/servicebus/azure-messaging-servicebus/pom.xml index 13ffa9083886..23004b35e5d2 100644 --- a/sdk/servicebus/azure-messaging-servicebus/pom.xml +++ b/sdk/servicebus/azure-messaging-servicebus/pom.xml @@ -42,7 +42,7 @@ com.azure azure-core - 1.16.0 + 1.17.0-beta.1 com.azure diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusSessionReceiver.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusSessionReceiver.java index f865191c5509..03995a2cb0a3 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusSessionReceiver.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusSessionReceiver.java @@ -3,8 +3,8 @@ package com.azure.messaging.servicebus; import com.azure.core.amqp.AmqpRetryOptions; -import com.azure.core.amqp.implementation.AsyncAutoCloseable; import com.azure.core.amqp.implementation.MessageSerializer; +import com.azure.core.util.AsyncCloseable; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.servicebus.implementation.LockContainer; @@ -29,7 +29,7 @@ /** * Represents an session that is received when "any" session is accepted from the service. */ -class ServiceBusSessionReceiver implements AsyncAutoCloseable, AutoCloseable { +class ServiceBusSessionReceiver implements AsyncCloseable, AutoCloseable { private final AtomicBoolean isDisposed = new AtomicBoolean(); private final LockContainer lockContainer; private final AtomicReference sessionLockedUntil = new AtomicReference<>(); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLink.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLink.java index 403b66f32477..8e41bde7bd9e 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLink.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLink.java @@ -4,7 +4,7 @@ package com.azure.messaging.servicebus.implementation; import com.azure.core.amqp.implementation.AmqpReceiveLink; -import com.azure.core.amqp.implementation.AsyncAutoCloseable; +import com.azure.core.util.AsyncCloseable; import org.apache.qpid.proton.amqp.transport.DeliveryState; import reactor.core.publisher.Mono; @@ -13,7 +13,7 @@ /** * Represents an AMQP receive link. */ -public interface ServiceBusReceiveLink extends AmqpReceiveLink, AsyncAutoCloseable { +public interface ServiceBusReceiveLink extends AmqpReceiveLink, AsyncCloseable { /** * Gets the session id associated with the link. * diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessor.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessor.java index d242b3a4727b..47aa31ebcd4b 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessor.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessor.java @@ -6,7 +6,7 @@ import com.azure.core.amqp.AmqpEndpointState; import com.azure.core.amqp.AmqpRetryPolicy; import com.azure.core.amqp.implementation.AmqpReceiveLink; -import com.azure.core.amqp.implementation.AsyncAutoCloseable; +import com.azure.core.util.AsyncCloseable; import com.azure.core.util.logging.ClientLogger; import org.apache.qpid.proton.amqp.transport.DeliveryState; import org.apache.qpid.proton.message.Message; @@ -585,8 +585,8 @@ private void disposeReceiver(AmqpReceiveLink link) { } try { - if (link instanceof AsyncAutoCloseable) { - ((AsyncAutoCloseable) link).closeAsync().subscribe(); + if (link instanceof AsyncCloseable) { + ((AsyncCloseable) link).closeAsync().subscribe(); } else { link.dispose(); } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/IntegrationTestBase.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/IntegrationTestBase.java index a063615b0228..4d65ca84d837 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/IntegrationTestBase.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/IntegrationTestBase.java @@ -6,9 +6,9 @@ import com.azure.core.amqp.AmqpTransportType; import com.azure.core.amqp.ProxyAuthenticationType; import com.azure.core.amqp.ProxyOptions; -import com.azure.core.amqp.implementation.AsyncAutoCloseable; import com.azure.core.test.TestBase; import com.azure.core.test.TestMode; +import com.azure.core.util.AsyncCloseable; import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; @@ -335,8 +335,8 @@ protected void dispose(AutoCloseable... closeables) { continue; } - if (closeable instanceof AsyncAutoCloseable) { - final Mono voidMono = ((AsyncAutoCloseable) closeable).closeAsync(); + if (closeable instanceof AsyncCloseable) { + final Mono voidMono = ((AsyncCloseable) closeable).closeAsync(); closeableMonos.add(voidMono); voidMono.subscribe(); From 448af764cc29662adf655ec8fb42edd36d3ad916 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 1 Jun 2021 14:20:31 -0400 Subject: [PATCH 08/53] Sync eng/common directory with azure-sdk-tools for PR 1611 (#21853) * Add API status check --- .../scripts/Helpers/ApiView-Helpers.ps1 | 55 +++++++++++++++++++ eng/common/scripts/Prepare-Release.ps1 | 21 +++++++ 2 files changed, 76 insertions(+) create mode 100644 eng/common/scripts/Helpers/ApiView-Helpers.ps1 diff --git a/eng/common/scripts/Helpers/ApiView-Helpers.ps1 b/eng/common/scripts/Helpers/ApiView-Helpers.ps1 new file mode 100644 index 000000000000..3be12566e239 --- /dev/null +++ b/eng/common/scripts/Helpers/ApiView-Helpers.ps1 @@ -0,0 +1,55 @@ +function MapLanguageName($language) +{ + $lang = $language + # Update language name to match those in API cosmos DB. Cosmos SQL is case sensitive and handling this within the query makes it slow. + if($lang -eq 'javascript'){ + $lang = "JavaScript" + } + elseif ($lang -eq "dotnet"){ + $lang = "C#" + } + elseif ($lang -eq "java"){ + $lang = "Java" + } + elseif ($lang -eq "python"){ + $lang = "Python" + } + else{ + $lang = $null + } + return $lang +} + +function Check-ApiReviewStatus($packageName, $packageVersion, $language, $url, $apiKey) +{ + # Get API view URL and API Key to check status + Write-Host "Checking API review status" + $lang = MapLanguageName -language $language + if ($lang -eq $null) { + return + } + $headers = @{ "ApiKey" = $apiKey } + $body = @{ + language = $lang + packageName = $packageName + packageVersion = $packageVersion + } + + try + { + $response = Invoke-WebRequest $url -Method 'GET' -Headers $headers -Body $body + if ($response.StatusCode -eq '200') + { + Write-Host "API Review is approved for package $($packageName)" + } + else + { + Write-Warning "API Review is not approved for package $($packageName). Release pipeline will fail if API review is not approved." + Write-Host "You can check http://aka.ms/azsdk/engsys/apireview/faq for more details on API Approval." + } + } + catch + { + Write-Warning "Failed to check API review status for package $($PackageName). You can check http://aka.ms/azsdk/engsys/apireview/faq for more details on API Approval." + } +} \ No newline at end of file diff --git a/eng/common/scripts/Prepare-Release.ps1 b/eng/common/scripts/Prepare-Release.ps1 index 2c7b61522048..eed113299a2e 100644 --- a/eng/common/scripts/Prepare-Release.ps1 +++ b/eng/common/scripts/Prepare-Release.ps1 @@ -49,6 +49,7 @@ param( Set-StrictMode -Version 3 . ${PSScriptRoot}\common.ps1 +. ${PSScriptRoot}\Helpers\ApiView-Helpers.ps1 function Get-ReleaseDay($baseDate) { @@ -141,6 +142,26 @@ if ($LASTEXITCODE -ne 0) { exit 1 } +# Check API status if version is GA +if (!$newVersionParsed.IsPrerelease) +{ + try + { + az account show *> $null + if (!$?) { + Write-Host 'Running az login...' + az login *> $null + } + $url = az keyvault secret show --name "APIURL" --vault-name "AzureSDKPrepRelease-KV" --query "value" --output "tsv" + $apiKey = az keyvault secret show --name "APIKEY" --vault-name "AzureSDKPrepRelease-KV" --query "value" --output "tsv" + Check-ApiReviewStatus -PackageName $packageProperties.Name -packageVersion $newVersion -Language $LanguageDisplayName -url $url -apiKey $apiKey + } + catch + { + Write-Warning "Failed to get APIView URL and API Key from Keyvault AzureSDKPrepRelease-KV. Please check and ensure you have access to this Keyvault as reader." + } +} + if ($releaseTrackingOnly) { Write-Host From ba629dd694d3b7b9376b68835db61461ac30a16c Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 1 Jun 2021 14:45:41 -0400 Subject: [PATCH 09/53] Increment package version after release of com.azure.resourcemanager azure-resourcemanager-deviceprovisioningservices (#21994) --- eng/versioning/version_client.txt | 2 +- .../CHANGELOG.md | 3 +++ .../azure-resourcemanager-deviceprovisioningservices/pom.xml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 9d103cf6e917..7242e482492d 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -297,7 +297,7 @@ com.azure.resourcemanager:azure-resourcemanager-imagebuilder;1.0.0-beta.1;1.0.0- com.azure.resourcemanager:azure-resourcemanager-maps;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-botservice;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-recoveryservicesbackup;1.0.0-beta.1;1.0.0-beta.2 -com.azure.resourcemanager:azure-resourcemanager-deviceprovisioningservices;1.0.0;1.0.0 +com.azure.resourcemanager:azure-resourcemanager-deviceprovisioningservices;1.0.0;1.1.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/CHANGELOG.md b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/CHANGELOG.md index ed9f890b1cfa..1396cce76b75 100644 --- a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/CHANGELOG.md +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/CHANGELOG.md @@ -1,5 +1,8 @@ # Release History +## 1.1.0-beta.1 (Unreleased) + + ## 1.0.0 (2021-05-28) Initial release of the Java Resource Management SDK for Device Provisioning Service. diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml index 8dbf83e7e31c..e76bef539de2 100644 --- a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml @@ -9,7 +9,7 @@ com.azure.resourcemanager azure-resourcemanager-deviceprovisioningservices - 1.0.0 + 1.1.0-beta.1 jar Microsoft Azure SDK for IotDps Management From f064db0231d383f130612541a4fec8a5b543b31f Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Tue, 1 Jun 2021 11:48:18 -0700 Subject: [PATCH 10/53] Update Build Script to Perform Additional Tasks (#21993) --- eng/precommit_local_build.py | 47 ++++++++++++++------- sdk/parents/azure-client-sdk-parent/pom.xml | 40 +++++++++++++++++- 2 files changed, 70 insertions(+), 17 deletions(-) diff --git a/eng/precommit_local_build.py b/eng/precommit_local_build.py index 83eb5dd5b0e2..88ab07c082b2 100644 --- a/eng/precommit_local_build.py +++ b/eng/precommit_local_build.py @@ -73,15 +73,17 @@ def get_artifacts_from_pom(pom_path: str, build_artifacts: list, debug: bool): def main(): parser = argparse.ArgumentParser(description='Runs compilation, testing, and linting for the passed artifacts.') - parser.add_argument('--artifacts', '--a', type=str, default=None, help='Comma separated list of groupId:artifactId identifiers') - parser.add_argument('--poms', '--p', type=str, default=None, help='Comma separated list of POM paths') - parser.add_argument('--skip-tests', '--st', action='store_true', help='Skips running tests') - parser.add_argument('--skip-javadocs', '--sj', action='store_true', help='Skips javadoc generation') - parser.add_argument('--skip-checkstyle', '--sc', action='store_true', help='Skips checkstyle linting') - parser.add_argument('--skip-spotbugs', '--ss', action='store_true', help='Skips spotbugs linting') - parser.add_argument('--skip-revapi', '--sr', action='store_true', help='Skips revapi linting') - parser.add_argument('--command-only', '--co', action='store_true', help='Indicates that only the command should be generated and not ran') - parser.add_argument('--debug', '--d', action='store_true', help='Generates command with verbose logging') + parser.add_argument('--artifacts', '-a', type=str, default=None, help='Comma separated list of groupId:artifactId identifiers') + parser.add_argument('--poms', '-p', type=str, default=None, help='Comma separated list of POM paths') + parser.add_argument('--skip-tests', '-st', action='store_true', help='Skips running tests') + parser.add_argument('--skip-javadocs', '-sj', action='store_true', help='Skips javadoc generation') + parser.add_argument('--skip-checkstyle', '-sc', action='store_true', help='Skips checkstyle linting') + parser.add_argument('--skip-spotbugs', '-ss', action='store_true', help='Skips spotbugs linting') + parser.add_argument('--skip-revapi', '-sr', action='store_true', help='Skips revapi linting') + parser.add_argument('--skip-readme', '-smd', action='store_true', help='Skips README validation') + parser.add_argument('--skip-changelog', '-scl', action='store_true', help='Skips CHANGELOG validation') + parser.add_argument('--command-only', '-co', action='store_true', help='Indicates that only the command should be generated and not ran') + parser.add_argument('--debug', '-d', action='store_true', help='Generates command with verbose logging') args = parser.parse_args() if args.artifacts == None and args.poms == None: @@ -101,23 +103,36 @@ def main(): if build_artifacts.count == 0: raise ValueError('No build artifacts found.') - skip_arguments = [] + arguments = [] if args.skip_tests: - skip_arguments.append('"-DskipTests=true"') + arguments.append('"-DskipTests=true"') if args.skip_javadocs: - skip_arguments.append('"-Dmaven.javadocs.skip=true"') + arguments.append('"-Dmaven.javadocs.skip=true"') if args.skip_checkstyle: - skip_arguments.append('"-Dcheckstyle.skip=true"') + arguments.append('"-Dcheckstyle.skip=true"') if args.skip_spotbugs: - skip_arguments.append('"-Dspotbugs.skip=true"') + arguments.append('"-Dspotbugs.skip=true"') if args.skip_revapi: - skip_arguments.append('"-Drevapi.skip=true"') + arguments.append('"-Drevapi.skip=true"') - maven_command = base_command.format(','.join(list(set(build_artifacts))), ' '.join(skip_arguments)) + if not args.skip_readme: + arguments.append('"-Dverify-readme"') + + if not args.skip_changelog: + arguments.append('"-Dverify-changelog"') + + # If Checkstyle, Spotbugs, or RevApi is being ran install sdk-build-tools to ensure the linting configuration is up-to-date. + if not args.skip_checkstyle or not args.skip_spotbugs or not args.skip_revapi: + if debug: + print('Installing sdk-build-tools as Checkstyle, Spotbugs, or RevApi linting is being performed.') + + os.system('mvn install -f ' + os.path.join('eng', 'code-quality-reports', 'pom.xml')) + + maven_command = base_command.format(','.join(list(set(build_artifacts))), ' '.join(arguments)) print('Running Maven command: {}'.format(maven_command)) diff --git a/sdk/parents/azure-client-sdk-parent/pom.xml b/sdk/parents/azure-client-sdk-parent/pom.xml index 4b7d8b29c13a..71f4c2b094db 100644 --- a/sdk/parents/azure-client-sdk-parent/pom.xml +++ b/sdk/parents/azure-client-sdk-parent/pom.xml @@ -985,7 +985,7 @@ - + verify-readme @@ -1022,6 +1022,44 @@ + + + verify-changelog + + + verify-changelog + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + verify-readme-codesnippet + prepare-package + + exec + + + pwsh + + ${project.basedir}/${relative.path.to.eng.folder}/eng/common/scripts/Verify-Changelog.ps1 + -ChangeLogLocation + ${project.basedir}/CHANGELOG.md + -VersionString + ${project.version} + + + + + + + + + dependency-checker From a0c60afd3287595675c524af6c3160901250bc34 Mon Sep 17 00:00:00 2001 From: Pallavi Taneja Date: Tue, 1 Jun 2021 12:15:43 -0700 Subject: [PATCH 11/53] Arch board review feedback for ACR (#21913) * Update ACR changes * Update the swagger to the new values. * read me update * Add support for ACR beta 3 * Incorporate CR comments --- .../README.md | 69 +- .../ContainerRegistryAsyncClient.java | 44 +- .../ContainerRegistryClient.java | 48 +- .../ContainerRegistryClientBuilder.java | 43 +- .../ContainerRepository.java | 70 +- .../ContainerRepositoryAsync.java | 104 +- .../containerregistry/RegistryArtifact.java | 106 +- .../RegistryArtifactAsync.java | 134 +- .../containers/containerregistry/Utils.java | 2 + .../ArtifactManifestPropertiesHelper.java | 8 +- .../ContainerRegistriesImpl.java | 46 +- ...ntainerRegistryRefreshTokenCredential.java | 6 +- .../ContainerRegistryTokenService.java | 4 +- .../models/ArtifactManifestProperties.java | 19 +- .../models/ContainerRepositoryProperties.java | 240 ++ .../models/ManifestAttributesBase.java | 19 +- .../models/ManifestAttributesManifest.java | 8 +- .../models/ArtifactManifestOrderBy.java | 37 + ...nce.java => ArtifactManifestPlatform.java} | 6 +- .../models/ArtifactManifestProperties.java | 26 +- .../models/ArtifactTagOrderBy.java | 37 + .../models/ArtifactTagProperties.java | 5 - ...ava => ContainerRepositoryProperties.java} | 12 +- .../models/ManifestOrderBy.java | 37 - .../containerregistry/models/TagOrderBy.java | 37 - .../AnonymousAsyncClientThrows.java | 11 +- ...nerRegistryAsyncClientJavaDocSnippets.java | 153 + ...ontainerRegistryClientJavaDocSnippets.java | 157 + ...tainerRepositoryAsyncJavaDocSnippets.java} | 62 +- .../ContainerRepositoryJavaDocSnippets.java | 66 +- .../containerregistry/DeleteImagesAsync.java | 7 +- .../ListRepositoryNamesAsync.java | 3 + .../containerregistry/ListTagsAsync.java | 7 +- .../containerregistry/ReadmeSamples.java | 15 +- .../RegistryArtifactAsyncJavaDocSnippets.java | 80 +- .../RegistryArtifactJavaDocSnippets.java | 100 +- ...UpdateRegistryArtifactPropertiesAsync.java | 3 + .../ContainerRegistryClientsTestBase.java | 22 +- ...tainerRepositoryAsyncIntegrationTests.java | 26 +- ...RegistryArtifactAsyncIntegrationTests.java | 51 +- .../RegistryArtifactTests.java | 4 +- .../ContainerRegistryTokenServiceTest.java | 1 + ...tegrationTests.getArtifactRegistry[1].json | 72 +- ...rationTests.getContainerRepository[1].json | 44 +- ...ts.listRepositoryNamesWithPageSize[1].json | 100 +- ...tegrationTests.listRepositoryNames[1].json | 44 +- ...ClientTest.deleteRepositoryFromMethod.json | 14 +- ...egistryClientTest.deleteRepository[1].json | 58 +- ...essTests.listAnonymousRepositories[1].json | 14 +- ...tegrationTests.getArtifactRegistry[1].json | 72 +- ...ionTests.getPropertiesWithResponse[1].json | 72 +- ...wnRepositoryPropertiesWithResponse[1].json | 86 +- ...istArtifactsWithPageSizeAndOrderBy[1].json | 268 +- ...listArtifactsWithPageSizeNoOrderBy[1].json | 184 +- ...ionTests.listArtifactsWithPageSize[1].json | 184 +- ...syncIntegrationTests.listArtifacts[1].json | 44 +- ...cIntegrationTests.updateProperties[1].json | 94 +- ...eImagePropertiesWithResponseThrows[1].json | 24 +- ...tectureImagePropertiesWithResponse[1].json | 148 +- ...getTagPropertiesWithResponseThrows[1].json | 72 +- ...cIntegrationTests.getTagProperties[1].json | 72 +- ...stTagPropertiesWithInvalidPageSize[1].json | 4 + ...agPropertiesWithPageSizeAndOrderBy[1].json | 549 +++ ...TagPropertiesWithPageSizeNoOrderBy[1].json | 412 +++ ...ests.listTagPropertiesWithPageSize[1].json | 320 ++ ...IntegrationTests.listTagProperties[1].json | 474 +++ ...tryArtifactTests.deleteFromRecordFile.json | 12 +- ...ArtifactTests.deleteTagFromRecordFile.json | 8 +- .../RegistryArtifactTests.deleteTag[1].json | 60 +- .../RegistryArtifactTests.delete[1].json | 100 +- ...factTests.updateManifestProperties[1].json | 154 +- ...yArtifactTests.updateTagProperties[1].json | 94 +- .../swagger/autorest.md | 12 +- .../swagger/containerregistry.json | 3093 ----------------- 74 files changed, 4082 insertions(+), 4811 deletions(-) create mode 100644 sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ContainerRepositoryProperties.java create mode 100644 sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestOrderBy.java rename sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/{ArtifactManifestReference.java => ArtifactManifestPlatform.java} (84%) create mode 100644 sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactTagOrderBy.java rename sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/{RepositoryProperties.java => ContainerRepositoryProperties.java} (92%) delete mode 100644 sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ManifestOrderBy.java delete mode 100644 sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/TagOrderBy.java create mode 100644 sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRegistryAsyncClientJavaDocSnippets.java create mode 100644 sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRegistryClientJavaDocSnippets.java rename sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/{ContainerAsyncRepositoryJavaDocSnippets.java => ContainerRepositoryAsyncJavaDocSnippets.java} (64%) create mode 100644 sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithInvalidPageSize[1].json create mode 100644 sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithPageSizeAndOrderBy[1].json create mode 100644 sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithPageSizeNoOrderBy[1].json create mode 100644 sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithPageSize[1].json create mode 100644 sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagProperties[1].json delete mode 100644 sdk/containerregistry/azure-containers-containerregistry/swagger/containerregistry.json diff --git a/sdk/containerregistry/azure-containers-containerregistry/README.md b/sdk/containerregistry/azure-containers-containerregistry/README.md index 85ff3828d7fa..772bc5bd0c18 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/README.md +++ b/sdk/containerregistry/azure-containers-containerregistry/README.md @@ -39,20 +39,20 @@ More information at [Azure Container Registry portal][container_registry_create_ ```Java - ContainerRegistryClient client = new ContainerRegistryClientBuilder() - .endpoint(endpoint) - .credential(credential) - .buildClient(); -} +DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); +ContainerRegistryClient client = new ContainerRegistryClientBuilder() + .endpoint(endpoint) + .credential(credential) + .buildClient(); ``` ```Java - ContainerRegistryAsyncClient client = new ContainerRegistryClientBuilder() - .endpoint(endpoint) - .credential(credential) - .buildAsyncClient(); -} +DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); +ContainerRegistryAsyncClient client = new ContainerRegistryClientBuilder() + .endpoint(endpoint) + .credential(credential) + .buildAsyncClient(); ``` For more information on using AAD with Azure Container Registry, please see the service's [Authentication Overview](https://docs.microsoft.com/azure/container-registry/container-registry-authentication). @@ -63,14 +63,14 @@ The user must use this setting on a registry that has been enabled for anonymous In this mode, the user can only call listRepositoryNames method and its overload. All the other calls will fail. For more information please read [Anonymous Pull Access](https://docs.microsoft.com/azure/container-registry/container-registry-faq#how-do-i-enable-anonymous-pull-access) - + ```Java ContainerRegistryClient client = new ContainerRegistryClientBuilder() .endpoint(endpoint) .buildClient(); ``` - + ```Java ContainerRegistryAsyncClient client = new ContainerRegistryClientBuilder() .endpoint(endpoint) @@ -105,7 +105,7 @@ For more information please see [Container Registry Concepts](https://docs.micro Iterate through the collection of repositories in the registry. - + ```Java DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); ContainerRegistryClient client = new ContainerRegistryClientBuilder() @@ -118,16 +118,16 @@ client.listRepositoryNames().forEach(repository -> System.out.println(repository ### List tags with anonymous access - + ```Java ContainerRegistryClient anonymousClient = new ContainerRegistryClientBuilder() .endpoint(endpoint) .buildClient(); RegistryArtifact image = anonymousClient.getArtifact(repositoryName, digest); -PagedIterable tags = image.listTags(); +PagedIterable tags = image.listTagProperties(); -System.out.printf(String.format("%s has the following aliases:", image.getFullyQualifiedName())); +System.out.printf(String.format("%s has the following aliases:", image.getFullyQualifiedReference())); for (ArtifactTagProperties tag : tags) { System.out.printf(String.format("%s/%s:%s", anonymousClient.getEndpoint(), repositoryName, tag.getName())); @@ -136,7 +136,7 @@ for (ArtifactTagProperties tag : tags) { ### Set artifact properties - + ```Java TokenCredential defaultCredential = new DefaultAzureCredentialBuilder().build(); @@ -156,7 +156,7 @@ image.updateTagProperties( ### Delete Images - + ```Java TokenCredential defaultCredential = new DefaultAzureCredentialBuilder().build(); @@ -171,8 +171,8 @@ for (String repositoryName : client.listRepositoryNames()) { // Obtain the images ordered from newest to oldest PagedIterable imageManifests = - repository.listManifests( - ManifestOrderBy.LAST_UPDATED_ON_DESCENDING, + repository.listManifestProperties( + ArtifactManifestOrderBy.LAST_UPDATED_ON_DESCENDING, Context.NONE); imageManifests.stream().skip(imagesCountToKeep) @@ -190,7 +190,7 @@ for (String repositoryName : client.listRepositoryNames()) { ``` ### Delete repository with anonymous access throws - + ```Java final String endpoint = getEndpoint(); final String repositoryName = getRepositoryName(); @@ -202,7 +202,7 @@ ContainerRegistryClient anonymousClient = new ContainerRegistryClientBuilder() try { anonymousClient.deleteRepository(repositoryName); System.out.println("Unexpected Success: Delete is not allowed on anonymous access"); -} catch (Exception ex) { +} catch (ClientAuthenticationException ex) { System.out.println("Expected exception: Delete is not allowed on anonymous access"); } ``` @@ -212,19 +212,20 @@ try { All container registry service operations will throw a [HttpResponseException][HttpResponseException] on failure. - + ```Java -DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); -ContainerRepository containerRepository = new ContainerRegistryClientBuilder() - .endpoint(endpoint) - .credential(credential) - .buildClient() - .getRepository(repositoryName); -try { - containerRepository.getProperties(); -} catch (HttpResponseException exception) { - // Do something with the exception. -} +public void getPropertiesThrows() { + DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); + ContainerRepository containerRepository = new ContainerRegistryClientBuilder() + .endpoint(endpoint) + .credential(credential) + .buildClient() + .getRepository(repositoryName); + try { + containerRepository.getProperties(); + } catch (HttpResponseException exception) { + // Do something with the exception. + } ``` ## Next steps diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryAsyncClient.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryAsyncClient.java index e8d602b98cfe..91ef42b93b63 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryAsyncClient.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryAsyncClient.java @@ -30,7 +30,10 @@ * *

Instantiating an asynchronous Container Registry client

* - * {@codesnippet com.azure.containers.containerregistry.async.repository.instantiation} + * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryAsyncClient.instantiation} + * + *

Instantiating an asynchronous Container Registry client using a custom pipeline

+ * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryAsyncClient.pipeline.instantiation} * *

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

* @@ -68,6 +71,10 @@ public String getEndpoint() { /** * List all the repository names in this registry. * + *

List repository names in the registry.

+ * + * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryAsyncClient.listRepositoryNames} + * * @return list of repository names. * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. */ @@ -112,11 +119,15 @@ Mono> listRepositoryNamesNextSinglePageAsync(String nextLi /** * Delete the repository identified by 'repositoryName'. * + *

Delete a repository in the registry.

+ * + * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryAsyncClient.deleteRepositoryWithResponse#String} + * * @param repositoryName Name of the repository (including the namespace). * @return the completion. * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. - * @throws NullPointerException thrown if the 'repositoryName' is null. - * @throws IllegalArgumentException thrown if the 'repositoryName' is null. + * @throws NullPointerException thrown if the {@code repositoryName} is null. + * @throws IllegalArgumentException thrown if the {@code repositoryName} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> deleteRepositoryWithResponse(String repositoryName) { @@ -142,13 +153,16 @@ Mono> deleteRepositoryWithResponse(String repositoryName, Context } /** - * Delete the repository identified by 'repositoryName'. + * Delete the repository identified by {@code repositoryName}. + * + *

Delete a repository in the registry.

+ * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryAsyncClient.deleteRepository#String} * * @param repositoryName Name of the image (including the namespace). - * @return deleted repository properties. + * @return the completion stream. * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. - * @throws NullPointerException thrown if the 'repositoryName' is null. - * @throws IllegalArgumentException thrown if 'repositoryName' is empty. + * @throws NullPointerException thrown if the {@code repositoryName} is null. + * @throws IllegalArgumentException thrown if {@code repositoryName} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteRepository(String repositoryName) { @@ -162,10 +176,13 @@ Mono deleteRepository(String repositoryName, Context context) { /** * Creates a new instance of {@link ContainerRepositoryAsync} object for the specified repository. * + *

Create an instance of ContainerRepositoryAsync helper type

+ * {@codesnippet com.azure.containers.containerregistry.containeregistryasyncclient.getRepository} + * * @param repositoryName Name of the repository to reference. * @return A new {@link ContainerRepositoryAsync} for the desired repository. - * @throws NullPointerException if 'repositoryName' is null. - * @throws IllegalArgumentException if 'repositoryName' is empty. + * @throws NullPointerException if {@code repositoryName} is null. + * @throws IllegalArgumentException if {@code repositoryName} is empty. */ public ContainerRepositoryAsync getRepository(String repositoryName) { return new ContainerRepositoryAsync(repositoryName, httpPipeline, endpoint, apiVersion); @@ -174,13 +191,14 @@ public ContainerRepositoryAsync getRepository(String repositoryName) { /** * Creates a new instance of {@link RegistryArtifactAsync} object for the specified artifact. * + *

Create an instance of RegistryArtifactAsync helper type

+ * {@codesnippet com.azure.containers.containerregistry.containeregistryasyncclient.getArtifact} + * * @param repositoryName Name of the repository to reference. * @param digest Either a tag or digest that uniquely identifies the artifact. * @return A new {@link RegistryArtifactAsync RegistryArtifactAsync} for the desired repository. - * @throws NullPointerException if 'repositoryName' is null. - * @throws IllegalArgumentException if 'repositoryName' is empty. - * @throws NullPointerException if 'digest' is null. - * @throws IllegalArgumentException if 'digest' is empty. + * @throws NullPointerException if {@code repositoryName} or {@code digest} is null. + * @throws IllegalArgumentException if {@code repositoryName} or {@code digest} is empty. */ public RegistryArtifactAsync getArtifact(String repositoryName, String digest) { return new RegistryArtifactAsync(repositoryName, digest, httpPipeline, endpoint, apiVersion); diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClient.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClient.java index 1696291d19d7..a980ea0504bf 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClient.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClient.java @@ -18,8 +18,10 @@ * that can be used to perform operations on repository and artifacts. * *

Instantiating a synchronous Container Registry client

+ * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryClient.instantiation} * - * {@codesnippet com.azure.containers.containerregistry.repository.instantiation} + *

Instantiating a synchronous Container Registry client with custom pipeline

+ * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryClient.pipeline.instantiation} * *

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

* @@ -44,7 +46,11 @@ public String getEndpoint() { /** * List all the repository names in this registry. * - * @return list of repositories. + *

List the repository names in the registry.

+ * + * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryClient.listRepositoryNames} + * + * @return list of repository names. * @throws ClientAuthenticationException thrown if the client credentials do not have access to perform this operation. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -55,6 +61,9 @@ public PagedIterable listRepositoryNames() { /** * List all the repository names in this registry. * + *

List the repository names in the registry.

+ * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryClient.listRepositoryNames#Context} + * * @param context The context to associate with this operation. * @return list of repositories. * @throws ClientAuthenticationException thrown if the client credentials do not have access to perform this operation. @@ -65,12 +74,15 @@ public PagedIterable listRepositoryNames(Context context) { } /** - * Delete the repository identified by 'repositoryName'. + * Delete the repository identified by {@code repositoryName}. + * + *

Delete a repository in the registry.

+ * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryClient.deleteRepository#String} * * @param repositoryName Name of the repository (including the namespace). * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. - * @throws NullPointerException thrown if the 'repositoryName' is null. - * @throws IllegalArgumentException thrown if the 'repositoryName' is empty. + * @throws NullPointerException thrown if the {@code repositoryName} is null. + * @throws IllegalArgumentException thrown if the {@code repositoryName} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) public void deleteRepository(String repositoryName) { @@ -78,14 +90,17 @@ public void deleteRepository(String repositoryName) { } /** - * Delete the repository identified by 'repositoryName'. + * Delete the repository identified by {@code repositoryName}. + * + *

Delete a repository in the registry.

+ * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryClient.deleteRepositoryWithResponse#String-Context} * * @param repositoryName Name of the repository (including the namespace). * @param context The context to associate with this operation. * @return Completion response. * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. - * @throws NullPointerException thrown if the 'repositoryName' is null. - * @throws IllegalArgumentException thrown if the 'repositoryName' is empty. + * @throws NullPointerException thrown if the {@code repositoryName} is null. + * @throws IllegalArgumentException thrown if the {@code repositoryName} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteRepositoryWithResponse(String repositoryName, Context context) { @@ -95,10 +110,13 @@ public Response deleteRepositoryWithResponse(String repositoryName, Contex /** * Creates a new instance of {@link ContainerRepository} object for the specified repository. * + *

Create a ContainerRegistry helper instance.

+ * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryClient.getRepository} + * * @param repositoryName Name of the repository to reference. * @return A new {@link ContainerRepository} for the desired repository. - * @throws NullPointerException if 'repositoryName' is null. - * @throws IllegalArgumentException if 'repositoryName' is empty. + * @throws NullPointerException if {@code repositoryName} is null. + * @throws IllegalArgumentException if {@code repositoryName} is empty. */ public ContainerRepository getRepository(String repositoryName) { return new ContainerRepository(this.asyncClient.getRepository(repositoryName)); @@ -107,13 +125,15 @@ public ContainerRepository getRepository(String repositoryName) { /** * Creates a new instance of {@link RegistryArtifact} object for the specified artifact. * + *

Create a RegistryArtifact helper instance.

+ * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryClient.getArtifact} + * + * * @param repositoryName Name of the repository to reference. * @param digest Either a tag or digest that uniquely identifies the artifact. * @return A new {@link RegistryArtifact} object for the desired repository. - * @throws NullPointerException if 'repositoryName' is null. - * @throws IllegalArgumentException if 'repositoryName' is empty. - * @throws NullPointerException if 'digest' is null. - * @throws IllegalArgumentException if 'digest' is empty. + * @throws NullPointerException if {@code repositoryName} or {@code digest} is null. + * @throws IllegalArgumentException if {@code repositoryName} or {@code digest} is empty. */ public RegistryArtifact getArtifact(String repositoryName, String digest) { return new RegistryArtifact(this.asyncClient.getArtifact(repositoryName, digest)); diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClientBuilder.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClientBuilder.java index 414d1e9ebe6b..649fe3b6a29b 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClientBuilder.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClientBuilder.java @@ -30,13 +30,11 @@ * the desired client. * *

The client needs the service endpoint of the Azure Container Registry and Azure access credentials. - *

Instantiating an asynchronous {@link ContainerRegistryAsyncClient}

+ *

Instantiating an asynchronous Container Registry client

+ * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryAsyncClient.instantiation} * - * {@codesnippet com.azure.containers.containerregistry.async.repository.instantiation} - * - *

Instantiating a synchronous Configuration Client

- * - * {@codesnippet com.azure.containers.containerregistry.repository.instantiation} + *

Instantiating a synchronous Container Registry client

+ * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryClient.instantiation} * *
* - *

Instantiating an asynchronous {@link ContainerRegistryAsyncClient}

- * - * {@codesnippet com.azure.containers.containerregistry.async.repository.pipeline.instantiation} - * - *

Instantiating a synchronous Configuration Client

+ *

Instantiating an asynchronous Container Registry client using a custom pipeline

+ * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryAsyncClient.pipeline.instantiation} * - * {@codesnippet com.azure.containers.containerregistry.repository.pipeline.instantiation} + *

Instantiating a synchronous Container Registry client with custom pipeline

+ * {@codesnippet com.azure.containers.containerregistry.ContainerRegistryClient.pipeline.instantiation} * * * @see ContainerRegistryAsyncClient @@ -88,6 +84,7 @@ public final class ContainerRegistryClientBuilder { private HttpLogOptions httpLogOptions; private RetryPolicy retryPolicy; private ContainerRegistryServiceVersion version; + private String authenticationScope; /** * Sets the service endpoint for the Azure Container Registry instance. @@ -107,6 +104,27 @@ public ContainerRegistryClientBuilder endpoint(String endpoint) { return this; } + /** + * Sets the authentication scope to be used for getting AAD credentials. + * + *

NOTE - This is a temporary property that is added into the system until the service + * exposes this directly via the challenge based auth scheme. + * If this property is not provided then by default Azure public scope is used for authentication. + *

+ * + *

+ * Example:- For Azure public cloud this value is same as AzureEnvironment.Azure.managementEndpoint(). + * For more information - http://azure.github.io/ref-docs/java/com/microsoft/azure/AzureEnvironment.html + *

+ * + * @param authenticationScope ARM management scope associated with the given registry. + * @return The updated {@link ContainerRegistryClientBuilder} object. + */ + public ContainerRegistryClientBuilder authenticationScope(String authenticationScope) { + this.authenticationScope = authenticationScope; + return this; + } + /** * Sets the {@link TokenCredential} used to authenticate REST API calls. * @@ -282,6 +300,7 @@ private HttpPipeline getHttpPipeline() { this.configuration, this.retryPolicy, this.credential, + this.authenticationScope, this.perCallPolicies, this.perRetryPolicies, this.httpClient, diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepository.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepository.java index d11b36682571..af21f01b5ff5 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepository.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepository.java @@ -4,8 +4,8 @@ package com.azure.containers.containerregistry; import com.azure.containers.containerregistry.models.ArtifactManifestProperties; -import com.azure.containers.containerregistry.models.ManifestOrderBy; -import com.azure.containers.containerregistry.models.RepositoryProperties; +import com.azure.containers.containerregistry.models.ArtifactManifestOrderBy; +import com.azure.containers.containerregistry.models.ContainerRepositoryProperties; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.exception.ClientAuthenticationException; @@ -22,7 +22,7 @@ * *

Instantiating Container Repository helper type.

* - * {@codesnippet com.azure.containers.containerregistry.repository.instantiation} + * {@codesnippet com.azure.containers.containerregistry.ContainerRepository.instantiation} * *

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

* @@ -64,7 +64,7 @@ public String getRegistryEndpoint() { * *

Delete the repository.

* - * {@codesnippet com.azure.containers.containerregistry.repository.deleteRepositoryWithResponse} + * {@codesnippet com.azure.containers.containerregistry.ContainerRepository.deleteRepositoryWithResponse} * * @param context Additional context that is passed through the Http pipeline during the service call. * artifacts that are deleted as part of the repository delete. @@ -84,7 +84,7 @@ public Response deleteWithResponse(Context context) { * *

Delete the repository.

* - * {@codesnippet com.azure.containers.containerregistry.repository.deleteRepository} + * {@codesnippet com.azure.containers.containerregistry.ContainerRepository.deleteRepository} * * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. @@ -95,33 +95,33 @@ public void delete() { } /** - * Gets the {@link RepositoryProperties properties} associated with the given {@link #getName() repository}. + * Gets the {@link ContainerRepositoryProperties properties} associated with the given {@link #getName() repository}. * *

Code Samples

* *

Get the properties for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.repository.getPropertiesWithResponse} + * {@codesnippet com.azure.containers.containerregistry.ContainerRepository.getPropertiesWithResponse} * * @param context Additional context that is passed through the Http pipeline during the service call. - * @return A REST response with the {@link RepositoryProperties properties} associated with the given {@link #getName() repository}. + * @return A REST response with the {@link ContainerRepositoryProperties properties} associated with the given {@link #getName() repository}. * @throws ClientAuthenticationException thrown if the client does not have access to modify the namespace. * @throws ResourceNotFoundException thrown if the repository with the given name was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getPropertiesWithResponse(Context context) { + public Response getPropertiesWithResponse(Context context) { return this.asyncClient.getPropertiesWithResponse(context).block(); } /** - * Gets the {@link RepositoryProperties properties} associated with the given {@link #getName() repository}. + * Gets the {@link ContainerRepositoryProperties properties} associated with the given {@link #getName() repository}. * *

Code Samples

* *

Get the properties for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.repository.getProperties} + * {@codesnippet com.azure.containers.containerregistry.ContainerRepository.getProperties} * * @return The{@link RepositoryProperties properties} associated with the given {@link #getName() repository}. * @throws ClientAuthenticationException thrown if the client does not have access to modify the namespace. @@ -129,7 +129,7 @@ public Response getPropertiesWithResponse(Context context) * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) - public RepositoryProperties getProperties() { + public ContainerRepositoryProperties getProperties() { return this.getPropertiesWithResponse(Context.NONE).getValue(); } @@ -138,8 +138,8 @@ public RepositoryProperties getProperties() { * * @param digest Either a tag or digest that uniquely identifies the artifact. * @return A new {@link RegistryArtifact} object for the desired repository. - * @throws NullPointerException if 'digest' is null. - * @throws IllegalArgumentException if 'digest' is empty. + * @throws NullPointerException if {@code digest} is null. + * @throws IllegalArgumentException if {@code digest} is empty. */ public RegistryArtifact getArtifact(String digest) { return new RegistryArtifact(this.asyncClient.getArtifact(digest)); @@ -149,7 +149,7 @@ public RegistryArtifact getArtifact(String digest) { * Fetches all the artifacts associated with the given {@link #getName() repository}. * *

If you would like to specify the order in which the tags are returned please - * use the overload that takes in the options parameter {@link #listManifests(ManifestOrderBy, Context)} listManifests} + * use the overload that takes in the options parameter {@link #listManifestProperties(ArtifactManifestOrderBy, Context)} listManifestProperties} * No assumptions on the order can be made if no options are provided to the service. *

* @@ -157,15 +157,15 @@ public RegistryArtifact getArtifact(String digest) { * *

Retrieve all artifacts associated with the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.repository.listManifests}. + * {@codesnippet com.azure.containers.containerregistry.ContainerRepository.listManifestProperties}. * * @return {@link PagedIterable} of the artifacts for the given repository in the order specified by the options. * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listManifests() { - return this.listManifests(ManifestOrderBy.NONE, Context.NONE); + public PagedIterable listManifestProperties() { + return this.listManifestProperties(ArtifactManifestOrderBy.NONE, Context.NONE); } /** @@ -180,7 +180,7 @@ public PagedIterable listManifests() { * *

Retrieve all artifacts associated with the given repository from the most recently updated to the last.

* - * {@codesnippet com.azure.containers.containerregistry.repository.listManifestsWithOptionsNoContext}. + * {@codesnippet com.azure.containers.containerregistry.ContainerRepository.listManifestPropertiesWithOptionsNoContext}. * * @param orderBy the order in which the artifacts are returned by the service. * @return {@link PagedIterable} of the artifacts for the given repository in the order specified by the options. @@ -188,8 +188,8 @@ public PagedIterable listManifests() { * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listManifests(ManifestOrderBy orderBy) { - return this.listManifests(orderBy, Context.NONE); + public PagedIterable listManifestProperties(ArtifactManifestOrderBy orderBy) { + return this.listManifestProperties(orderBy, Context.NONE); } /** @@ -204,7 +204,7 @@ public PagedIterable listManifests(ManifestOrderBy o * *

Retrieve all artifacts associated with the given repository from the most recently updated to the last.

* - * {@codesnippet com.azure.containers.containerregistry.repository.listManifestsWithOptions}. + * {@codesnippet com.azure.containers.containerregistry.ContainerRepository.listManifestPropertiesWithOptions}. * * @param orderBy the order in which the artifacts are returned by the service. * @param context Additional context that is passed through the Http pipeline during the service call. @@ -213,52 +213,52 @@ public PagedIterable listManifests(ManifestOrderBy o * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listManifests(ManifestOrderBy orderBy, Context context) { - return new PagedIterable<>(this.asyncClient.listManifests(orderBy, context)); + public PagedIterable listManifestProperties(ArtifactManifestOrderBy orderBy, Context context) { + return new PagedIterable<>(this.asyncClient.listManifestProperties(orderBy, context)); } /** - * Update the settable properties {@link RepositoryProperties} of the given {@link #getName() repository}. + * Update the settable properties {@link ContainerRepositoryProperties} of the given {@link #getName() repository}. * These properties set the update, delete and retrieve options of the repository. * *

Code Samples

* *

Update the writeable properties for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.repository.updatePropertiesWithResponse}. + * {@codesnippet com.azure.containers.containerregistry.ContainerRepository.updatePropertiesWithResponse}. * - * @param repositoryProperties {@link RepositoryProperties repository properties} that need to be updated for the repository. + * @param repositoryProperties {@link ContainerRepositoryProperties repository properties} that need to be updated for the repository. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A REST response with the completion. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws ResourceNotFoundException thrown if the repository with the given name was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. - * @throws NullPointerException thrown if the 'value' is null. + * @throws NullPointerException thrown if the {@code repositoryProperties} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updatePropertiesWithResponse(RepositoryProperties repositoryProperties, Context context) { + public Response updatePropertiesWithResponse(ContainerRepositoryProperties repositoryProperties, Context context) { return this.asyncClient.updatePropertiesWithResponse(repositoryProperties, context).block(); } /** - * Update the repository properties {@link RepositoryProperties} of the given {@link #getName() repository}. + * Update the repository properties {@link ContainerRepositoryProperties} of the given {@link #getName() repository}. * These properties set the update, delete and retrieve options of the repository. * *

Code Samples

* *

Update the writeable properties for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.repository.updateProperties}. + * {@codesnippet com.azure.containers.containerregistry.ContainerRepository.updateProperties}. * - * @param repositoryProperties {@link RepositoryProperties repository properties} that need to be updated for the repository. - * @return The updated {@link RepositoryProperties properties } + * @param repositoryProperties {@link ContainerRepositoryProperties repository properties} that need to be updated for the repository. + * @return The updated {@link ContainerRepositoryProperties properties } * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws ResourceNotFoundException thrown if the repository with the given name was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. - * @throws NullPointerException thrown if the 'value' is null. + * @throws NullPointerException thrown if the {@code repositoryProperties} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public RepositoryProperties updateProperties(RepositoryProperties repositoryProperties) { + public ContainerRepositoryProperties updateProperties(ContainerRepositoryProperties repositoryProperties) { return this.updatePropertiesWithResponse(repositoryProperties, Context.NONE).getValue(); } } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepositoryAsync.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepositoryAsync.java index d626b0c982d4..36ab90292831 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepositoryAsync.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepositoryAsync.java @@ -9,9 +9,9 @@ import com.azure.containers.containerregistry.implementation.ContainerRegistryImplBuilder; import com.azure.containers.containerregistry.implementation.models.ManifestAttributesBase; import com.azure.containers.containerregistry.implementation.models.RepositoryWriteableProperties; +import com.azure.containers.containerregistry.models.ArtifactManifestOrderBy; import com.azure.containers.containerregistry.models.ArtifactManifestProperties; -import com.azure.containers.containerregistry.models.ManifestOrderBy; -import com.azure.containers.containerregistry.models.RepositoryProperties; +import com.azure.containers.containerregistry.models.ContainerRepositoryProperties; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.exception.ClientAuthenticationException; @@ -40,7 +40,7 @@ * *

Instantiating an asynchronous Container Repository Helper class

* - * {@codesnippet com.azure.containers.containerregistry.async.repository.instantiation} + * {@codesnippet com.azure.containers.containerregistry.ContainerRepositoryAsync.instantiation} * */ public final class ContainerRepositoryAsync { @@ -112,7 +112,7 @@ public String getRegistryEndpoint() { * *

Delete the repository.

* - * {@codesnippet com.azure.containers.containerregistry.async.repository.deleteRepositoryWithResponse} + * {@codesnippet com.azure.containers.containerregistry.ContainerRepositoryAsync.deleteRepositoryWithResponse} * * @return A REST response containing the result of the repository delete operation. It returns the count of the tags and * artifacts that are deleted as part of the repository delete. @@ -141,7 +141,7 @@ Mono> deleteWithResponse(Context context) { * *

Delete the repository.

* - * {@codesnippet com.azure.containers.containerregistry.async.repository.deleteRepository} + * {@codesnippet com.azure.containers.containerregistry.ContainerRepositoryAsync.deleteRepository} * * @return It returns the count of the tags and artifacts that are deleted as part of the repository delete. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. @@ -157,8 +157,8 @@ public Mono delete() { * * @param digest Either a tag or digest that uniquely identifies the artifact. * @return A new {@link RegistryArtifactAsync} object for the desired repository. - * @throws NullPointerException if 'Digest' is null. - * @throws IllegalArgumentException if 'Digest' is empty. + * @throws NullPointerException if {@code digest} is null. + * @throws IllegalArgumentException if {@code digest} is empty. */ public RegistryArtifactAsync getArtifact(String digest) { return new RegistryArtifactAsync(repositoryName, digest, httpPipeline, endpoint, apiVersion); @@ -168,7 +168,7 @@ public RegistryArtifactAsync getArtifact(String digest) { * Fetches all the artifacts associated with the given {@link #getName() repository}. * *

If you would like to specify the order in which the tags are returned please - * use the overload that takes in the options parameter {@link #listManifests(ManifestOrderBy)} listManifests} + * use the overload that takes in the options parameter {@link #listManifestProperties(ArtifactManifestOrderBy)} listManifestProperties} * No assumptions on the order can be made if no options are provided to the service. *

* @@ -176,15 +176,15 @@ public RegistryArtifactAsync getArtifact(String digest) { * *

Retrieve all artifacts associated with the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.async.repository.listManifests}. + * {@codesnippet com.azure.containers.containerregistry.ContainerRepositoryAsync.listManifestProperties}. * * @return {@link PagedFlux} of ManifestProperties for all the artifacts in the given repository. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listManifests() { - return listManifests(ManifestOrderBy.NONE); + public PagedFlux listManifestProperties() { + return listManifestProperties(ArtifactManifestOrderBy.NONE); } /** @@ -198,7 +198,7 @@ public PagedFlux listManifests() { * *

Retrieve all artifacts associated with the given repository from the most recently updated to the last.

* - * {@codesnippet com.azure.containers.containerregistry.async.repository.listManifestsWithOptions}. + * {@codesnippet com.azure.containers.containerregistry.ContainerRepositoryAsync.listManifestPropertiesWithOptions}. * * @param orderBy The order in which the artifacts are returned by the service. * @return {@link PagedFlux} of the artifacts for the given repository in the order specified by the options. @@ -206,25 +206,25 @@ public PagedFlux listManifests() { * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listManifests(ManifestOrderBy orderBy) { + public PagedFlux listManifestProperties(ArtifactManifestOrderBy orderBy) { return new PagedFlux<>( - (pageSize) -> withContext(context -> listManifestsSinglePageAsync(pageSize, orderBy, context)), - (token, pageSize) -> withContext(context -> listManifestsNextSinglePageAsync(token, context))); + (pageSize) -> withContext(context -> listManifestPropertiesSinglePageAsync(pageSize, orderBy, context)), + (token, pageSize) -> withContext(context -> listManifestPropertiesNextSinglePageAsync(token, context))); } - PagedFlux listManifests(ManifestOrderBy orderBy, Context context) { + PagedFlux listManifestProperties(ArtifactManifestOrderBy orderBy, Context context) { return new PagedFlux<>( - (pageSize) -> listManifestsSinglePageAsync(pageSize, orderBy, context), - (token, pageSize) -> listManifestsNextSinglePageAsync(token, context)); + (pageSize) -> listManifestPropertiesSinglePageAsync(pageSize, orderBy, context), + (token, pageSize) -> listManifestPropertiesNextSinglePageAsync(token, context)); } - Mono> listManifestsSinglePageAsync(Integer pageSize, ManifestOrderBy orderBy, Context context) { + Mono> listManifestPropertiesSinglePageAsync(Integer pageSize, ArtifactManifestOrderBy orderBy, Context context) { try { if (pageSize != null && pageSize < 0) { return monoError(logger, new IllegalArgumentException("'pageSize' cannot be negative.")); } - final String orderByString = orderBy == ManifestOrderBy.NONE ? null : orderBy.toString(); + final String orderByString = orderBy == ArtifactManifestOrderBy.NONE ? null : orderBy.toString(); return this.serviceClient.getManifestsSinglePageAsync(repositoryName, null, pageSize, orderByString, context) .map(res -> Utils.getPagedResponseWithContinuationToken(res, this::mapManifestsProperties)) .onErrorMap(Utils::mapException); @@ -233,7 +233,7 @@ Mono> listManifestsSinglePageAsync(Int } } - Mono> listManifestsNextSinglePageAsync(String nextLink, Context context) { + Mono> listManifestPropertiesNextSinglePageAsync(String nextLink, Context context) { try { return this.serviceClient.getManifestsNextSinglePageAsync(nextLink, context) .map(res -> Utils.getPagedResponseWithContinuationToken(res, this::mapManifestsProperties)) @@ -258,7 +258,7 @@ private List mapManifestsProperties(List mapManifestsProperties(ListCode Samples

* *

Get the properties for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.async.repository.getPropertiesWithResponse} + * {@codesnippet com.azure.containers.containerregistry.ContainerRepositoryAsync.getPropertiesWithResponse} * - * @return A REST response with the {@link RepositoryProperties properties} associated with the given {@link #getName() repository}. + * @return A REST response with the {@link ContainerRepositoryProperties properties} associated with the given {@link #getName() repository}. * @throws ClientAuthenticationException thrown if the client have access to the repository. * @throws ResourceNotFoundException thrown if the repository with the given name was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPropertiesWithResponse() { + public Mono> getPropertiesWithResponse() { return withContext(context -> this.getPropertiesWithResponse(context)); } - Mono> getPropertiesWithResponse(Context context) { + Mono> getPropertiesWithResponse(Context context) { try { return this.serviceClient.getPropertiesWithResponseAsync(repositoryName, context) .onErrorMap(Utils::mapException); @@ -298,60 +298,60 @@ Mono> getPropertiesWithResponse(Context context) } /** - * Gets the {@link RepositoryProperties properties} associated with the given {@link #getName() repository}. + * Gets the {@link ContainerRepositoryProperties properties} associated with the given {@link #getName() repository}. * *

Code Samples

* *

Get the properties for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.async.repository.getProperties} + * {@codesnippet com.azure.containers.containerregistry.ContainerRepositoryAsync.getProperties} * - * @return The {@link RepositoryProperties properties} associated with the given {@link #getName() repository}. + * @return The {@link ContainerRepositoryProperties properties} associated with the given {@link #getName() repository}. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws ResourceNotFoundException thrown if the repository with the given name was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getProperties() { + public Mono getProperties() { return this.getPropertiesWithResponse().flatMap(FluxUtil::toMono); } /** - * Update the repository properties {@link RepositoryProperties} of the given {@link #getName() repository}. + * Update the repository properties {@link ContainerRepositoryProperties} of the given {@link #getName() repository}. * These properties set the update, delete and retrieve options of the repository. * *

Code Samples

* *

Update the writeable properties for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.async.repository.updatePropertiesWithResponse}. + * {@codesnippet com.azure.containers.containerregistry.ContainerRepositoryAsync.updatePropertiesWithResponse}. * - * @param value {@link RepositoryProperties repository properties} that need to be updated for the repository. - * @return The updated {@link RepositoryProperties repository properties }. + * @param repositoryProperties {@link ContainerRepositoryProperties repository properties} that need to be updated for the repository. + * @return The updated {@link ContainerRepositoryProperties repository properties }. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws ResourceNotFoundException thrown if the repository with the given name was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. - * @throws NullPointerException thrown if 'value' is null. + * @throws NullPointerException thrown if {@code repositoryProperties} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updatePropertiesWithResponse(RepositoryProperties value) { - return withContext(context -> this.updatePropertiesWithResponse(value, context)); + public Mono> updatePropertiesWithResponse(ContainerRepositoryProperties repositoryProperties) { + return withContext(context -> this.updatePropertiesWithResponse(repositoryProperties, context)); } - Mono> updatePropertiesWithResponse(RepositoryProperties value, Context context) { + Mono> updatePropertiesWithResponse(ContainerRepositoryProperties repositoryProperties, Context context) { try { - if (value == null) { + if (repositoryProperties == null) { return monoError(logger, new NullPointerException("'value' cannot be null.")); } RepositoryWriteableProperties writableProperties = new RepositoryWriteableProperties() - .setDeleteEnabled(value.isDeleteEnabled()) - .setListEnabled(value.isListEnabled()) - .setWriteEnabled(value.isWriteEnabled()) - .setReadEnabled(value.isReadEnabled()) - .setTeleportEnabled(value.isTeleportEnabled()); + .setDeleteEnabled(repositoryProperties.isDeleteEnabled()) + .setListEnabled(repositoryProperties.isListEnabled()) + .setWriteEnabled(repositoryProperties.isWriteEnabled()) + .setReadEnabled(repositoryProperties.isReadEnabled()) + .setTeleportEnabled(repositoryProperties.isTeleportEnabled()); - return this.serviceClient.setPropertiesWithResponseAsync(repositoryName, writableProperties, context) + return this.serviceClient.updatePropertiesWithResponseAsync(repositoryName, writableProperties, context) .onErrorMap(Utils::mapException); } catch (RuntimeException e) { return monoError(logger, e); @@ -359,24 +359,24 @@ Mono> updatePropertiesWithResponse(RepositoryProp } /** - * Update the repository properties {@link RepositoryProperties} of the given {@link #getName() repository}. + * Update the repository properties {@link ContainerRepositoryProperties} of the given {@link #getName() repository}. * These properties set the update, delete and retrieve options of the repository. * *

Code Samples

* *

Update the writeable properties for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.async.repository.updateProperties}. + * {@codesnippet com.azure.containers.containerregistry.ContainerRepositoryAsync.updateProperties}. * - * @param value {@link RepositoryProperties writeable properties} that need to be updated for the repository. + * @param repositoryProperties {@link ContainerRepositoryProperties writeable properties} that need to be updated for the repository. * @return The completion. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws ResourceNotFoundException thrown if the repository with the given name was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. - * @throws NullPointerException thrown if the 'value' is null. + * @throws NullPointerException thrown if the {@code repositoryProperties} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateProperties(RepositoryProperties value) { - return this.updatePropertiesWithResponse(value).flatMap(FluxUtil::toMono); + public Mono updateProperties(ContainerRepositoryProperties repositoryProperties) { + return this.updatePropertiesWithResponse(repositoryProperties).flatMap(FluxUtil::toMono); } } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifact.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifact.java index daf30a565a35..e46bcb217a12 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifact.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifact.java @@ -6,7 +6,7 @@ import com.azure.containers.containerregistry.models.ArtifactManifestProperties; import com.azure.containers.containerregistry.models.ArtifactTagProperties; -import com.azure.containers.containerregistry.models.TagOrderBy; +import com.azure.containers.containerregistry.models.ArtifactTagOrderBy; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.exception.ClientAuthenticationException; @@ -21,7 +21,7 @@ * *

Instantiating Registry Artifact

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.instantiation} + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.instantiation} */ public final class RegistryArtifact { private final RegistryArtifactAsync asyncClient; @@ -53,29 +53,21 @@ public String getRepositoryName() { } /** - * Gets the tag or digest for the current instance. - * @return Tag or digest information for the current instance. + * Gets the fully qualified reference for the current instance. + * @return Fully qualified reference of the current instance. * */ - public String getDigest() { - return this.asyncClient.getDigest(); + public String getFullyQualifiedReference() { + return this.asyncClient.getFullyQualifiedReference(); } /** - * Gets the fully qualified name for the current instance. - * @return Fully qualified name of the current instance. - * */ - public String getFullyQualifiedName() { - return this.asyncClient.getFullyQualifiedName(); - } - - /** - * Deletes the registry artifact with the matching digest {@link #getDigest()} in the given {@link #getRepositoryName() respository}. + * Deletes the registry artifact with the digest and repository associated with the instance. * *

Code Samples

* *

Delete the registry artifact.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.deleteWithResponse} + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.deleteWithResponse#Context} * * @param context Additional context that is passed through the Http pipeline during the service call. * @return A REST response containing the result of the service call. @@ -88,13 +80,13 @@ public Response deleteWithResponse(Context context) { } /** - * Deletes the registry artifact with the matching digest {@link #getDigest()} in the given {@link #getRepositoryName() respository}. + * Deletes the registry artifact with the digest and repository associated with the instance. * *

Code Samples

* *

Delete the registry artifact.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.delete} + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.delete} * * @throws ClientAuthenticationException thrown if the client does not have access to modify the namespace. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. @@ -111,14 +103,14 @@ public void delete() { * *

Delete the tag for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.deleteTagWithResponse} + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.deleteTagWithResponse} * * @param tag The name of the tag that needs to be deleted. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A REST response containing the result of the service call. * @throws ClientAuthenticationException thrown if the client does not have access to modify the namespace. - * @throws NullPointerException thrown if 'tag' is null. - * @throws IllegalArgumentException thrown if 'tag' is empty. + * @throws NullPointerException thrown if {@code tag} is null. + * @throws IllegalArgumentException thrown if {@code tag} is empty. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -133,12 +125,12 @@ public Response deleteTagWithResponse(String tag, Context context) { * *

Delete the tag for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.deleteTag} + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.deleteTag} * * @param tag The name of the tag that needs to be deleted. * @throws ClientAuthenticationException thrown if the client does not have access to modify the namespace. - * @throws NullPointerException thrown if 'tag' is null. - * @throws IllegalArgumentException throws if 'tag' is empty. + * @throws NullPointerException thrown if {@code tag} is null. + * @throws IllegalArgumentException throws if {@code tag} is empty. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -157,7 +149,7 @@ public void deleteTag(String tag) { * *

Get the properties for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.getManifestPropertiesWithResponse} + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.getManifestPropertiesWithResponse} * * @param context Additional context that is passed through the Http pipeline during the service call. * @return A REST response containing {@link ArtifactManifestProperties properties} associated with the given {@code Digest}. @@ -180,7 +172,7 @@ public Response getManifestPropertiesWithResponse(Co * *

Get the registry artifact properties for a given tag or digest.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.getManifestProperties}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.getManifestProperties}. * * @return The {@link ArtifactManifestProperties properties} associated with the given {@code Digest}. * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. @@ -199,15 +191,15 @@ public ArtifactManifestProperties getManifestProperties() { * *

Retrieve the properties associated with the given tag.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.getTagPropertiesWithResponse}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.getTagPropertiesWithResponse}. * * @param tag name of the tag. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A REST response with the {@link ArtifactTagProperties properties} associated with the given tag. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws ResourceNotFoundException thrown if the given tag was not found. - * @throws NullPointerException thrown if 'tag' is null. - * @throws IllegalArgumentException throws if 'tag' is empty. + * @throws NullPointerException thrown if {@code tag} is null. + * @throws IllegalArgumentException throws if {@code tag} is empty. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -223,14 +215,14 @@ public Response getTagPropertiesWithResponse(String tag, * *

Retrieve the properties associated with the given tag.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.getTagProperties}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.getTagProperties}. * * @param tag name of the tag. * @return The {@link ArtifactTagProperties properties} associated with the given tag. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws ResourceNotFoundException thrown if the given tag was not found. - * @throws NullPointerException thrown if 'tag' is null. - * @throws IllegalArgumentException throws if 'tag' is empty. + * @throws NullPointerException thrown if {@code tag} is null. + * @throws IllegalArgumentException throws if {@code tag} is empty. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -242,7 +234,7 @@ public ArtifactTagProperties getTagProperties(String tag) { * Fetches all the tags associated with the given {@link #getRepositoryName() repository}. * *

If you would like to specify the order in which the tags are returned please - * use the overload that takes in the options parameter {@link #listTags(TagOrderBy, Context)} listTags} + * use the overload that takes in the options parameter {@link #listTagProperties(ArtifactTagOrderBy, Context)} listTagProperties} * No assumptions on the order can be made if no options are provided to the service. *

* @@ -250,15 +242,15 @@ public ArtifactTagProperties getTagProperties(String tag) { * *

Retrieve all the tags associated with the given repository from the most recently updated to the last.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.listTagsWithOptions}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.listTagPropertiesWithOptions}. * * @return {@link PagedIterable} of the artifacts for the given repository in the order specified by the options. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listTags() { - return listTags(TagOrderBy.NONE, Context.NONE); + public PagedIterable listTagProperties() { + return listTagProperties(ArtifactTagOrderBy.NONE, Context.NONE); } /** @@ -273,7 +265,7 @@ public PagedIterable listTags() { * *

Retrieve all the tags associated with the given repository from the most recently updated to the last.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.listTagsWithOptionsNoContext}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.listTagPropertiesWithOptionsNoContext}. * * @param orderBy The order in which the tags should be returned by the service. * @return {@link PagedIterable} of the artifacts for the given repository in the order specified by the options. @@ -281,8 +273,8 @@ public PagedIterable listTags() { * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listTags(TagOrderBy orderBy) { - return this.listTags(orderBy, Context.NONE); + public PagedIterable listTagProperties(ArtifactTagOrderBy orderBy) { + return this.listTagProperties(orderBy, Context.NONE); } /** @@ -297,7 +289,7 @@ public PagedIterable listTags(TagOrderBy orderBy) { * *

Retrieve all the tags associated with the given repository from the most recently updated to the last.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.listTagsWithOptions}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.listTagPropertiesWithOptions}. * * @param orderBy The order in which the tags should be returned by the service. * @param context Additional context that is passed through the Http pipeline during the service call. @@ -306,8 +298,8 @@ public PagedIterable listTags(TagOrderBy orderBy) { * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listTags(TagOrderBy orderBy, Context context) { - return new PagedIterable(asyncClient.listTags(orderBy, context)); + public PagedIterable listTagProperties(ArtifactTagOrderBy orderBy, Context context) { + return new PagedIterable(asyncClient.listTagProperties(orderBy, context)); } /** @@ -318,17 +310,16 @@ public PagedIterable listTags(TagOrderBy orderBy, Context * *

Update the writeable properties of a given tag.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.updateTagPropertiesWithResponse}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.updateTagPropertiesWithResponse}. * * @param tag Name of the tag. * @param tagProperties {@link ArtifactTagProperties tagProperties} to be set. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A REST response for the completion. * @throws ClientAuthenticationException thrown if the client does not have access to repository. - * @throws ResourceNotFoundException thrown if the given 'tag' was not found. - * @throws NullPointerException thrown if 'tag' is null. - * @throws IllegalArgumentException thrown if 'tag' is empty. - * @throws NullPointerException thrown if 'tagProperties' is null. + * @throws ResourceNotFoundException thrown if the given {@code tag} was not found. + * @throws NullPointerException thrown if {@code tag} or {@code tagProperties} is null. + * @throws IllegalArgumentException thrown if {@code tag} or {@code tagProperties} is empty. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -344,16 +335,15 @@ public Response updateTagPropertiesWithResponse(String ta * *

Update the writeable properties of a given tag.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.updateTagProperties}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.updateTagProperties}. * * @param tag Name of the tag. * @param tagProperties {@link ArtifactTagProperties tagProperties} to be set. * @return The updated {@link ArtifactTagProperties properties } * @throws ClientAuthenticationException thrown if the client does not have access to repository. - * @throws ResourceNotFoundException thrown if the given tag was not found. - * @throws NullPointerException thrown if 'tag' is null. - * @throws IllegalArgumentException thrown if 'tag' is empty. - * @throws NullPointerException thrown if 'tagProperties' is null. + * @throws ResourceNotFoundException thrown if the given {@code tag} was not found. + * @throws NullPointerException thrown if {@code tag} or {@code tagProperties} is null. + * @throws IllegalArgumentException thrown if {@code tag} or {@code tagProperties} is empty. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -369,14 +359,14 @@ public ArtifactTagProperties updateTagProperties(String tag, ArtifactTagProperti * *

Update the writeable properties of a given artifact.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.updateManifestPropertiesWithResponse}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.updateManifestPropertiesWithResponse}. * * @param manifestProperties {@link ArtifactManifestProperties tagProperties} to be set. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A REST response for the completion. * @throws ClientAuthenticationException thrown if the client does not have access to repository. - * @throws NullPointerException thrown if the value is null. - * @throws ResourceNotFoundException thrown if the given digest was not found. + * @throws NullPointerException thrown if the {@code manifestProperties} is null. + * @throws ResourceNotFoundException thrown if the given {@code digest} was not found. */ public Response updateManifestPropertiesWithResponse(ArtifactManifestProperties manifestProperties, Context context) { return this.asyncClient.updateManifestPropertiesWithResponse(manifestProperties, context).block(); @@ -390,13 +380,13 @@ public Response updateManifestPropertiesWithResponse * *

Update the writeable properties of a given manifest.

* - * {@codesnippet com.azure.containers.containerregistry.registryartifact.updateManifestProperties}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifact.updateManifestProperties}. * * @param manifestProperties {@link ArtifactManifestProperties manifestProperties} to be set. * @return The updated {@link ArtifactManifestProperties properties } * @throws ClientAuthenticationException thrown if the client does not have access to repository. - * @throws ResourceNotFoundException thrown if the given digest was not found. - * @throws NullPointerException thrown if the 'value' is null. + * @throws ResourceNotFoundException thrown if the given {@code digest} was not found. + * @throws NullPointerException thrown if the {@code manifestProperties} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) public ArtifactManifestProperties updateManifestProperties(ArtifactManifestProperties manifestProperties) { diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifactAsync.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifactAsync.java index f2de416bdd6b..847611a5b2e7 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifactAsync.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifactAsync.java @@ -12,8 +12,8 @@ import com.azure.containers.containerregistry.implementation.models.TagAttributesBase; import com.azure.containers.containerregistry.implementation.models.TagWriteableProperties; import com.azure.containers.containerregistry.models.ArtifactManifestProperties; +import com.azure.containers.containerregistry.models.ArtifactTagOrderBy; import com.azure.containers.containerregistry.models.ArtifactTagProperties; -import com.azure.containers.containerregistry.models.TagOrderBy; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.exception.ClientAuthenticationException; @@ -42,7 +42,7 @@ * *

Instantiating an asynchronous RegistryArtifact helper.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.instantiation} + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.instantiation} * *

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

* @@ -51,9 +51,10 @@ public final class RegistryArtifactAsync { private final ContainerRegistriesImpl serviceClient; private final String repositoryName; - private final String fullyQualifiedName; + private final String fullyQualifiedReference; private final String endpoint; private final String apiVersion; + private final String tagOrDigest; private String digest; private final ClientLogger logger = new ClientLogger(RegistryArtifactAsync.class); @@ -62,12 +63,12 @@ public final class RegistryArtifactAsync { * Creates a RegistryArtifactAsync type that sends requests to the given repository in the container registry service at {@code endpoint}. * Each service call goes through the {@code pipeline}. * @param repositoryName The name of the repository on which the service operations are performed. - * @param digest The tag or digest associated with the given artifact. + * @param tagOrDigest The tag or digest associated with the given artifact. * @param endpoint The URL string for the Azure Container Registry service. * @param httpPipeline HttpPipeline that the HTTP requests and responses flow through. * @param version {@link ContainerRegistryServiceVersion} of the service to be used when making requests. */ - RegistryArtifactAsync(String repositoryName, String digest, HttpPipeline httpPipeline, String endpoint, String version) { + RegistryArtifactAsync(String repositoryName, String tagOrDigest, HttpPipeline httpPipeline, String endpoint, String version) { if (repositoryName == null) { throw logger.logExceptionAsError(new NullPointerException("'repositoryName' can't be null")); } @@ -76,11 +77,11 @@ public final class RegistryArtifactAsync { throw logger.logExceptionAsError(new IllegalArgumentException("'repositoryName' can't be empty")); } - if (digest == null) { + if (tagOrDigest == null) { throw logger.logExceptionAsError(new NullPointerException("'digest' can't be null")); } - if (digest.isEmpty()) { + if (tagOrDigest.isEmpty()) { throw logger.logExceptionAsError(new IllegalArgumentException("'digest' can't be empty")); } @@ -90,16 +91,16 @@ public final class RegistryArtifactAsync { this.endpoint = endpoint; this.repositoryName = repositoryName; + this.tagOrDigest = tagOrDigest; try { URL endpointUrl = new URL(endpoint); - this.fullyQualifiedName = endpointUrl.getHost() + "/" + this.repositoryName; + this.fullyQualifiedReference = endpointUrl.getHost() + "/" + this.repositoryName + (isDigest(tagOrDigest) ? "@" : ":") + tagOrDigest; } catch (MalformedURLException ex) { // This will not happen. throw logger.logExceptionAsWarning(new IllegalArgumentException("'endpoint' must be a valid URL")); } - this.digest = digest; this.serviceClient = registryImpl.getContainerRegistries(); this.apiVersion = version; } @@ -113,12 +114,15 @@ public String getRegistryEndpoint() { } /** - * Gets the fully qualified name for the current instance. - * @return Fully qualified name of the current instance. + * Gets the fully qualified reference for the current instance. + * The fully qualifiedName is of the form 'registryName/repositoryName@digest' + * or 'registryName/repositoryName:tag' based on the docker naming convention and whether + * tag or digest was supplied to the constructor. + * @return Fully qualified reference of the current instance. * */ - public String getFullyQualifiedName() { + public String getFullyQualifiedReference() { - return this.fullyQualifiedName; + return this.fullyQualifiedReference; } /** @@ -130,18 +134,18 @@ public String getRepositoryName() { return this.repositoryName; } - /** - * Gets the tag or digest for the current instance. - * @return Tag or digest information for the current instance. - * */ - public String getDigest() { - return this.digest; + private boolean isDigest(String tagOrDigest) { + return tagOrDigest.contains(":"); } private Mono getDigestMono() { - Mono getTagMono = digest.contains(":") - ? Mono.just(digest) - : this.getTagProperties(digest).map(a -> a.getDigest()); + if (this.digest != null) { + return Mono.just(digest); + } + + Mono getTagMono = isDigest(tagOrDigest) + ? Mono.just(tagOrDigest) + : this.getTagProperties(tagOrDigest).map(a -> a.getDigest()); return getTagMono.flatMap(res -> { this.digest = res; @@ -156,7 +160,7 @@ private Mono getDigestMono() { * *

Delete the registry artifact.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.deleteWithResponse} + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.deleteWithResponse} * * @return A REST response with completion signal. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. @@ -185,7 +189,7 @@ Mono> deleteWithResponse(Context context) { * *

Delete the registry artifact.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.delete} + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.delete} * * @return the completion. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. @@ -203,13 +207,13 @@ public Mono delete() { * *

Delete the tag for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.deleteTagWithResponse} + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.deleteTagWithResponse} * * @param tag The name of the 'tag' that uniquely identifies the 'tag' that needs to be deleted. * @return A REST response with completion signal. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. - * @throws NullPointerException thrown if 'tag' is null. - * @throws IllegalArgumentException thrown if 'tag' is empty. + * @throws NullPointerException thrown if {@code tag} is null. + * @throws IllegalArgumentException thrown if {@code tag} is empty. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -240,13 +244,13 @@ Mono> deleteTagWithResponse(String tag, Context context) { * *

Delete the tag for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.deleteTag} + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.deleteTag} * * @param tag The name of the tag that uniquely identifies the tag that needs to be deleted. * @return The completion. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. - * @throws NullPointerException thrown if 'tag' is null. - * @throws IllegalArgumentException thrown if the 'tag' is empty. + * @throws NullPointerException thrown if {@code tag} is null. + * @throws IllegalArgumentException thrown if the {@code tag} is empty. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -264,7 +268,7 @@ public Mono deleteTag(String tag) { * *

Get the properties for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.getManifestPropertiesWithResponse} + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.getManifestPropertiesWithResponse} * * @return A REST response containing {@link ArtifactManifestProperties properties} associated with the given {@code Digest}. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. @@ -296,7 +300,7 @@ Mono> getManifestPropertiesWithResponse(Con * *

Get the properties for the given repository.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.getManifestProperties}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.getManifestProperties}. * * @return The {@link ArtifactManifestProperties properties} associated with the given {@code Digest}. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. @@ -315,15 +319,15 @@ public Mono getManifestProperties() { * *

Retrieve the properties associated with the given tag.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.getTagPropertiesWithResponse}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.getTagPropertiesWithResponse}. * * @param tag name of the tag that uniquely identifies a given tag. * @return A REST response with the {@link ArtifactTagProperties properties} associated with the given tag. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws ResourceNotFoundException thrown if the given tag was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. - * @throws NullPointerException thrown if the 'tag' is null. - * @throws IllegalArgumentException thrown if the 'tag' is empty. + * @throws NullPointerException thrown if the {@code tag} is null. + * @throws IllegalArgumentException thrown if the {@code tag} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getTagPropertiesWithResponse(String tag) { @@ -353,15 +357,15 @@ Mono> getTagPropertiesWithResponse(String tag, C * *

Retrieve the properties associated with the given tag.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.getTagProperties}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.getTagProperties}. * * @param tag name of the tag that uniquely identifies a given tag. * @return The {@link ArtifactTagProperties properties} associated with the given tag. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws ResourceNotFoundException thrown if the given tag was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. - * @throws NullPointerException thrown if the 'tag' is null. - * @throws IllegalArgumentException thrown if the 'tag' is empty. + * @throws NullPointerException thrown if the {@code tag} is null. + * @throws IllegalArgumentException thrown if the {@code tag} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getTagProperties(String tag) { @@ -372,7 +376,7 @@ public Mono getTagProperties(String tag) { * Fetches all the tags associated with the given {@link #getRepositoryName() repository}. * *

If you would like to specify the order in which the tags are returned please - * use the overload that takes in the options parameter {@link #listTags(TagOrderBy)} listTags} + * use the overload that takes in the options parameter {@link #listTagProperties(ArtifactTagOrderBy)} listTagProperties} * No assumptions on the order can be made if no options are provided to the service. *

* @@ -380,15 +384,15 @@ public Mono getTagProperties(String tag) { * *

Retrieve all the tags associated with the given repository from the most recently updated to the last.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.listTagsWithOptions}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.listTagPropertiesWithOptions}. * * @return {@link PagedFlux} of the artifacts for the given repository in the order specified by the options. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listTags() { - return listTags(TagOrderBy.NONE); + public PagedFlux listTagProperties() { + return listTagProperties(ArtifactTagOrderBy.NONE); } /** @@ -403,7 +407,7 @@ public PagedFlux listTags() { * *

Retrieve all the tags associated with the given repository from the most recently updated to the last.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.listTagsWithOptions}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.listTagPropertiesWithOptions}. * * @param orderBy The order in which the tags should be returned by the service. * @return {@link PagedFlux} of the artifacts for the given repository in the order specified by the options. @@ -411,25 +415,25 @@ public PagedFlux listTags() { * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listTags(TagOrderBy orderBy) { + public PagedFlux listTagProperties(ArtifactTagOrderBy orderBy) { return new PagedFlux<>( - (pageSize) -> withContext(context -> listTagsSinglePageAsync(pageSize, orderBy, context)), - (token, pageSize) -> withContext(context -> listTagsNextSinglePageAsync(token, context))); + (pageSize) -> withContext(context -> listTagPropertiesSinglePageAsync(pageSize, orderBy, context)), + (token, pageSize) -> withContext(context -> listTagPropertiesNextSinglePageAsync(token, context))); } - PagedFlux listTags(TagOrderBy orderBy, Context context) { + PagedFlux listTagProperties(ArtifactTagOrderBy orderBy, Context context) { return new PagedFlux<>( - (pageSize) -> listTagsSinglePageAsync(pageSize, orderBy, context), - (token, pageSize) -> listTagsNextSinglePageAsync(token, context)); + (pageSize) -> listTagPropertiesSinglePageAsync(pageSize, orderBy, context), + (token, pageSize) -> listTagPropertiesNextSinglePageAsync(token, context)); } - Mono> listTagsSinglePageAsync(Integer pageSize, TagOrderBy orderBy, Context context) { + Mono> listTagPropertiesSinglePageAsync(Integer pageSize, ArtifactTagOrderBy orderBy, Context context) { try { if (pageSize != null && pageSize < 0) { return monoError(logger, new IllegalArgumentException("'pageSize' cannot be negative.")); } - final String orderByString = orderBy.equals(TagOrderBy.NONE) ? null : orderBy.toString(); + final String orderByString = orderBy.equals(ArtifactTagOrderBy.NONE) ? null : orderBy.toString(); return this.getDigestMono() .flatMap(res -> this.serviceClient.getTagsSinglePageAsync(repositoryName, null, pageSize, orderByString, res, context)) @@ -459,7 +463,7 @@ private List getTagProperties(List bas }).collect(Collectors.toList()); } - Mono> listTagsNextSinglePageAsync(String nextLink, Context context) { + Mono> listTagPropertiesNextSinglePageAsync(String nextLink, Context context) { try { return this.serviceClient.getTagsNextSinglePageAsync(nextLink, context) .map(res -> Utils.getPagedResponseWithContinuationToken(res, this::getTagProperties)); @@ -476,7 +480,7 @@ Mono> listTagsNextSinglePageAsync(String ne * *

Update the writeable properties of a given tag.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.updateTagPropertiesWithResponse}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.updateTagPropertiesWithResponse}. * * @param tag Name of the tag that uniquely identifies it. * @param tagProperties {@link ArtifactTagProperties value} to be set. @@ -484,9 +488,9 @@ Mono> listTagsNextSinglePageAsync(String ne * @throws ClientAuthenticationException thrown if the client does not have access to repository. * @throws ResourceNotFoundException thrown if the given tag was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. - * @throws NullPointerException thrown if the 'tag' is null. - * @throws IllegalArgumentException thrown if the 'tag' is empty. - * @throws NullPointerException thrown if 'tagProperties' is null. + * @throws NullPointerException thrown if the {@code tag} is null. + * @throws IllegalArgumentException thrown if the {@code tag} is empty. + * @throws NullPointerException thrown if {@code tagProperties} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> updateTagPropertiesWithResponse( @@ -506,7 +510,7 @@ Mono> updateTagPropertiesWithResponse( } if (tagProperties == null) { - return monoError(logger, new NullPointerException("'value' cannot be null.")); + return monoError(logger, new NullPointerException("'tagProperties' cannot be null.")); } TagWriteableProperties writeableProperties = new TagWriteableProperties() @@ -530,7 +534,7 @@ Mono> updateTagPropertiesWithResponse( * *

Update the writeable properties of a given tag.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.updateTagPropertiesWithResponse}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.updateTagPropertiesWithResponse}. * * @param tag Name of the tag that uniquely identifies it. * @param tagProperties {@link ArtifactTagProperties tagProperties} to be set. @@ -538,9 +542,9 @@ Mono> updateTagPropertiesWithResponse( * @throws ClientAuthenticationException thrown if the client does not have access to repository. * @throws ResourceNotFoundException thrown if the given tag was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. - * @throws NullPointerException thrown if the 'tag' is null. - * @throws IllegalArgumentException thrown if the 'tag' is empty. - * @throws NullPointerException thrown if 'value' is null. + * @throws NullPointerException thrown if the {@code tag} is null. + * @throws IllegalArgumentException thrown if the {@code tag} is empty. + * @throws NullPointerException thrown if {@code tagProperties} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateTagProperties(String tag, ArtifactTagProperties tagProperties) { @@ -555,14 +559,14 @@ public Mono updateTagProperties(String tag, ArtifactTagPr * *

Update the writeable properties of a given manifest.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.updateManifestPropertiesWithResponse}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.updateManifestPropertiesWithResponse}. * * @param manifestProperties {@link ArtifactManifestProperties manifestProperties} to be set. * @return A REST response for the completion. * @throws ClientAuthenticationException thrown if the client does not have access to repository. * @throws ResourceNotFoundException thrown if the given digest was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. - * @throws NullPointerException thrown if the 'manifestProperties' is null. + * @throws NullPointerException thrown if the {@code manifestProperties} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> updateManifestPropertiesWithResponse(ArtifactManifestProperties manifestProperties) { @@ -597,14 +601,14 @@ Mono> updateManifestPropertiesWithResponse( * *

Update the writeable properties of a given manifest.

* - * {@codesnippet com.azure.containers.containerregistry.async.registryartifact.updateManifestProperties}. + * {@codesnippet com.azure.containers.containerregistry.RegistryArtifactAsync.updateManifestProperties}. * * @param manifestProperties {@link ArtifactManifestProperties manifestProperties} to be set. * @return The completion. * @throws ClientAuthenticationException thrown if the client does not have access to repository. * @throws ResourceNotFoundException thrown if the given digest was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. - * @throws NullPointerException thrown if the 'value' is null. + * @throws NullPointerException thrown if the {@code manifestProperties} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateManifestProperties(ArtifactManifestProperties manifestProperties) { diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/Utils.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/Utils.java index 576ee3b52f0e..7d82d0fa7832 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/Utils.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/Utils.java @@ -175,6 +175,7 @@ static HttpPipeline buildHttpPipeline( Configuration configuration, RetryPolicy retryPolicy, TokenCredential credential, + String authenticationScope, List perCallPolicies, List perRetryPolicies, HttpClient httpClient, @@ -211,6 +212,7 @@ static HttpPipeline buildHttpPipeline( ContainerRegistryTokenService tokenService = new ContainerRegistryTokenService( credential, + authenticationScope, endpoint, new HttpPipelineBuilder() .policies(credentialPolicies.toArray(new HttpPipelinePolicy[0])) diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/ArtifactManifestPropertiesHelper.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/ArtifactManifestPropertiesHelper.java index 1b013b7d03b1..2ef8d523b6d5 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/ArtifactManifestPropertiesHelper.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/ArtifactManifestPropertiesHelper.java @@ -4,8 +4,8 @@ package com.azure.containers.containerregistry.implementation; import com.azure.containers.containerregistry.models.ArtifactArchitecture; +import com.azure.containers.containerregistry.models.ArtifactManifestPlatform; import com.azure.containers.containerregistry.models.ArtifactManifestProperties; -import com.azure.containers.containerregistry.models.ArtifactManifestReference; import com.azure.containers.containerregistry.models.ArtifactOperatingSystem; import java.time.OffsetDateTime; @@ -27,7 +27,7 @@ public interface ArtifactManifestPropertiesAccessor { void setRepositoryName(ArtifactManifestProperties manifestProperties, String repositoryName); void setRegistryLoginServer(ArtifactManifestProperties manifestProperties, String registryLoginServer); void setDigest(ArtifactManifestProperties manifestProperties, String digest); - void setManifestReferences(ArtifactManifestProperties manifestProperties, List manifestReferences); + void setRelatedArtifacts(ArtifactManifestProperties manifestProperties, List relatedArtifacts); void setCpuArchitecture(ArtifactManifestProperties manifestProperties, ArtifactArchitecture architecture); void setOperatingSystem(ArtifactManifestProperties manifestProperties, ArtifactOperatingSystem operatingSystem); void setTags(ArtifactManifestProperties manifestProperties, List tags); @@ -65,8 +65,8 @@ public static void setlastUpdatedOn(ArtifactManifestProperties manifestPropertie accessor.setlastUpdatedOn(manifestProperties, lastUpdatedOn); } - public static void setManifestReferences(ArtifactManifestProperties manifestProperties, List manifestReferences) { - accessor.setManifestReferences(manifestProperties, manifestReferences); + public static void setRelatedArtifacts(ArtifactManifestProperties manifestProperties, List relatedArtifacts) { + accessor.setRelatedArtifacts(manifestProperties, relatedArtifacts); } public static void setCpuArchitecture(ArtifactManifestProperties manifestProperties, ArtifactArchitecture architecture) { diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/ContainerRegistriesImpl.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/ContainerRegistriesImpl.java index a8a5c2e8b3de..f43e0acfa531 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/ContainerRegistriesImpl.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/ContainerRegistriesImpl.java @@ -14,13 +14,13 @@ import com.azure.containers.containerregistry.implementation.models.ContainerRegistriesGetRepositoriesResponse; import com.azure.containers.containerregistry.implementation.models.ContainerRegistriesGetTagsNextResponse; import com.azure.containers.containerregistry.implementation.models.ContainerRegistriesGetTagsResponse; +import com.azure.containers.containerregistry.models.ContainerRepositoryProperties; import com.azure.containers.containerregistry.implementation.models.Manifest; import com.azure.containers.containerregistry.implementation.models.ManifestAttributesBase; import com.azure.containers.containerregistry.implementation.models.ManifestWriteableProperties; import com.azure.containers.containerregistry.implementation.models.RepositoryWriteableProperties; import com.azure.containers.containerregistry.implementation.models.TagAttributesBase; import com.azure.containers.containerregistry.implementation.models.TagWriteableProperties; -import com.azure.containers.containerregistry.models.RepositoryProperties; import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.Delete; import com.azure.core.annotation.ExpectedResponses; @@ -123,7 +123,7 @@ Mono getRepositories( @Get("/acr/v1/{name}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(AcrErrorsException.class) - Mono> getProperties( + Mono> getProperties( @HostParam("url") String url, @PathParam("name") String name, @HeaderParam("Accept") String accept, @@ -141,7 +141,7 @@ Mono> deleteRepository( @Patch("/acr/v1/{name}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(AcrErrorsException.class) - Mono> setProperties( + Mono> updateProperties( @HostParam("url") String url, @PathParam("name") String name, @BodyParam("application/json") RepositoryWriteableProperties value, @@ -649,7 +649,7 @@ public PagedFlux getRepositoriesAsync(String last, Integer n, Context co * @return repository attributes. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPropertiesWithResponseAsync(String name) { + public Mono> getPropertiesWithResponseAsync(String name) { final String accept = "application/json"; return FluxUtil.withContext(context -> service.getProperties(this.client.getUrl(), name, accept, context)); } @@ -665,7 +665,7 @@ public Mono> getPropertiesWithResponseAsync(Strin * @return repository attributes. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPropertiesWithResponseAsync(String name, Context context) { + public Mono> getPropertiesWithResponseAsync(String name, Context context) { final String accept = "application/json"; return service.getProperties(this.client.getUrl(), name, accept, context); } @@ -680,10 +680,10 @@ public Mono> getPropertiesWithResponseAsync(Strin * @return repository attributes. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPropertiesAsync(String name) { + public Mono getPropertiesAsync(String name) { return getPropertiesWithResponseAsync(name) .flatMap( - (Response res) -> { + (Response res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { @@ -703,10 +703,10 @@ public Mono getPropertiesAsync(String name) { * @return repository attributes. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPropertiesAsync(String name, Context context) { + public Mono getPropertiesAsync(String name, Context context) { return getPropertiesWithResponseAsync(name, context) .flatMap( - (Response res) -> { + (Response res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { @@ -783,14 +783,14 @@ public Mono deleteRepositoryAsync(String name, Context context) { * @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 repository attributes. + * @return properties of this repository. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setPropertiesWithResponseAsync( + public Mono> updatePropertiesWithResponseAsync( String name, RepositoryWriteableProperties value) { final String accept = "application/json"; return FluxUtil.withContext( - context -> service.setProperties(this.client.getUrl(), name, value, accept, context)); + context -> service.updateProperties(this.client.getUrl(), name, value, accept, context)); } /** @@ -802,13 +802,13 @@ public Mono> setPropertiesWithResponseAsync( * @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 repository attributes. + * @return properties of this repository. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setPropertiesWithResponseAsync( + public Mono> updatePropertiesWithResponseAsync( String name, RepositoryWriteableProperties value, Context context) { final String accept = "application/json"; - return service.setProperties(this.client.getUrl(), name, value, accept, context); + return service.updateProperties(this.client.getUrl(), name, value, accept, context); } /** @@ -819,13 +819,13 @@ public Mono> setPropertiesWithResponseAsync( * @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 repository attributes. + * @return properties of this repository. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setPropertiesAsync(String name, RepositoryWriteableProperties value) { - return setPropertiesWithResponseAsync(name, value) + public Mono updatePropertiesAsync(String name, RepositoryWriteableProperties value) { + return updatePropertiesWithResponseAsync(name, value) .flatMap( - (Response res) -> { + (Response res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { @@ -843,14 +843,14 @@ public Mono setPropertiesAsync(String name, RepositoryWrit * @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 repository attributes. + * @return properties of this repository. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setPropertiesAsync( + public Mono updatePropertiesAsync( String name, RepositoryWriteableProperties value, Context context) { - return setPropertiesWithResponseAsync(name, value, context) + return updatePropertiesWithResponseAsync(name, value, context) .flatMap( - (Response res) -> { + (Response res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryRefreshTokenCredential.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryRefreshTokenCredential.java index ffb5d0f8ff47..157abc1ae98c 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryRefreshTokenCredential.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryRefreshTokenCredential.java @@ -16,6 +16,7 @@ public class ContainerRegistryRefreshTokenCredential { private final TokenCredential aadTokenCredential; private final TokenServiceImpl tokenService; + private final String authenticationScope; public static final String AAD_DEFAULT_SCOPE = "https://management.core.windows.net/.default"; /** @@ -23,9 +24,10 @@ public class ContainerRegistryRefreshTokenCredential { * @param tokenService the container registry token service that calls the token rest APIs. * @param aadTokenCredential the ARM access token. */ - ContainerRegistryRefreshTokenCredential(TokenServiceImpl tokenService, TokenCredential aadTokenCredential) { + ContainerRegistryRefreshTokenCredential(TokenServiceImpl tokenService, TokenCredential aadTokenCredential, String authenticationScope) { this.tokenService = tokenService; this.aadTokenCredential = aadTokenCredential; + this.authenticationScope = authenticationScope == null ? AAD_DEFAULT_SCOPE : authenticationScope; } /** @@ -36,7 +38,7 @@ public class ContainerRegistryRefreshTokenCredential { public Mono getToken(ContainerRegistryTokenRequestContext context) { String serviceName = context.getServiceName(); - return Mono.defer(() -> aadTokenCredential.getToken(new TokenRequestContext().addScopes(AAD_DEFAULT_SCOPE)) + return Mono.defer(() -> aadTokenCredential.getToken(new TokenRequestContext().addScopes(authenticationScope)) .flatMap(token -> this.tokenService.getAcrRefreshTokenAsync(token.getToken(), serviceName))); } } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryTokenService.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryTokenService.java index f854616aebbe..aec773273452 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryTokenService.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryTokenService.java @@ -30,11 +30,11 @@ public class ContainerRegistryTokenService implements TokenCredential { * @param pipeline the pipeline to be used for the rest calls to the service. * @param serializerAdapter the serializer adapter to be used for the rest calls to the service. */ - public ContainerRegistryTokenService(TokenCredential aadTokenCredential, String url, HttpPipeline pipeline, SerializerAdapter serializerAdapter) { + public ContainerRegistryTokenService(TokenCredential aadTokenCredential, String authenticationScope, String url, HttpPipeline pipeline, SerializerAdapter serializerAdapter) { this.tokenService = new TokenServiceImpl(url, pipeline, serializerAdapter); if (aadTokenCredential != null) { - this.refreshTokenCache = new AccessTokenCacheImpl(new ContainerRegistryRefreshTokenCredential(tokenService, aadTokenCredential)); + this.refreshTokenCache = new AccessTokenCacheImpl(new ContainerRegistryRefreshTokenCredential(tokenService, aadTokenCredential, authenticationScope)); } else { isAnonymousAccess = true; } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ArtifactManifestProperties.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ArtifactManifestProperties.java index 65bb2360c2fd..0290014f4acd 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ArtifactManifestProperties.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ArtifactManifestProperties.java @@ -5,7 +5,7 @@ package com.azure.containers.containerregistry.implementation.models; import com.azure.containers.containerregistry.models.ArtifactArchitecture; -import com.azure.containers.containerregistry.models.ArtifactManifestReference; +import com.azure.containers.containerregistry.models.ArtifactManifestPlatform; import com.azure.containers.containerregistry.models.ArtifactOperatingSystem; import com.azure.core.annotation.Fluent; import com.azure.core.annotation.JsonFlatten; @@ -67,11 +67,12 @@ public class ArtifactManifestProperties { private ArtifactOperatingSystem operatingSystem; /* - * List of manifests referenced by this manifest list. List will be empty - * if this manifest is not a manifest list. + * List of artifacts that are referenced by this manifest list, with + * information about the platform each supports. This list will be empty + * if this is a leaf manifest and not a manifest list. */ @JsonProperty(value = "manifest.references", access = JsonProperty.Access.WRITE_ONLY) - private List manifestReferences; + private List relatedArtifacts; /* * List of tags @@ -177,13 +178,13 @@ public ArtifactOperatingSystem getOperatingSystem() { } /** - * Get the manifestReferences property: List of manifests referenced by this manifest list. List will be empty if - * this manifest is not a manifest list. + * Get the relatedArtifacts property: List of artifacts that are referenced by this manifest list, with information + * about the platform each supports. This list will be empty if this is a leaf manifest and not a manifest list. * - * @return the manifestReferences value. + * @return the relatedArtifacts value. */ - public List getManifestReferences() { - return this.manifestReferences; + public List getRelatedArtifacts() { + return this.relatedArtifacts; } /** diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ContainerRepositoryProperties.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ContainerRepositoryProperties.java new file mode 100644 index 000000000000..fc93c25c9d0f --- /dev/null +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ContainerRepositoryProperties.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.containers.containerregistry.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of this repository. */ +@JsonFlatten +@Fluent +public class ContainerRepositoryProperties { + /* + * Registry login server name. This is likely to be similar to + * {registry-name}.azurecr.io + */ + @JsonProperty(value = "registry", required = true, access = JsonProperty.Access.WRITE_ONLY) + private String registryLoginServer; + + /* + * Image name + */ + @JsonProperty(value = "imageName", required = true, access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Image created time + */ + @JsonProperty(value = "createdTime", required = true, access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdOn; + + /* + * Image last update time + */ + @JsonProperty(value = "lastUpdateTime", required = true, access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedOn; + + /* + * Number of the manifests + */ + @JsonProperty(value = "manifestCount", required = true, access = JsonProperty.Access.WRITE_ONLY) + private int manifestCount; + + /* + * Number of the tags + */ + @JsonProperty(value = "tagCount", required = true, access = JsonProperty.Access.WRITE_ONLY) + private int tagCount; + + /* + * Delete enabled + */ + @JsonProperty(value = "changeableAttributes.deleteEnabled") + private Boolean deleteEnabled; + + /* + * Write enabled + */ + @JsonProperty(value = "changeableAttributes.writeEnabled") + private Boolean writeEnabled; + + /* + * List enabled + */ + @JsonProperty(value = "changeableAttributes.listEnabled") + private Boolean listEnabled; + + /* + * Read enabled + */ + @JsonProperty(value = "changeableAttributes.readEnabled") + private Boolean readEnabled; + + /* + * Enables Teleport functionality on new images in the repository improving + * Container startup performance + */ + @JsonProperty(value = "changeableAttributes.teleportEnabled") + private Boolean teleportEnabled; + + /** + * Get the registryLoginServer property: Registry login server name. This is likely to be similar to + * {registry-name}.azurecr.io. + * + * @return the registryLoginServer value. + */ + public String getRegistryLoginServer() { + return this.registryLoginServer; + } + + /** + * Get the name property: Image name. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Get the createdOn property: Image created time. + * + * @return the createdOn value. + */ + public OffsetDateTime getCreatedOn() { + return this.createdOn; + } + + /** + * Get the lastUpdatedOn property: Image last update time. + * + * @return the lastUpdatedOn value. + */ + public OffsetDateTime getLastUpdatedOn() { + return this.lastUpdatedOn; + } + + /** + * Get the manifestCount property: Number of the manifests. + * + * @return the manifestCount value. + */ + public int getManifestCount() { + return this.manifestCount; + } + + /** + * Get the tagCount property: Number of the tags. + * + * @return the tagCount value. + */ + public int getTagCount() { + return this.tagCount; + } + + /** + * Get the deleteEnabled property: Delete enabled. + * + * @return the deleteEnabled value. + */ + public Boolean isDeleteEnabled() { + return this.deleteEnabled; + } + + /** + * Set the deleteEnabled property: Delete enabled. + * + * @param deleteEnabled the deleteEnabled value to set. + * @return the ContainerRepositoryProperties object itself. + */ + public ContainerRepositoryProperties setDeleteEnabled(Boolean deleteEnabled) { + this.deleteEnabled = deleteEnabled; + return this; + } + + /** + * Get the writeEnabled property: Write enabled. + * + * @return the writeEnabled value. + */ + public Boolean isWriteEnabled() { + return this.writeEnabled; + } + + /** + * Set the writeEnabled property: Write enabled. + * + * @param writeEnabled the writeEnabled value to set. + * @return the ContainerRepositoryProperties object itself. + */ + public ContainerRepositoryProperties setWriteEnabled(Boolean writeEnabled) { + this.writeEnabled = writeEnabled; + return this; + } + + /** + * Get the listEnabled property: List enabled. + * + * @return the listEnabled value. + */ + public Boolean isListEnabled() { + return this.listEnabled; + } + + /** + * Set the listEnabled property: List enabled. + * + * @param listEnabled the listEnabled value to set. + * @return the ContainerRepositoryProperties object itself. + */ + public ContainerRepositoryProperties setListEnabled(Boolean listEnabled) { + this.listEnabled = listEnabled; + return this; + } + + /** + * Get the readEnabled property: Read enabled. + * + * @return the readEnabled value. + */ + public Boolean isReadEnabled() { + return this.readEnabled; + } + + /** + * Set the readEnabled property: Read enabled. + * + * @param readEnabled the readEnabled value to set. + * @return the ContainerRepositoryProperties object itself. + */ + public ContainerRepositoryProperties setReadEnabled(Boolean readEnabled) { + this.readEnabled = readEnabled; + return this; + } + + /** + * Get the teleportEnabled property: Enables Teleport functionality on new images in the repository improving + * Container startup performance. + * + * @return the teleportEnabled value. + */ + public Boolean isTeleportEnabled() { + return this.teleportEnabled; + } + + /** + * Set the teleportEnabled property: Enables Teleport functionality on new images in the repository improving + * Container startup performance. + * + * @param teleportEnabled the teleportEnabled value to set. + * @return the ContainerRepositoryProperties object itself. + */ + public ContainerRepositoryProperties setTeleportEnabled(Boolean teleportEnabled) { + this.teleportEnabled = teleportEnabled; + return this; + } +} diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ManifestAttributesBase.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ManifestAttributesBase.java index 0116d441755b..8e671067b60d 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ManifestAttributesBase.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ManifestAttributesBase.java @@ -5,7 +5,7 @@ package com.azure.containers.containerregistry.implementation.models; import com.azure.containers.containerregistry.models.ArtifactArchitecture; -import com.azure.containers.containerregistry.models.ArtifactManifestReference; +import com.azure.containers.containerregistry.models.ArtifactManifestPlatform; import com.azure.containers.containerregistry.models.ArtifactOperatingSystem; import com.azure.core.annotation.Fluent; import com.azure.core.annotation.JsonFlatten; @@ -54,11 +54,12 @@ public class ManifestAttributesBase { private ArtifactOperatingSystem operatingSystem; /* - * List of manifests referenced by this manifest list. List will be empty - * if this manifest is not a manifest list. + * List of artifacts that are referenced by this manifest list, with + * information about the platform each supports. This list will be empty + * if this is a leaf manifest and not a manifest list. */ @JsonProperty(value = "references", access = JsonProperty.Access.WRITE_ONLY) - private List manifestReferences; + private List relatedArtifacts; /* * List of tags @@ -145,13 +146,13 @@ public ArtifactOperatingSystem getOperatingSystem() { } /** - * Get the manifestReferences property: List of manifests referenced by this manifest list. List will be empty if - * this manifest is not a manifest list. + * Get the relatedArtifacts property: List of artifacts that are referenced by this manifest list, with information + * about the platform each supports. This list will be empty if this is a leaf manifest and not a manifest list. * - * @return the manifestReferences value. + * @return the relatedArtifacts value. */ - public List getManifestReferences() { - return this.manifestReferences; + public List getRelatedArtifacts() { + return this.relatedArtifacts; } /** diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ManifestAttributesManifest.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ManifestAttributesManifest.java index bdb61e752e91..c83b69bdfb02 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ManifestAttributesManifest.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/models/ManifestAttributesManifest.java @@ -4,7 +4,7 @@ package com.azure.containers.containerregistry.implementation.models; -import com.azure.containers.containerregistry.models.ArtifactManifestReference; +import com.azure.containers.containerregistry.models.ArtifactManifestPlatform; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; @@ -16,7 +16,7 @@ public final class ManifestAttributesManifest { * List of manifest attributes details */ @JsonProperty(value = "references") - private List references; + private List references; /* * Quarantine tag name @@ -29,7 +29,7 @@ public final class ManifestAttributesManifest { * * @return the references value. */ - public List getReferences() { + public List getReferences() { return this.references; } @@ -39,7 +39,7 @@ public List getReferences() { * @param references the references value to set. * @return the ManifestAttributesManifest object itself. */ - public ManifestAttributesManifest setReferences(List references) { + public ManifestAttributesManifest setReferences(List references) { this.references = references; return this; } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestOrderBy.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestOrderBy.java new file mode 100644 index 000000000000..3bbd4a9f2efd --- /dev/null +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestOrderBy.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.containers.containerregistry.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ArtifactManifestOrderBy. */ +public final class ArtifactManifestOrderBy extends ExpandableStringEnum { + /** Static value none for ArtifactManifestOrderBy. */ + public static final ArtifactManifestOrderBy NONE = fromString("none"); + + /** Static value timedesc for ArtifactManifestOrderBy. */ + public static final ArtifactManifestOrderBy LAST_UPDATED_ON_DESCENDING = fromString("timedesc"); + + /** Static value timeasc for ArtifactManifestOrderBy. */ + public static final ArtifactManifestOrderBy LAST_UPDATED_ON_ASCENDING = fromString("timeasc"); + + /** + * Creates or finds a ArtifactManifestOrderBy from its string representation. + * + * @param name a name to look for. + * @return the corresponding ArtifactManifestOrderBy. + */ + @JsonCreator + public static ArtifactManifestOrderBy fromString(String name) { + return fromString(name, ArtifactManifestOrderBy.class); + } + + /** @return known ArtifactManifestOrderBy values. */ + public static Collection values() { + return values(ArtifactManifestOrderBy.class); + } +} diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestReference.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestPlatform.java similarity index 84% rename from sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestReference.java rename to sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestPlatform.java index d2b1601a8e49..0d5105c5088d 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestReference.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestPlatform.java @@ -9,7 +9,7 @@ /** Manifest attributes details. */ @Immutable -public final class ArtifactManifestReference { +public final class ArtifactManifestPlatform { /* * Manifest digest */ @@ -19,13 +19,13 @@ public final class ArtifactManifestReference { /* * CPU architecture */ - @JsonProperty(value = "architecture", required = true, access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "architecture", access = JsonProperty.Access.WRITE_ONLY) private ArtifactArchitecture architecture; /* * Operating system */ - @JsonProperty(value = "os", required = true, access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "os", access = JsonProperty.Access.WRITE_ONLY) private ArtifactOperatingSystem operatingSystem; /** diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestProperties.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestProperties.java index ba5a81b95353..f3b62fbd37b9 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestProperties.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactManifestProperties.java @@ -72,7 +72,7 @@ public final class ArtifactManifestProperties { * if this manifest is not a manifest list. */ @JsonProperty(value = "manifest.references", access = JsonProperty.Access.WRITE_ONLY) - private List manifestReferences; + private List relatedArtifacts; /* * List of tags @@ -115,8 +115,8 @@ public void setDigest(ArtifactManifestProperties manifestProperties, String dige } @Override - public void setManifestReferences(ArtifactManifestProperties manifestProperties, List manifestReferences) { - manifestProperties.setManifestReferences(manifestReferences); + public void setRelatedArtifacts(ArtifactManifestProperties manifestProperties, List relatedArtifacts) { + manifestProperties.setRelatedArtifacts(relatedArtifacts); } @Override @@ -156,8 +156,8 @@ private ArtifactManifestProperties setCpuArchitecture(ArtifactArchitecture archi return this; } - private ArtifactManifestProperties setManifestReferences(List manifestReferences) { - this.manifestReferences = manifestReferences; + private ArtifactManifestProperties setRelatedArtifacts(List relatedArtifacts) { + this.relatedArtifacts = relatedArtifacts; return this; } @@ -207,11 +207,6 @@ private ArtifactManifestProperties setRepositoryName(String repositoryName) { @JsonProperty(value = "manifest.changeableAttributes.readEnabled") private Boolean readEnabled; - /** - * Initializes an instance of {@link ArtifactManifestProperties}. - */ - public ArtifactManifestProperties() { } - /** * Get the registryLoginServer property: Registry login server name. This is likely to be similar to * {registry-name}.azurecr.io. @@ -286,13 +281,14 @@ public ArtifactOperatingSystem getOperatingSystem() { } /** - * Get the manifestReferences property: List of manifests referenced by this manifest list. List will be empty if - * this manifest is not a manifest list. + * List of artifacts that are referenced by this manifest list, with + * information about the platform each of them supports. This list will be empty + * if this is a leaf manifest and not a manifest list. * - * @return the manifestReferences value. + * @return the relatedArtifacts value. */ - public List getManifestReferences() { - return this.manifestReferences; + public List getRelatedArtifacts() { + return this.relatedArtifacts; } /** diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactTagOrderBy.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactTagOrderBy.java new file mode 100644 index 000000000000..aad2ccbe3714 --- /dev/null +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactTagOrderBy.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.containers.containerregistry.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ArtifactTagOrderBy. */ +public final class ArtifactTagOrderBy extends ExpandableStringEnum { + /** Static value none for ArtifactTagOrderBy. */ + public static final ArtifactTagOrderBy NONE = fromString("none"); + + /** Static value timedesc for ArtifactTagOrderBy. */ + public static final ArtifactTagOrderBy LAST_UPDATED_ON_DESCENDING = fromString("timedesc"); + + /** Static value timeasc for ArtifactTagOrderBy. */ + public static final ArtifactTagOrderBy LAST_UPDATED_ON_ASCENDING = fromString("timeasc"); + + /** + * Creates or finds a ArtifactTagOrderBy from its string representation. + * + * @param name a name to look for. + * @return the corresponding ArtifactTagOrderBy. + */ + @JsonCreator + public static ArtifactTagOrderBy fromString(String name) { + return fromString(name, ArtifactTagOrderBy.class); + } + + /** @return known ArtifactTagOrderBy values. */ + public static Collection values() { + return values(ArtifactTagOrderBy.class); + } +} diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactTagProperties.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactTagProperties.java index 654b394959d9..ca3c21a075c0 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactTagProperties.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ArtifactTagProperties.java @@ -109,11 +109,6 @@ private ArtifactTagProperties setName(String tagName) { return this; } - /** - * Initializes an instance of {@link ArtifactTagProperties} - */ - public ArtifactTagProperties() { } - /** * Get the registryLoginServer property: Registry login server name. This is likely to be similar to * {registry-name}.azurecr.io. diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/RepositoryProperties.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ContainerRepositoryProperties.java similarity index 92% rename from sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/RepositoryProperties.java rename to sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ContainerRepositoryProperties.java index c154d851d91b..37294088a679 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/RepositoryProperties.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ContainerRepositoryProperties.java @@ -12,7 +12,7 @@ /** Repository attributes. */ @JsonFlatten @Fluent -public final class RepositoryProperties { +public final class ContainerRepositoryProperties { /* * Registry login server name. This is likely to be similar to * {registry-name}.azurecr.io @@ -151,7 +151,7 @@ public Boolean isDeleteEnabled() { * @param deleteEnabled the deleteEnabled value to set. * @return the RepositoryProperties object itself. */ - public RepositoryProperties setDeleteEnabled(Boolean deleteEnabled) { + public ContainerRepositoryProperties setDeleteEnabled(Boolean deleteEnabled) { this.deleteEnabled = deleteEnabled; return this; } @@ -171,7 +171,7 @@ public Boolean isWriteEnabled() { * @param writeEnabled the writeEnabled value to set. * @return the RepositoryProperties object itself. */ - public RepositoryProperties setWriteEnabled(Boolean writeEnabled) { + public ContainerRepositoryProperties setWriteEnabled(Boolean writeEnabled) { this.writeEnabled = writeEnabled; return this; } @@ -191,7 +191,7 @@ public Boolean isListEnabled() { * @param listEnabled the listEnabled value to set. * @return the RepositoryProperties object itself. */ - public RepositoryProperties setListEnabled(Boolean listEnabled) { + public ContainerRepositoryProperties setListEnabled(Boolean listEnabled) { this.listEnabled = listEnabled; return this; } @@ -211,7 +211,7 @@ public Boolean isReadEnabled() { * @param readEnabled the readEnabled value to set. * @return the RepositoryProperties object itself. */ - public RepositoryProperties setReadEnabled(Boolean readEnabled) { + public ContainerRepositoryProperties setReadEnabled(Boolean readEnabled) { this.readEnabled = readEnabled; return this; } @@ -233,7 +233,7 @@ public Boolean isTeleportEnabled() { * @param teleportEnabled the teleportEnabled value to set. * @return the RepositoryProperties object itself. */ - public RepositoryProperties setTeleportEnabled(Boolean teleportEnabled) { + public ContainerRepositoryProperties setTeleportEnabled(Boolean teleportEnabled) { this.teleportEnabled = teleportEnabled; return this; } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ManifestOrderBy.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ManifestOrderBy.java deleted file mode 100644 index 65e5bca60638..000000000000 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ManifestOrderBy.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.containers.containerregistry.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for ManifestOrderBy. */ -public final class ManifestOrderBy extends ExpandableStringEnum { - /** Static value none for ManifestOrderBy. */ - public static final ManifestOrderBy NONE = fromString("none"); - - /** Static value timedesc for ManifestOrderBy. */ - public static final ManifestOrderBy LAST_UPDATED_ON_DESCENDING = fromString("timedesc"); - - /** Static value timeasc for ManifestOrderBy. */ - public static final ManifestOrderBy LAST_UPDATED_ON_ASCENDING = fromString("timeasc"); - - /** - * Creates or finds a ManifestOrderBy from its string representation. - * - * @param name a name to look for. - * @return the corresponding ManifestOrderBy. - */ - @JsonCreator - public static ManifestOrderBy fromString(String name) { - return fromString(name, ManifestOrderBy.class); - } - - /** @return known ManifestOrderBy values. */ - public static Collection values() { - return values(ManifestOrderBy.class); - } -} diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/TagOrderBy.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/TagOrderBy.java deleted file mode 100644 index a0e661a82eb6..000000000000 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/TagOrderBy.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.containers.containerregistry.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for TagOrderBy. */ -public final class TagOrderBy extends ExpandableStringEnum { - /** Static value none for TagOrderBy. */ - public static final TagOrderBy NONE = fromString("none"); - - /** Static value timedesc for TagOrderBy. */ - public static final TagOrderBy LAST_UPDATED_ON_DESCENDING = fromString("timedesc"); - - /** Static value timeasc for TagOrderBy. */ - public static final TagOrderBy LAST_UPDATED_ON_ASCENDING = fromString("timeasc"); - - /** - * Creates or finds a TagOrderBy from its string representation. - * - * @param name a name to look for. - * @return the corresponding TagOrderBy. - */ - @JsonCreator - public static TagOrderBy fromString(String name) { - return fromString(name, TagOrderBy.class); - } - - /** @return known TagOrderBy values. */ - public static Collection values() { - return values(TagOrderBy.class); - } -} diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/AnonymousAsyncClientThrows.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/AnonymousAsyncClientThrows.java index 3d64ec554676..164deb248af9 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/AnonymousAsyncClientThrows.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/AnonymousAsyncClientThrows.java @@ -3,6 +3,11 @@ package com.azure.containers.containerregistry; +import com.azure.core.exception.ClientAuthenticationException; + +/** + * This class returns a sample for the anonymous access client. + */ public class AnonymousAsyncClientThrows { static final String ENDPOINT = "https://registryName.azure.io"; @@ -16,7 +21,11 @@ public static void main(String[] args) { anonymousClient.deleteRepository(REPOSITORY_NAME).subscribe(deleteRepositoryResult -> { System.out.println("Unexpected Success: Delete is not allowed on anonymous access"); }, error -> { - System.out.println("Expected exception: Delete is not allowed on anonymous access"); + if (error instanceof ClientAuthenticationException) { + System.out.println("Expected exception: Delete is not allowed on anonymous access"); + } else { + System.out.println("Unexpected exception."); + } }); } } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRegistryAsyncClientJavaDocSnippets.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRegistryAsyncClientJavaDocSnippets.java new file mode 100644 index 000000000000..1bda7fd00690 --- /dev/null +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRegistryAsyncClientJavaDocSnippets.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.containers.containerregistry; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; + +public class ContainerRegistryAsyncClientJavaDocSnippets { + /** + * Generates code sample for creating a {@link ContainerRegistryAsyncClient} + * + * @return An instance of {@link ContainerRegistryAsyncClient} + * @throws IllegalStateException If client cannot be created + */ + public ContainerRegistryAsyncClient createAsyncContainerRegistryClient() { + final String endpoint = getEndpoint(); + final TokenCredential credential = getTokenCredentials(); + + // BEGIN: com.azure.containers.containerregistry.ContainerRegistryAsyncClient.instantiation + ContainerRegistryAsyncClient registryAsyncClient = new ContainerRegistryClientBuilder() + .endpoint(endpoint) + .credential(credential) + .buildAsyncClient(); + // END: com.azure.containers.containerregistry.ContainerRegistryAsyncClient.instantiation + return registryAsyncClient; + } + + public ContainerRegistryAsyncClient createAsyncContainerRegistryClientWithPipeline() { + final String endpoint = getEndpoint(); + final TokenCredential credential = getTokenCredentials(); + + // BEGIN: com.azure.containers.containerregistry.ContainerRegistryAsyncClient.pipeline.instantiation + HttpPipeline pipeline = new HttpPipelineBuilder() + .policies(/* add policies */) + .build(); + + ContainerRegistryAsyncClient registryAsyncClient = new ContainerRegistryClientBuilder() + .pipeline(pipeline) + .endpoint(endpoint) + .credential(credential) + .buildAsyncClient(); + // END: com.azure.containers.containerregistry.ContainerRegistryAsyncClient.pipeline.instantiation + return registryAsyncClient; + } + + public void deleteRepositoryCodeSnippet() { + ContainerRegistryAsyncClient client = getAsyncClient(); + final String repositoryName = getRepositoryName(); + + // BEGIN: com.azure.containers.containerregistry.ContainerRegistryAsyncClient.deleteRepository#String + client.deleteRepository(repositoryName).subscribe(response -> { + System.out.printf("Successfully initiated delete of the repository."); + }, error -> { + System.out.println("Failed to initiate a delete of the repository."); + }); + // END: com.azure.containers.containerregistry.ContainerRegistryAsyncClient.deleteRepository#String + } + + public void deleteRepositoryWithResponseCodeSnippet() { + ContainerRegistryAsyncClient client = getAsyncClient(); + final String repositoryName = getRepositoryName(); + + // BEGIN: com.azure.containers.containerregistry.ContainerRegistryAsyncClient.deleteRepositoryWithResponse#String + client.deleteRepositoryWithResponse(repositoryName).subscribe(response -> { + System.out.printf("Successfully initiated delete of the repository."); + }, error -> { + System.out.println("Failed to initiate a delete of the repository."); + }); + // END: com.azure.containers.containerregistry.ContainerRegistryAsyncClient.deleteRepositoryWithResponse#String + } + + public void listRepositoryNamesCodeSnippet() { + ContainerRegistryAsyncClient client = getAsyncClient(); + + // BEGIN: com.azure.containers.containerregistry.ContainerRegistryAsyncClient.listRepositoryNames + client.listRepositoryNames().subscribe(name -> { + System.out.printf("Repository Name:%s,", name); + }); + // END: com.azure.containers.containerregistry.ContainerRegistryAsyncClient.listRepositoryNames + } + + public void getRepositoryCodeSnippet() { + ContainerRegistryAsyncClient client = getAsyncClient(); + final String repositoryName = getRepositoryName(); + + // BEGIN: com.azure.containers.containerregistry.containeregistryasyncclient.getRepository + ContainerRepositoryAsync repositoryAsync = client.getRepository(repositoryName); + repositoryAsync.getProperties().subscribe(properties -> { + System.out.println(properties.getName()); + }); + // END: com.azure.containers.containerregistry.containeregistryasyncclient.getRepository + } + + public void getArtifactCodeSnippet() { + ContainerRegistryAsyncClient client = getAsyncClient(); + final String repositoryName = getRepositoryName(); + final String tagOrDigest = getTagOrDigest(); + + // BEGIN: com.azure.containers.containerregistry.containeregistryasyncclient.getArtifact + RegistryArtifactAsync registryArtifactAsync = client.getArtifact(repositoryName, tagOrDigest); + registryArtifactAsync.getManifestProperties().subscribe(properties -> { + System.out.println(properties.getDigest()); + }); + // END: com.azure.containers.containerregistry.containeregistryasyncclient.getArtifact + } + + /** + * Implementation not provided for this method. + * + * @return {@code null} + */ + private String getTagOrDigest() { + return null; + } + + /** + * Implementation not provided for this method + * + * @return {@code null} + */ + private ContainerRegistryAsyncClient getAsyncClient() { + return null; + } + + /** + * Implementation not provided for this method + * + * @return {@code null} + */ + private String getEndpoint() { + return null; + } + + /** + * Implementation not provided for this method + * + * @return {@code null} + */ + private String getRepositoryName() { + return null; + } + + /** + * Implementation not provided for this method + * + * @return {@code null} + */ + private TokenCredential getTokenCredentials() { + return null; + } +} diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRegistryClientJavaDocSnippets.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRegistryClientJavaDocSnippets.java new file mode 100644 index 000000000000..5b07f95be8c2 --- /dev/null +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRegistryClientJavaDocSnippets.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.containers.containerregistry; + +import com.azure.containers.containerregistry.models.ArtifactManifestProperties; +import com.azure.containers.containerregistry.models.ContainerRepositoryProperties; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.util.Context; + +public class ContainerRegistryClientJavaDocSnippets { + /** + * Generates code sample for creating a {@link ContainerRegistryClient} + * + * @return An instance of {@link ContainerRegistryClient} + * @throws IllegalStateException If client cannot be created + */ + public ContainerRegistryClient createAsyncContainerRegistryClient() { + final String endpoint = getEndpoint(); + final TokenCredential credential = getTokenCredentials(); + + // BEGIN: com.azure.containers.containerregistry.ContainerRegistryClient.instantiation + ContainerRegistryClient registryAsyncClient = new ContainerRegistryClientBuilder() + .endpoint(endpoint) + .credential(credential) + .buildClient(); + // END: com.azure.containers.containerregistry.ContainerRegistryClient.instantiation + return registryAsyncClient; + } + + public ContainerRegistryClient createAsyncContainerRegistryClientWithPipeline() { + final String endpoint = getEndpoint(); + final TokenCredential credential = getTokenCredentials(); + + // BEGIN: com.azure.containers.containerregistry.ContainerRegistryClient.pipeline.instantiation + HttpPipeline pipeline = new HttpPipelineBuilder() + .policies(/* add policies */) + .build(); + + ContainerRegistryClient registryAsyncClient = new ContainerRegistryClientBuilder() + .pipeline(pipeline) + .endpoint(endpoint) + .credential(credential) + .buildClient(); + // END: com.azure.containers.containerregistry.ContainerRegistryClient.pipeline.instantiation + return registryAsyncClient; + } + + public void deleteRepositoryCodeSnippet() { + ContainerRegistryClient client = getAsyncClient(); + final String repositoryName = getRepositoryName(); + + // BEGIN: com.azure.containers.containerregistry.ContainerRegistryClient.deleteRepository#String + client.deleteRepository(repositoryName); + // END: com.azure.containers.containerregistry.ContainerRegistryClient.deleteRepository#String + } + + public void deleteRepositoryWithResponseCodeSnippet() { + ContainerRegistryClient client = getAsyncClient(); + final String repositoryName = getRepositoryName(); + + // BEGIN: com.azure.containers.containerregistry.ContainerRegistryClient.deleteRepositoryWithResponse#String-Context + client.deleteRepositoryWithResponse(repositoryName, Context.NONE); + // END: com.azure.containers.containerregistry.ContainerRegistryClient.deleteRepositoryWithResponse#String-Context + } + + public void listRepositoryNamesCodeSnippet() { + ContainerRegistryClient client = getAsyncClient(); + + // BEGIN: com.azure.containers.containerregistry.ContainerRegistryClient.listRepositoryNames + client.listRepositoryNames().stream().forEach(name -> { + System.out.printf("Repository Name:%s,", name); + }); + // END: com.azure.containers.containerregistry.ContainerRegistryClient.listRepositoryNames + } + + public void listRepositoryNamesWithContextCodeSnippet() { + ContainerRegistryClient client = getAsyncClient(); + + // BEGIN: com.azure.containers.containerregistry.ContainerRegistryClient.listRepositoryNames#Context + client.listRepositoryNames(Context.NONE).stream().forEach(name -> { + System.out.printf("Repository Name:%s,", name); + }); + // END: com.azure.containers.containerregistry.ContainerRegistryClient.listRepositoryNames#Context + } + + public void getRepositoryCodeSnippet() { + ContainerRegistryClient client = getAsyncClient(); + final String repositoryName = getRepositoryName(); + + // BEGIN: com.azure.containers.containerregistry.ContainerRegistryClient.getRepository + ContainerRepository repository = client.getRepository(repositoryName); + ContainerRepositoryProperties properties = repository.getProperties(); + System.out.println(properties.getName()); + // END: com.azure.containers.containerregistry.ContainerRegistryClient.getRepository + } + + public void getArtifactCodeSnippet() { + ContainerRegistryClient client = getAsyncClient(); + final String repositoryName = getRepositoryName(); + final String tagOrDigest = getTagOrDigest(); + + // BEGIN: com.azure.containers.containerregistry.ContainerRegistryClient.getArtifact + RegistryArtifact registryArtifact = client.getArtifact(repositoryName, tagOrDigest); + ArtifactManifestProperties properties = registryArtifact.getManifestProperties(); + System.out.println(properties.getDigest()); + // END: com.azure.containers.containerregistry.ContainerRegistryClient.getArtifact + } + + /** + * Implementation not provided for this method. + * + * @return {@code null} + */ + private String getTagOrDigest() { + return null; + } + + /** + * Implementation not provided for this method + * + * @return {@code null} + */ + private ContainerRegistryClient getAsyncClient() { + return null; + } + + /** + * Implementation not provided for this method + * + * @return {@code null} + */ + private String getEndpoint() { + return null; + } + + /** + * Implementation not provided for this method + * + * @return {@code null} + */ + private String getRepositoryName() { + return null; + } + + /** + * Implementation not provided for this method + * + * @return {@code null} + */ + private TokenCredential getTokenCredentials() { + return null; + } +} + diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerAsyncRepositoryJavaDocSnippets.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRepositoryAsyncJavaDocSnippets.java similarity index 64% rename from sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerAsyncRepositoryJavaDocSnippets.java rename to sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRepositoryAsyncJavaDocSnippets.java index d49a0fcd3956..583586785c2b 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerAsyncRepositoryJavaDocSnippets.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRepositoryAsyncJavaDocSnippets.java @@ -3,13 +3,13 @@ package com.azure.containers.containerregistry; -import com.azure.containers.containerregistry.models.ManifestOrderBy; -import com.azure.containers.containerregistry.models.RepositoryProperties; +import com.azure.containers.containerregistry.models.ArtifactManifestOrderBy; +import com.azure.containers.containerregistry.models.ContainerRepositoryProperties; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; -public class ContainerAsyncRepositoryJavaDocSnippets { +public class ContainerRepositoryAsyncJavaDocSnippets { /** * Generates code sample for creating a {@link ContainerRepositoryAsync} * @@ -20,13 +20,13 @@ public ContainerRepositoryAsync createAsyncContainerRepository() { String endpoint = getEndpoint(); String repository = getRepository(); TokenCredential credential = getTokenCredentials(); - // BEGIN: com.azure.containers.containerregistry.async.repository.instantiation + // BEGIN: com.azure.containers.containerregistry.ContainerRepositoryAsync.instantiation ContainerRepositoryAsync repositoryAsyncClient = new ContainerRegistryClientBuilder() .endpoint(endpoint) .credential(credential) .buildAsyncClient() .getRepository(repository); - // END: com.azure.containers.containerregistry.async.repository.instantiation + // END: com.azure.containers.containerregistry.ContainerRepositoryAsync.instantiation return repositoryAsyncClient; } @@ -34,7 +34,7 @@ public ContainerRepositoryAsync createAsyncContainerRespositoryClientWithPipelin String endpoint = getEndpoint(); String repository = getRepository(); TokenCredential credential = getTokenCredentials(); - // BEGIN: com.azure.containers.containerregistry.async.repository.pipeline.instantiation + // BEGIN: com.azure.containers.containerregistry.ContainerRepositoryAsync.pipeline.instantiation HttpPipeline pipeline = new HttpPipelineBuilder() .policies(/* add policies */) .build(); @@ -45,89 +45,89 @@ public ContainerRepositoryAsync createAsyncContainerRespositoryClientWithPipelin .credential(credential) .buildAsyncClient() .getRepository(repository); - // END: com.azure.containers.containerregistry.async.repository.pipeline.instantiation + // END: com.azure.containers.containerregistry.ContainerRepositoryAsync.pipeline.instantiation return repositoryAsyncClient; } public void deleteRepositoryCodeSnippet() { ContainerRepositoryAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.repository.deleteRepository + // BEGIN: com.azure.containers.containerregistry.ContainerRepositoryAsync.deleteRepository client.delete().subscribe(response -> { System.out.printf("Successfully initiated delete of the repository."); }, error -> { System.out.println("Failed to initiate a delete of the repository."); }); - // END: com.azure.containers.containerregistry.async.repository.deleteRepository + // END: com.azure.containers.containerregistry.ContainerRepositoryAsync.deleteRepository } public void deleteRepositoryWithResponseCodeSnippet() { ContainerRepositoryAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.repository.deleteRepositoryWithResponse + // BEGIN: com.azure.containers.containerregistry.ContainerRepositoryAsync.deleteRepositoryWithResponse client.deleteWithResponse().subscribe(response -> { System.out.printf("Successfully initiated delete of the repository."); }, error -> { System.out.println("Failed to initiate a delete of the repository."); }); - // END: com.azure.containers.containerregistry.async.repository.deleteRepositoryWithResponse + // END: com.azure.containers.containerregistry.ContainerRepositoryAsync.deleteRepositoryWithResponse } public void getPropertiesCodeSnippet() { ContainerRepositoryAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.repository.getProperties + // BEGIN: com.azure.containers.containerregistry.ContainerRepositoryAsync.getProperties client.getProperties().subscribe(response -> { System.out.printf("Name:%s,", response.getName()); }); - // END: com.azure.containers.containerregistry.async.repository.getProperties + // END: com.azure.containers.containerregistry.ContainerRepositoryAsync.getProperties } public void getPropertiesWithResponseCodeSnippet() { ContainerRepositoryAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.repository.getPropertiesWithResponse + // BEGIN: com.azure.containers.containerregistry.ContainerRepositoryAsync.getPropertiesWithResponse client.getPropertiesWithResponse().subscribe(response -> { - final RepositoryProperties properties = response.getValue(); + final ContainerRepositoryProperties properties = response.getValue(); System.out.printf("Name:%s,", properties.getName()); }); - // END: com.azure.containers.containerregistry.async.repository.getPropertiesWithResponse + // END: com.azure.containers.containerregistry.ContainerRepositoryAsync.getPropertiesWithResponse } public void updatePropertiesCodeSnippet() { ContainerRepositoryAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.repository.updateProperties - RepositoryProperties properties = getRepositoryProperties(); + // BEGIN: com.azure.containers.containerregistry.ContainerRepositoryAsync.updateProperties + ContainerRepositoryProperties properties = getRepositoryProperties(); client.updateProperties(properties).subscribe(); - // END: com.azure.containers.containerregistry.async.repository.updateProperties + // END: com.azure.containers.containerregistry.ContainerRepositoryAsync.updateProperties } public void updatePropertiesWithResponseCodeSnippet() { ContainerRepositoryAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.repository.updatePropertiesWithResponse - RepositoryProperties properties = getRepositoryProperties(); + // BEGIN: com.azure.containers.containerregistry.ContainerRepositoryAsync.updatePropertiesWithResponse + ContainerRepositoryProperties properties = getRepositoryProperties(); client.updatePropertiesWithResponse(properties).subscribe(); - // END: com.azure.containers.containerregistry.async.repository.updatePropertiesWithResponse + // END: com.azure.containers.containerregistry.ContainerRepositoryAsync.updatePropertiesWithResponse } - public void listManifestsCodeSnippet() { + public void listManifestPropertiesCodeSnippet() { ContainerRepositoryAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.repository.listManifests - client.listManifests().byPage(10) + // BEGIN: com.azure.containers.containerregistry.ContainerRepositoryAsync.listManifestProperties + client.listManifestProperties().byPage(10) .subscribe(ManifestPropertiesPagedResponse -> { ManifestPropertiesPagedResponse.getValue().stream().forEach( ManifestProperties -> System.out.println(ManifestProperties.getDigest())); }); - // END: com.azure.containers.containerregistry.async.repository.listManifests + // END: com.azure.containers.containerregistry.ContainerRepositoryAsync.listManifestProperties } - public void listManifestsWithOptionsCodeSnippet() { + public void listManifestPropertiesWithOptionsCodeSnippet() { ContainerRepositoryAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.repository.listManifestsWithOptions - client.listManifests(ManifestOrderBy.LAST_UPDATED_ON_DESCENDING).byPage(10) + // BEGIN: com.azure.containers.containerregistry.ContainerRepositoryAsync.listManifestPropertiesWithOptions + client.listManifestProperties(ArtifactManifestOrderBy.LAST_UPDATED_ON_DESCENDING).byPage(10) .subscribe(ManifestPropertiesPagedResponse -> { ManifestPropertiesPagedResponse.getValue().stream().forEach( ManifestProperties -> System.out.println(ManifestProperties.getDigest())); }); - // END: com.azure.containers.containerregistry.async.repository.listManifestsWithOptions + // END: com.azure.containers.containerregistry.ContainerRepositoryAsync.listManifestPropertiesWithOptions } /** @@ -135,7 +135,7 @@ public void listManifestsWithOptionsCodeSnippet() { * * @return {@code null} */ - private RepositoryProperties getRepositoryProperties() { + private ContainerRepositoryProperties getRepositoryProperties() { return null; } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRepositoryJavaDocSnippets.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRepositoryJavaDocSnippets.java index f7b422c6a151..fe7e4883f249 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRepositoryJavaDocSnippets.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ContainerRepositoryJavaDocSnippets.java @@ -3,8 +3,8 @@ package com.azure.containers.containerregistry; -import com.azure.containers.containerregistry.models.ManifestOrderBy; -import com.azure.containers.containerregistry.models.RepositoryProperties; +import com.azure.containers.containerregistry.models.ArtifactManifestOrderBy; +import com.azure.containers.containerregistry.models.ContainerRepositoryProperties; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; @@ -21,12 +21,12 @@ public ContainerRepository createContainerRepository() { String endpoint = getEndpoint(); String repository = getRepository(); TokenCredential credential = getTokenCredentials(); - // BEGIN: com.azure.containers.containerregistry.repository.instantiation + // BEGIN: com.azure.containers.containerregistry.ContainerRepository.instantiation ContainerRepository repositoryClient = new ContainerRegistryClientBuilder() .endpoint(endpoint) .credential(credential) .buildClient().getRepository(repository); - // END: com.azure.containers.containerregistry.repository.instantiation + // END: com.azure.containers.containerregistry.ContainerRepository.instantiation return repositoryClient; } @@ -34,7 +34,7 @@ public ContainerRepository createContainerRepositoryWithPipeline() { String endpoint = getEndpoint(); String repository = getRepository(); TokenCredential credential = getTokenCredentials(); - // BEGIN: com.azure.containers.containerregistry.repository.pipeline.instantiation + // BEGIN: com.azure.containers.containerregistry.ContainerRepository.pipeline.instantiation HttpPipeline pipeline = new HttpPipelineBuilder() .policies(/* add policies */) .build(); @@ -44,90 +44,90 @@ public ContainerRepository createContainerRepositoryWithPipeline() { .endpoint(endpoint) .credential(credential) .buildClient().getRepository(repository); - // END: com.azure.containers.containerregistry.repository.pipeline.instantiation + // END: com.azure.containers.containerregistry.ContainerRepository.pipeline.instantiation return repositoryClient; } public void deleteRepositoryCodeSnippet() { ContainerRepository client = getClient(); - // BEGIN: com.azure.containers.containerregistry.repository.deleteRepository + // BEGIN: com.azure.containers.containerregistry.ContainerRepository.deleteRepository client.delete(); System.out.printf("Successfully initiated delete."); - // END: com.azure.containers.containerregistry.repository.deleteRepository + // END: com.azure.containers.containerregistry.ContainerRepository.deleteRepository } public void deleteRepositoryWithResponseCodeSnippet() { ContainerRepository client = getClient(); - // BEGIN: com.azure.containers.containerregistry.repository.deleteRepositoryWithResponse + // BEGIN: com.azure.containers.containerregistry.ContainerRepository.deleteRepositoryWithResponse Response response = client.deleteWithResponse(Context.NONE); System.out.printf("Successfully initiated delete."); - // END: com.azure.containers.containerregistry.repository.deleteRepositoryWithResponse + // END: com.azure.containers.containerregistry.ContainerRepository.deleteRepositoryWithResponse } public void getPropertiesCodeSnippet() { ContainerRepository client = getClient(); - // BEGIN: com.azure.containers.containerregistry.repository.getProperties - RepositoryProperties properties = client.getProperties(); + // BEGIN: com.azure.containers.containerregistry.ContainerRepository.getProperties + ContainerRepositoryProperties properties = client.getProperties(); System.out.printf("Name:%s,", properties.getName()); - // END: com.azure.containers.containerregistry.repository.getProperties + // END: com.azure.containers.containerregistry.ContainerRepository.getProperties } public void getPropertiesWithResponseCodeSnippet() { ContainerRepository client = getClient(); - // BEGIN: com.azure.containers.containerregistry.repository.getPropertiesWithResponse - Response response = client.getPropertiesWithResponse(Context.NONE); - final RepositoryProperties properties = response.getValue(); + // BEGIN: com.azure.containers.containerregistry.ContainerRepository.getPropertiesWithResponse + Response response = client.getPropertiesWithResponse(Context.NONE); + final ContainerRepositoryProperties properties = response.getValue(); System.out.printf("Name:%s,", properties.getName()); - // END: com.azure.containers.containerregistry.repository.getPropertiesWithResponse + // END: com.azure.containers.containerregistry.ContainerRepository.getPropertiesWithResponse } public void updatePropertiesCodeSnippet() { ContainerRepository client = getClient(); - // BEGIN: com.azure.containers.containerregistry.repository.updateProperties - RepositoryProperties properties = getRepositoryProperties(); + // BEGIN: com.azure.containers.containerregistry.ContainerRepository.updateProperties + ContainerRepositoryProperties properties = getRepositoryProperties(); client.updateProperties(properties); - // END: com.azure.containers.containerregistry.repository.updateProperties + // END: com.azure.containers.containerregistry.ContainerRepository.updateProperties } public void updatePropertiesWithResponseCodeSnippet() { ContainerRepository client = getClient(); - // BEGIN: com.azure.containers.containerregistry.repository.updatePropertiesWithResponse - RepositoryProperties properties = getRepositoryProperties(); + // BEGIN: com.azure.containers.containerregistry.ContainerRepository.updatePropertiesWithResponse + ContainerRepositoryProperties properties = getRepositoryProperties(); client.updatePropertiesWithResponse(properties, Context.NONE); - // END: com.azure.containers.containerregistry.repository.updatePropertiesWithResponse + // END: com.azure.containers.containerregistry.ContainerRepository.updatePropertiesWithResponse } public void listManifestPropertiesCodeSnippet() { ContainerRepository client = getClient(); - // BEGIN: com.azure.containers.containerregistry.repository.listManifests - client.listManifests().iterableByPage(10) + // BEGIN: com.azure.containers.containerregistry.ContainerRepository.listManifestProperties + client.listManifestProperties().iterableByPage(10) .forEach(pagedResponse -> { pagedResponse.getValue().stream().forEach( ManifestProperties -> System.out.println(ManifestProperties.getDigest())); }); - // END: com.azure.containers.containerregistry.repository.listManifests + // END: com.azure.containers.containerregistry.ContainerRepository.listManifestProperties } public void listManifestPropertiesWithOptionsNoContextCodeSnippet() { ContainerRepository client = getClient(); - // BEGIN: com.azure.containers.containerregistry.repository.listManifestsWithOptionsNoContext - client.listManifests(ManifestOrderBy.LAST_UPDATED_ON_DESCENDING).iterableByPage(10) + // BEGIN: com.azure.containers.containerregistry.ContainerRepository.listManifestPropertiesWithOptionsNoContext + client.listManifestProperties(ArtifactManifestOrderBy.LAST_UPDATED_ON_DESCENDING).iterableByPage(10) .forEach(pagedResponse -> { pagedResponse.getValue().stream().forEach( ManifestProperties -> System.out.println(ManifestProperties.getDigest())); }); - // END: com.azure.containers.containerregistry.repository.listManifestsWithOptionsNoContext + // END: com.azure.containers.containerregistry.ContainerRepository.listManifestPropertiesWithOptionsNoContext } public void listManifestPropertiesWithOptionsCodeSnippet() { ContainerRepository client = getClient(); - // BEGIN: com.azure.containers.containerregistry.repository.listManifestsWithOptions - client.listManifests(ManifestOrderBy.LAST_UPDATED_ON_DESCENDING, Context.NONE).iterableByPage(10) + // BEGIN: com.azure.containers.containerregistry.ContainerRepository.listManifestPropertiesWithOptions + client.listManifestProperties(ArtifactManifestOrderBy.LAST_UPDATED_ON_DESCENDING, Context.NONE).iterableByPage(10) .forEach(pagedResponse -> { pagedResponse.getValue().stream().forEach( ManifestProperties -> System.out.println(ManifestProperties.getDigest())); }); - // END: com.azure.containers.containerregistry.repository.listManifestsWithOptions + // END: com.azure.containers.containerregistry.ContainerRepository.listManifestPropertiesWithOptions } /** @@ -135,7 +135,7 @@ public void listManifestPropertiesWithOptionsCodeSnippet() { * * @return {@code null} */ - private RepositoryProperties getRepositoryProperties() { + private ContainerRepositoryProperties getRepositoryProperties() { return null; } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/DeleteImagesAsync.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/DeleteImagesAsync.java index 8ba42450ddc9..61097558606a 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/DeleteImagesAsync.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/DeleteImagesAsync.java @@ -3,10 +3,13 @@ package com.azure.containers.containerregistry; -import com.azure.containers.containerregistry.models.ManifestOrderBy; +import com.azure.containers.containerregistry.models.ArtifactManifestOrderBy; import com.azure.core.credential.TokenCredential; import com.azure.identity.DefaultAzureCredentialBuilder; +/** + * This is a sample for deleting images asynchronously. + */ public class DeleteImagesAsync { static final String ENDPOINT = "https://registryName.azure.io"; @@ -21,7 +24,7 @@ public static void main(String[] args) { final int imagesCountToKeep = 3; client.listRepositoryNames() .map(repositoryName -> client.getRepository(repositoryName)) - .flatMap(repository -> repository.listManifests(ManifestOrderBy.LAST_UPDATED_ON_DESCENDING)) + .flatMap(repository -> repository.listManifestProperties(ArtifactManifestOrderBy.LAST_UPDATED_ON_DESCENDING)) .skip(imagesCountToKeep) .subscribe(imageManifest -> { System.out.printf(String.format("Deleting image with digest %s.%n", imageManifest.getDigest())); diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ListRepositoryNamesAsync.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ListRepositoryNamesAsync.java index a55a2a7d685e..a714e87712c2 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ListRepositoryNamesAsync.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ListRepositoryNamesAsync.java @@ -6,6 +6,9 @@ import com.azure.identity.DefaultAzureCredential; import com.azure.identity.DefaultAzureCredentialBuilder; +/** + * This is a sample for listing repository names asynchronously. + */ public class ListRepositoryNamesAsync { static final String ENDPOINT = "https://registryName.azure.io"; diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ListTagsAsync.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ListTagsAsync.java index b0833f5824b0..60e7f85bc4e7 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ListTagsAsync.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ListTagsAsync.java @@ -3,6 +3,9 @@ package com.azure.containers.containerregistry; +/** + * This is a sample for listing tags asynchronously. + */ public class ListTagsAsync { static final String ENDPOINT = "https://registryName.azure.io"; static final String REPOSITORY_NAME = "library/hello-world"; @@ -15,9 +18,9 @@ public static void main(String[] args) { RegistryArtifactAsync image = anonymousClient.getArtifact(REPOSITORY_NAME, DIGEST); - System.out.printf(String.format("%s has the following aliases:", image.getFullyQualifiedName())); + System.out.printf(String.format("%s has the following aliases:", image.getFullyQualifiedReference())); - image.listTags().subscribe(tag -> { + image.listTagProperties().subscribe(tag -> { System.out.printf(String.format("%s/%s:%s", anonymousClient.getEndpoint(), ENDPOINT, tag.getName())); }, error -> { System.out.println("There was an error while trying to list tags" + error); 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 3274ebc43a91..507a7e0434f1 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 @@ -4,8 +4,9 @@ import com.azure.containers.containerregistry.models.ArtifactManifestProperties; import com.azure.containers.containerregistry.models.ArtifactTagProperties; -import com.azure.containers.containerregistry.models.ManifestOrderBy; +import com.azure.containers.containerregistry.models.ArtifactManifestOrderBy; import com.azure.core.credential.TokenCredential; +import com.azure.core.exception.ClientAuthenticationException; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; @@ -92,8 +93,8 @@ public void deleteImages() { // Obtain the images ordered from newest to oldest PagedIterable imageManifests = - repository.listManifests( - ManifestOrderBy.LAST_UPDATED_ON_DESCENDING, + repository.listManifestProperties( + ArtifactManifestOrderBy.LAST_UPDATED_ON_DESCENDING, Context.NONE); imageManifests.stream().skip(imagesCountToKeep) @@ -133,15 +134,15 @@ public void setArtifactProperties() { private final String os = "os"; private final String digest = "digest"; - public void listTags() { + public void listTagProperties() { ContainerRegistryClient anonymousClient = new ContainerRegistryClientBuilder() .endpoint(endpoint) .buildClient(); RegistryArtifact image = anonymousClient.getArtifact(repositoryName, digest); - PagedIterable tags = image.listTags(); + PagedIterable tags = image.listTagProperties(); - System.out.printf(String.format("%s has the following aliases:", image.getFullyQualifiedName())); + System.out.printf(String.format("%s has the following aliases:", image.getFullyQualifiedReference())); for (ArtifactTagProperties tag : tags) { System.out.printf(String.format("%s/%s:%s", anonymousClient.getEndpoint(), repositoryName, tag.getName())); @@ -159,7 +160,7 @@ public void anonymousClientThrows() { try { anonymousClient.deleteRepository(repositoryName); System.out.println("Unexpected Success: Delete is not allowed on anonymous access"); - } catch (Exception ex) { + } catch (ClientAuthenticationException ex) { System.out.println("Expected exception: Delete is not allowed on anonymous access"); } } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/RegistryArtifactAsyncJavaDocSnippets.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/RegistryArtifactAsyncJavaDocSnippets.java index 392ca717748d..12fe154a5ef1 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/RegistryArtifactAsyncJavaDocSnippets.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/RegistryArtifactAsyncJavaDocSnippets.java @@ -5,7 +5,7 @@ import com.azure.containers.containerregistry.models.ArtifactManifestProperties; import com.azure.containers.containerregistry.models.ArtifactTagProperties; -import com.azure.containers.containerregistry.models.TagOrderBy; +import com.azure.containers.containerregistry.models.ArtifactTagOrderBy; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; @@ -16,12 +16,12 @@ public RegistryArtifactAsync createRegistryArtifact() { String repository = getRepository(); String digest = getDigest(); TokenCredential credential = getTokenCredentials(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.instantiation + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.instantiation RegistryArtifactAsync registryArtifactAsync = new ContainerRegistryClientBuilder() .endpoint(endpoint) .credential(credential) .buildAsyncClient().getArtifact(repository, digest); - // END: com.azure.containers.containerregistry.async.registryartifact.instantiation + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.instantiation return registryArtifactAsync; } @@ -30,7 +30,7 @@ public RegistryArtifactAsync createContainerRepositoryWithPipeline() { String repository = getRepository(); String digest = getDigest(); TokenCredential credential = getTokenCredentials(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.pipeline.instantiation + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.pipeline.instantiation HttpPipeline pipeline = new HttpPipelineBuilder() .policies(/* add policies */) .build(); @@ -40,136 +40,138 @@ public RegistryArtifactAsync createContainerRepositoryWithPipeline() { .endpoint(endpoint) .credential(credential) .buildAsyncClient().getArtifact(repository, digest); - // END: com.azure.containers.containerregistry.async.registryartifact.pipeline.instantiation + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.pipeline.instantiation return registryArtifactAsync; } public void deleteCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.delete + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.delete client.delete().subscribe(); - // END: com.azure.containers.containerregistry.async.registryartifact.delete + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.delete } public void deleteWithResponseCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.deleteWithResponse + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.deleteWithResponse client.deleteWithResponse().subscribe(); - // END: com.azure.containers.containerregistry.async.registryartifact.deleteWithResponse + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.deleteWithResponse } public void deleteTagCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.deleteTag + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.deleteTag String tag = getTag(); client.deleteTag(tag).subscribe(); - // END: com.azure.containers.containerregistry.async.registryartifact.deleteTag + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.deleteTag } public void deleteTagWithResponseCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.deleteTagWithResponse + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.deleteTagWithResponse String tag = getTag(); client.deleteTagWithResponse(tag).subscribe(); - // END: com.azure.containers.containerregistry.async.registryartifact.deleteTagWithResponse + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.deleteTagWithResponse } public void getManifestPropertiesCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.getManifestProperties + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.getManifestProperties client.getManifestProperties() .subscribe(properties -> { System.out.printf("Digest:%s,", properties.getDigest()); }); - // END: com.azure.containers.containerregistry.async.registryartifact.getManifestProperties + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.getManifestProperties } public void getManifestPropertiesWithResponseCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.getManifestPropertiesWithResponse + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.getManifestPropertiesWithResponse client.getManifestPropertiesWithResponse() .subscribe(response -> { final ArtifactManifestProperties properties = response.getValue(); System.out.printf("Digest:%s,", properties.getDigest()); }); - // END: com.azure.containers.containerregistry.async.registryartifact.getManifestPropertiesWithResponse + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.getManifestPropertiesWithResponse } public void getTagPropertiesCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.getTagProperties + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.getTagProperties String tag = getTag(); client.getTagProperties(tag).subscribe(properties -> { System.out.printf("Digest:%s,", properties.getDigest()); }); - // END: com.azure.containers.containerregistry.async.registryartifact.getTagProperties + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.getTagProperties } public void getTagPropertiesWithResponseCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.getTagPropertiesWithResponse + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.getTagPropertiesWithResponse String tag = getTag(); client.getTagPropertiesWithResponse(tag).subscribe(response -> { final ArtifactTagProperties properties = response.getValue(); System.out.printf("Digest:%s,", properties.getDigest()); }); - // END: com.azure.containers.containerregistry.async.registryartifact.getTagPropertiesWithResponse + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.getTagPropertiesWithResponse } - public void listTagsCodeSnippet() { + public void listTagPropertiesCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.listTags - client.listTags().byPage(10) + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.listTagProperties + client.listTagProperties().byPage(10) .subscribe(tagPropertiesPagedResponse -> { tagPropertiesPagedResponse.getValue().stream().forEach( tagProperties -> System.out.println(tagProperties.getDigest())); }); - // END: com.azure.containers.containerregistry.async.registryartifact.listTags + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.listTagProperties } - public void listTagsWithOptionsCodeSnippet() { + public void listTagPropertiesWithOptionsCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.listTagsWithOptions - client.listTags(TagOrderBy.LAST_UPDATED_ON_DESCENDING).byPage(10) + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.listTagPropertiesWithOptions + client.listTagProperties(ArtifactTagOrderBy.LAST_UPDATED_ON_DESCENDING) + .byPage(10) .subscribe(tagPropertiesPagedResponse -> { - tagPropertiesPagedResponse.getValue().stream().forEach( - tagProperties -> System.out.println(tagProperties.getDigest())); + tagPropertiesPagedResponse.getValue() + .stream() + .forEach(tagProperties -> System.out.println(tagProperties.getDigest())); }); - // END: com.azure.containers.containerregistry.async.registryartifact.listTagsWithOptions + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.listTagPropertiesWithOptions } public void updateTagPropertiesCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.updateTagProperties + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.updateTagProperties ArtifactTagProperties properties = getTagProperties(); String tag = getTag(); client.updateTagProperties(tag, properties).subscribe(); - // END: com.azure.containers.containerregistry.async.registryartifact.updateTagProperties + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.updateTagProperties } public void updateTagPropertiesWithResponseCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.updateTagPropertiesWithResponse + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.updateTagPropertiesWithResponse ArtifactTagProperties properties = getTagProperties(); String tag = getTag(); client.updateTagPropertiesWithResponse(tag, properties).subscribe(); - // END: com.azure.containers.containerregistry.async.registryartifact.updateTagPropertiesWithResponse + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.updateTagPropertiesWithResponse } public void updateManifestPropertiesCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.updateManifestProperties + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.updateManifestProperties ArtifactManifestProperties properties = getArtifactManifestProperties(); client.updateManifestProperties(properties).subscribe(); - // END: com.azure.containers.containerregistry.async.registryartifact.updateManifestProperties + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.updateManifestProperties } public void updateManifestPropertiesWithResponseCodeSnippet() { RegistryArtifactAsync client = getAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.async.registryartifact.updateManifestPropertiesWithResponse + // BEGIN: com.azure.containers.containerregistry.RegistryArtifactAsync.updateManifestPropertiesWithResponse ArtifactManifestProperties properties = getArtifactManifestProperties(); client.updateManifestPropertiesWithResponse(properties).subscribe(); - // END: com.azure.containers.containerregistry.async.registryartifact.updateManifestPropertiesWithResponse + // END: com.azure.containers.containerregistry.RegistryArtifactAsync.updateManifestPropertiesWithResponse } /** diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/RegistryArtifactJavaDocSnippets.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/RegistryArtifactJavaDocSnippets.java index edcf9ae17b1b..ca90c8191ba1 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/RegistryArtifactJavaDocSnippets.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/RegistryArtifactJavaDocSnippets.java @@ -5,7 +5,7 @@ import com.azure.containers.containerregistry.models.ArtifactManifestProperties; import com.azure.containers.containerregistry.models.ArtifactTagProperties; -import com.azure.containers.containerregistry.models.TagOrderBy; +import com.azure.containers.containerregistry.models.ArtifactTagOrderBy; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; @@ -18,12 +18,12 @@ public RegistryArtifact createRegistryArtifact() { String repository = getRepository(); String digest = getDigest(); TokenCredential credential = getTokenCredentials(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.instantiation + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.instantiation RegistryArtifact registryArtifact = new ContainerRegistryClientBuilder() .endpoint(endpoint) .credential(credential) .buildClient().getArtifact(repository, digest); - // END: com.azure.containers.containerregistry.registryartifact.instantiation + // END: com.azure.containers.containerregistry.RegistryArtifact.instantiation return registryArtifact; } @@ -32,7 +32,7 @@ public RegistryArtifact createContainerRepositoryWithPipeline() { String repository = getRepository(); String digest = getDigest(); TokenCredential credential = getTokenCredentials(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.pipeline.instantiation + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.pipeline.instantiation HttpPipeline pipeline = new HttpPipelineBuilder() .policies(/* add policies */) .build(); @@ -42,139 +42,145 @@ public RegistryArtifact createContainerRepositoryWithPipeline() { .endpoint(endpoint) .credential(credential) .buildClient().getArtifact(repository, digest); - // END: com.azure.containers.containerregistry.registryartifact.pipeline.instantiation + // END: com.azure.containers.containerregistry.RegistryArtifact.pipeline.instantiation return registryArtifact; } public void deleteRegistryArtifactCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.delete + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.delete client.delete(); - // END: com.azure.containers.containerregistry.registryartifact.delete + // END: com.azure.containers.containerregistry.RegistryArtifact.delete } public void deleteRegistryArtifactWithResponseCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.deleteWithResponse + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.deleteWithResponse#Context client.deleteWithResponse(Context.NONE); - // END: com.azure.containers.containerregistry.registryartifact.deleteWithResponse + // END: com.azure.containers.containerregistry.RegistryArtifact.deleteWithResponse#Context } public void deleteTagCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.deleteTag + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.deleteTag String tag = getTag(); client.deleteTag(tag); - // END: com.azure.containers.containerregistry.registryartifact.deleteTag + // END: com.azure.containers.containerregistry.RegistryArtifact.deleteTag } public void deleteTagWithResponseCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.deleteTagWithResponse + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.deleteTagWithResponse String tag = getTag(); client.deleteTagWithResponse(tag, Context.NONE); - // END: com.azure.containers.containerregistry.registryartifact.deleteTagWithResponse + // END: com.azure.containers.containerregistry.RegistryArtifact.deleteTagWithResponse } public void getManifestPropertiesCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.getManifestProperties + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.getManifestProperties ArtifactManifestProperties properties = client.getManifestProperties(); System.out.printf("Digest:%s,", properties.getDigest()); - // END: com.azure.containers.containerregistry.registryartifact.getManifestProperties + // END: com.azure.containers.containerregistry.RegistryArtifact.getManifestProperties } public void getManifestPropertiesWithResponseCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.getManifestPropertiesWithResponse + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.getManifestPropertiesWithResponse Response response = client.getManifestPropertiesWithResponse( Context.NONE); final ArtifactManifestProperties properties = response.getValue(); System.out.printf("Digest:%s,", properties.getDigest()); - // END: com.azure.containers.containerregistry.registryartifact.getManifestPropertiesWithResponse + // END: com.azure.containers.containerregistry.RegistryArtifact.getManifestPropertiesWithResponse } public void getTagPropertiesCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.getTagProperties + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.getTagProperties String tag = getTag(); ArtifactTagProperties properties = client.getTagProperties(tag); System.out.printf("Digest:%s,", properties.getDigest()); - // END: com.azure.containers.containerregistry.registryartifact.getTagProperties + // END: com.azure.containers.containerregistry.RegistryArtifact.getTagProperties } public void getTagPropertiesWithResponseCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.getTagPropertiesWithResponse + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.getTagPropertiesWithResponse String tag = getTag(); Response response = client.getTagPropertiesWithResponse(tag, Context.NONE); final ArtifactTagProperties properties = response.getValue(); System.out.printf("Digest:%s,", properties.getDigest()); - // END: com.azure.containers.containerregistry.registryartifact.getTagPropertiesWithResponse + // END: com.azure.containers.containerregistry.RegistryArtifact.getTagPropertiesWithResponse } - public void listTagsCodeSnippet() { + public void listTagPropertiesCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.listTags - client.listTags().iterableByPage(10).forEach(pagedResponse -> { + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.listTagProperties + client.listTagProperties().iterableByPage(10).forEach(pagedResponse -> { pagedResponse.getValue().stream().forEach( tagProperties -> System.out.println(tagProperties.getDigest())); }); - // END: com.azure.containers.containerregistry.registryartifact.listTags + // END: com.azure.containers.containerregistry.RegistryArtifact.listTagProperties } - public void listTagsWithOptionsNoContextCodeSnippet() { + public void listTagPropertiesWithOptionsNoContextCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.listTagsWithOptionsNoContext - client.listTags(TagOrderBy.LAST_UPDATED_ON_DESCENDING).iterableByPage(10).forEach(pagedResponse -> { - pagedResponse.getValue().stream().forEach( - tagProperties -> System.out.println(tagProperties.getDigest())); - }); - // END: com.azure.containers.containerregistry.registryartifact.listTagsWithOptionsNoContext + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.listTagPropertiesWithOptionsNoContext + client.listTagProperties(ArtifactTagOrderBy.LAST_UPDATED_ON_DESCENDING) + .iterableByPage(10) + .forEach(pagedResponse -> { + pagedResponse.getValue() + .stream() + .forEach(tagProperties -> System.out.println(tagProperties.getDigest())); + }); + // END: com.azure.containers.containerregistry.RegistryArtifact.listTagPropertiesWithOptionsNoContext } - public void listTagsWithOptionsCodeSnippet() { + public void listTagPropertiesWithOptionsCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.listTagsWithOptions - client.listTags(TagOrderBy.LAST_UPDATED_ON_DESCENDING, Context.NONE).iterableByPage(10).forEach(pagedResponse -> { - pagedResponse.getValue().stream().forEach( - tagProperties -> System.out.println(tagProperties.getDigest())); - }); - // END: com.azure.containers.containerregistry.registryartifact.listTagsWithOptions + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.listTagPropertiesWithOptions + client.listTagProperties(ArtifactTagOrderBy.LAST_UPDATED_ON_DESCENDING, Context.NONE) + .iterableByPage(10) + .forEach(pagedResponse -> { + pagedResponse.getValue() + .stream() + .forEach(tagProperties -> System.out.println(tagProperties.getDigest())); + }); + // END: com.azure.containers.containerregistry.RegistryArtifact.listTagPropertiesWithOptions } public void updateTagPropertiesCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.updateTagProperties + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.updateTagProperties ArtifactTagProperties properties = getArtifactTagProperties(); String tag = getTag(); client.updateTagProperties(tag, properties); - // END: com.azure.containers.containerregistry.registryartifact.updateTagProperties + // END: com.azure.containers.containerregistry.RegistryArtifact.updateTagProperties } public void updateTagPropertiesWithResponseCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.updateTagPropertiesWithResponse + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.updateTagPropertiesWithResponse ArtifactTagProperties properties = getArtifactTagProperties(); String tag = getTag(); client.updateTagPropertiesWithResponse(tag, properties, Context.NONE); - // END: com.azure.containers.containerregistry.registryartifact.updateTagPropertiesWithResponse + // END: com.azure.containers.containerregistry.RegistryArtifact.updateTagPropertiesWithResponse } public void updateManifestPropertiesCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.updateManifestProperties + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.updateManifestProperties ArtifactManifestProperties properties = getArtifactManifestProperties(); client.updateManifestProperties(properties); - // END: com.azure.containers.containerregistry.registryartifact.updateManifestProperties + // END: com.azure.containers.containerregistry.RegistryArtifact.updateManifestProperties } public void updateManifestPropertiesWithResponseCodeSnippet() { RegistryArtifact client = getClient(); - // BEGIN: com.azure.containers.containerregistry.registryartifact.updateManifestPropertiesWithResponse + // BEGIN: com.azure.containers.containerregistry.RegistryArtifact.updateManifestPropertiesWithResponse ArtifactManifestProperties properties = getArtifactManifestProperties(); client.updateManifestPropertiesWithResponse(properties, Context.NONE); - // END: com.azure.containers.containerregistry.registryartifact.updateManifestPropertiesWithResponse + // END: com.azure.containers.containerregistry.RegistryArtifact.updateManifestPropertiesWithResponse } /** diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UpdateRegistryArtifactPropertiesAsync.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UpdateRegistryArtifactPropertiesAsync.java index b6e84e9cfc03..d04e1cd7a8e8 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UpdateRegistryArtifactPropertiesAsync.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UpdateRegistryArtifactPropertiesAsync.java @@ -7,6 +7,9 @@ import com.azure.core.credential.TokenCredential; import com.azure.identity.DefaultAzureCredentialBuilder; +/** + * This is a sample for updating registry artifact properties asynchronously. + */ public class UpdateRegistryArtifactPropertiesAsync { static final String ENDPOINT = "https://registryName.azure.io"; static final String REPOSITORY_NAME = "library/hello-world"; 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 72d7c7a8b00a..b474eb0b33f6 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 @@ -4,11 +4,11 @@ package com.azure.containers.containerregistry; import com.azure.containers.containerregistry.models.ArtifactArchitecture; +import com.azure.containers.containerregistry.models.ArtifactManifestPlatform; import com.azure.containers.containerregistry.models.ArtifactManifestProperties; -import com.azure.containers.containerregistry.models.ArtifactManifestReference; import com.azure.containers.containerregistry.models.ArtifactOperatingSystem; import com.azure.containers.containerregistry.models.ArtifactTagProperties; -import com.azure.containers.containerregistry.models.RepositoryProperties; +import com.azure.containers.containerregistry.models.ContainerRepositoryProperties; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.HttpLogDetailLevel; @@ -71,14 +71,14 @@ public class ContainerRegistryClientsTestBase extends TestBase { .setWriteEnabled(true); - protected static RepositoryProperties repoWriteableProperties = new RepositoryProperties() + protected static ContainerRepositoryProperties repoWriteableProperties = new ContainerRepositoryProperties() .setDeleteEnabled(false) .setListEnabled(true) .setReadEnabled(true) .setWriteEnabled(true) .setTeleportEnabled(false); - protected static RepositoryProperties defaultRepoWriteableProperties = new RepositoryProperties() + protected static ContainerRepositoryProperties defaultRepoWriteableProperties = new ContainerRepositoryProperties() .setDeleteEnabled(true) .setListEnabled(true) .setReadEnabled(true) @@ -109,17 +109,17 @@ ContainerRegistryClientBuilder getContainerRegistryBuilder(HttpClient httpClient return getContainerRegistryBuilder(httpClient, credential, REGISTRY_ENDPOINT); } - List getChildArtifacts(Collection artifacts) { + List getChildArtifacts(Collection artifacts) { return artifacts.stream() .filter(artifact -> artifact.getArchitecture() != null) .map(s -> s.getDigest()).collect(Collectors.toList()); } - String getChildArtifactDigest(Collection artifacts) { + String getChildArtifactDigest(Collection artifacts) { return getChildArtifacts(artifacts).get(0); } - void validateProperties(RepositoryProperties properties) { + void validateProperties(ContainerRepositoryProperties properties) { assertNotNull(properties); assertEquals(HELLO_WORLD_REPOSITORY_NAME, properties.getName()); assertNotNull(properties.getCreatedOn()); @@ -134,7 +134,7 @@ void validateProperties(RepositoryProperties properties) { assertNotNull(properties.getRegistryLoginServer()); } - void validateProperties(Response response) { + void validateProperties(Response response) { validateResponse(response); validateProperties(response.getValue()); } @@ -218,8 +218,8 @@ void validateManifestProperties(ArtifactManifestProperties props, boolean hasTag assertNotNull(props.getOperatingSystem()); } else { assertNotNull(props.getTags()); - assertNotNull(props.getManifestReferences()); - props.getManifestReferences().stream().forEach(prop -> { + assertNotNull(props.getRelatedArtifacts()); + props.getRelatedArtifacts().stream().forEach(prop -> { assertNotNull(prop.getDigest()); assertNotNull(prop.getArchitecture()); assertNotNull(prop.getOperatingSystem()); @@ -272,7 +272,7 @@ void validateTagProperties(Response response, String tagN validateTagProperties(response.getValue(), tagName); } - void validateRepoContentProperties(RepositoryProperties properties) { + void validateRepoContentProperties(ContainerRepositoryProperties properties) { assertNotNull(properties); assertEquals(false, properties.isDeleteEnabled(), "isDelete incorrect"); assertEquals(true, properties.isListEnabled(), "isList incorrect"); diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRepositoryAsyncIntegrationTests.java b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRepositoryAsyncIntegrationTests.java index 6ef15934da5d..e68ca09715fb 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRepositoryAsyncIntegrationTests.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRepositoryAsyncIntegrationTests.java @@ -4,8 +4,8 @@ package com.azure.containers.containerregistry; -import com.azure.containers.containerregistry.models.ManifestOrderBy; -import com.azure.containers.containerregistry.models.RepositoryProperties; +import com.azure.containers.containerregistry.models.ArtifactManifestOrderBy; +import com.azure.containers.containerregistry.models.ContainerRepositoryProperties; import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.HttpClient; import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; @@ -37,7 +37,7 @@ public class ContainerRepositoryAsyncIntegrationTests extends ContainerRegistryC private ContainerRepositoryAsync asyncClient; private ContainerRepository client; - private RepositoryProperties contentProperties; + private ContainerRepositoryProperties contentProperties; @BeforeEach void beforeEach() { @@ -127,7 +127,7 @@ public void listArtifacts(HttpClient httpClient) { asyncClient = getContainerRepositoryAsync(httpClient); client = getContainerRepository(httpClient); - StepVerifier.create(asyncClient.listManifests()) + StepVerifier.create(asyncClient.listManifestProperties()) .recordWith(ArrayList::new) .thenConsumeWhile(x -> true) .expectRecordedMatches(artifacts -> { @@ -136,7 +136,7 @@ public void listArtifacts(HttpClient httpClient) { }) .verifyComplete(); - validateListArtifacts(client.listManifests().stream().collect(Collectors.toList())); + validateListArtifacts(client.listManifestProperties().stream().collect(Collectors.toList())); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -145,19 +145,19 @@ public void listArtifactsWithPageSize(HttpClient httpClient) { asyncClient = getContainerRepositoryAsync(httpClient); client = getContainerRepository(httpClient); - StepVerifier.create(asyncClient.listManifests().byPage(PAGESIZE_2)) + StepVerifier.create(asyncClient.listManifestProperties().byPage(PAGESIZE_2)) .recordWith(ArrayList::new) .thenConsumeWhile(x -> true) .expectRecordedMatches(pagedResList -> validateListArtifactsByPage(pagedResList)).verifyComplete(); - validateListArtifactsByPage(client.listManifests().streamByPage(PAGESIZE_2).collect(Collectors.toList())); + validateListArtifactsByPage(client.listManifestProperties().streamByPage(PAGESIZE_2).collect(Collectors.toList())); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") public void listArtifactsWithInvalidPageSize(HttpClient httpClient) { ContainerRepositoryAsync client = getContainerRepositoryAsync(httpClient); - StepVerifier.create(client.listManifests().byPage(-1)).expectError(IllegalArgumentException.class).verify(); + StepVerifier.create(client.listManifestProperties().byPage(-1)).expectError(IllegalArgumentException.class).verify(); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -166,18 +166,18 @@ public void listArtifactsWithPageSizeAndOrderBy(HttpClient httpClient) { asyncClient = getContainerRepositoryAsync(httpClient); client = getContainerRepository(httpClient); - StepVerifier.create(asyncClient.listManifests(ManifestOrderBy.LAST_UPDATED_ON_ASCENDING).byPage(PAGESIZE_2)) + StepVerifier.create(asyncClient.listManifestProperties(ArtifactManifestOrderBy.LAST_UPDATED_ON_ASCENDING).byPage(PAGESIZE_2)) .recordWith(ArrayList::new) .thenConsumeWhile(x -> true) .expectRecordedMatches(pagedResList -> validateListArtifactsByPage(pagedResList, true)) .verifyComplete(); validateListArtifactsByPage( - client.listManifests(ManifestOrderBy.LAST_UPDATED_ON_ASCENDING, Context.NONE).streamByPage(PAGESIZE_2).collect(Collectors.toList()), + client.listManifestProperties(ArtifactManifestOrderBy.LAST_UPDATED_ON_ASCENDING, Context.NONE).streamByPage(PAGESIZE_2).collect(Collectors.toList()), true); validateListArtifactsByPage( - client.listManifests(ManifestOrderBy.LAST_UPDATED_ON_ASCENDING).streamByPage(PAGESIZE_2).collect(Collectors.toList()), + client.listManifestProperties(ArtifactManifestOrderBy.LAST_UPDATED_ON_ASCENDING).streamByPage(PAGESIZE_2).collect(Collectors.toList()), true); } @@ -187,13 +187,13 @@ public void listArtifactsWithPageSizeNoOrderBy(HttpClient httpClient) { asyncClient = getContainerRepositoryAsync(httpClient); client = getContainerRepository(httpClient); - StepVerifier.create(asyncClient.listManifests(ManifestOrderBy.NONE).byPage(PAGESIZE_2)) + StepVerifier.create(asyncClient.listManifestProperties(ArtifactManifestOrderBy.NONE).byPage(PAGESIZE_2)) .recordWith(ArrayList::new) .thenConsumeWhile(x -> true) .expectRecordedMatches(pagedResList -> validateListArtifactsByPage(pagedResList)) .verifyComplete(); - validateListArtifactsByPage(client.listManifests(ManifestOrderBy.NONE, Context.NONE).streamByPage(PAGESIZE_2).collect(Collectors.toList())); + validateListArtifactsByPage(client.listManifestProperties(ArtifactManifestOrderBy.NONE, Context.NONE).streamByPage(PAGESIZE_2).collect(Collectors.toList())); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/RegistryArtifactAsyncIntegrationTests.java b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/RegistryArtifactAsyncIntegrationTests.java index 39ecce6bbcbd..2c0b5b8d407f 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/RegistryArtifactAsyncIntegrationTests.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/RegistryArtifactAsyncIntegrationTests.java @@ -5,7 +5,7 @@ package com.azure.containers.containerregistry; import com.azure.containers.containerregistry.models.ArtifactManifestProperties; -import com.azure.containers.containerregistry.models.TagOrderBy; +import com.azure.containers.containerregistry.models.ArtifactTagOrderBy; import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; @@ -88,7 +88,7 @@ public void getMultiArchitectureImagePropertiesWithResponse(HttpClient httpClien }).flatMap(res -> getRegistryArtifactAsyncClient(httpClient, res.getValue().getDigest()).getManifestPropertiesWithResponse()) .flatMap(res -> { validateManifestProperties(res, true, false); - return Mono.just(getChildArtifactDigest(res.getValue().getManifestReferences())); + return Mono.just(getChildArtifactDigest(res.getValue().getRelatedArtifacts())); }).flatMap(res -> getRegistryArtifactAsyncClient(httpClient, res).getManifestPropertiesWithResponse()); StepVerifier.create(safeTestRegistyArtifacts) @@ -121,12 +121,12 @@ public void getMultiArchitectureImagePropertiesWithResponseThrows(HttpClient htt @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") - public void listTags(HttpClient httpClient) { + public void listTagProperties(HttpClient httpClient) { String digest = getDigest(httpClient); asyncClient = getRegistryArtifactAsyncClient(httpClient, digest); client = getRegistryArtifactClient(httpClient, digest); - StepVerifier.create(asyncClient.listTags()) + StepVerifier.create(asyncClient.listTagProperties()) .recordWith(ArrayList::new) .thenConsumeWhile(x -> true) .expectRecordedMatches(tags -> { @@ -134,12 +134,12 @@ public void listTags(HttpClient httpClient) { return true; }) .verifyComplete(); - validateListTags(client.listTags().stream().collect(Collectors.toList())); + validateListTags(client.listTagProperties().stream().collect(Collectors.toList())); // Now do the same via tag. asyncClient = getRegistryArtifactAsyncClient(httpClient, LATEST_TAG_NAME); client = getRegistryArtifactClient(httpClient, LATEST_TAG_NAME); - StepVerifier.create(asyncClient.listTags()) + StepVerifier.create(asyncClient.listTagProperties()) .recordWith(ArrayList::new) .thenConsumeWhile(x -> true) .expectRecordedMatches(tags -> { @@ -147,67 +147,67 @@ public void listTags(HttpClient httpClient) { return true; }) .verifyComplete(); - validateListTags(client.listTags().stream().collect(Collectors.toList())); + validateListTags(client.listTagProperties().stream().collect(Collectors.toList())); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") - public void listTagsWithPageSize(HttpClient httpClient) { + public void listTagPropertiesWithPageSize(HttpClient httpClient) { asyncClient = getRegistryArtifactAsyncClient(httpClient, LATEST_TAG_NAME); client = getRegistryArtifactClient(httpClient, LATEST_TAG_NAME); - StepVerifier.create(asyncClient.listTags().byPage(PAGESIZE_2)) + StepVerifier.create(asyncClient.listTagProperties().byPage(PAGESIZE_2)) .recordWith(ArrayList::new) .thenConsumeWhile(x -> true) .expectRecordedMatches(pagedResList -> validateListTags(pagedResList, false)) .verifyComplete(); - validateListTags(client.listTags().streamByPage().collect(Collectors.toList()), false); + validateListTags(client.listTagProperties().streamByPage().collect(Collectors.toList()), false); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") - public void listTagsWithInvalidPageSize(HttpClient httpClient) { + public void listTagPropertiesWithInvalidPageSize(HttpClient httpClient) { asyncClient = getRegistryArtifactAsyncClient(httpClient, LATEST_TAG_NAME); client = getRegistryArtifactClient(httpClient, LATEST_TAG_NAME); - StepVerifier.create(asyncClient.listTags().byPage(-1)) + StepVerifier.create(asyncClient.listTagProperties().byPage(-1)) .verifyError(IllegalArgumentException.class); - assertThrows(IllegalArgumentException.class, () -> client.listTags().streamByPage(-1).collect(Collectors.toList())); + assertThrows(IllegalArgumentException.class, () -> client.listTagProperties().streamByPage(-1).collect(Collectors.toList())); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") - public void listTagsWithPageSizeAndOrderBy(HttpClient httpClient) { + public void listTagPropertiesWithPageSizeAndOrderBy(HttpClient httpClient) { asyncClient = getRegistryArtifactAsyncClient(httpClient, LATEST_TAG_NAME); client = getRegistryArtifactClient(httpClient, LATEST_TAG_NAME); - StepVerifier.create(asyncClient.listTags(TagOrderBy.LAST_UPDATED_ON_ASCENDING).byPage(PAGESIZE_2)) + StepVerifier.create(asyncClient.listTagProperties(ArtifactTagOrderBy.LAST_UPDATED_ON_ASCENDING).byPage(PAGESIZE_2)) .recordWith(ArrayList::new) .thenConsumeWhile(x -> true) .expectRecordedMatches(pagedResList -> validateListTags(pagedResList, true)) .verifyComplete(); - validateListTags(client.listTags(TagOrderBy.LAST_UPDATED_ON_ASCENDING, Context.NONE).streamByPage(PAGESIZE_2).collect(Collectors.toList()), true); - validateListTags(client.listTags(TagOrderBy.LAST_UPDATED_ON_ASCENDING).streamByPage(PAGESIZE_2).collect(Collectors.toList()), true); + validateListTags(client.listTagProperties(ArtifactTagOrderBy.LAST_UPDATED_ON_ASCENDING, Context.NONE).streamByPage(PAGESIZE_2).collect(Collectors.toList()), true); + validateListTags(client.listTagProperties(ArtifactTagOrderBy.LAST_UPDATED_ON_ASCENDING).streamByPage(PAGESIZE_2).collect(Collectors.toList()), true); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") - public void listTagsWithPageSizeNoOrderBy(HttpClient httpClient) { + public void listTagPropertiesWithPageSizeNoOrderBy(HttpClient httpClient) { asyncClient = getRegistryArtifactAsyncClient(httpClient, LATEST_TAG_NAME); client = getRegistryArtifactClient(httpClient, LATEST_TAG_NAME); - StepVerifier.create(asyncClient.listTags(TagOrderBy.NONE).byPage(PAGESIZE_2)) + StepVerifier.create(asyncClient.listTagProperties(ArtifactTagOrderBy.NONE).byPage(PAGESIZE_2)) .recordWith(ArrayList::new) .thenConsumeWhile(x -> true) .expectRecordedMatches(pagedResList -> validateListTags(pagedResList, false)) .verifyComplete(); - validateListTags(client.listTags(TagOrderBy.NONE, Context.NONE).streamByPage(PAGESIZE_2).collect(Collectors.toList()), false); + validateListTags(client.listTagProperties(ArtifactTagOrderBy.NONE, Context.NONE).streamByPage(PAGESIZE_2).collect(Collectors.toList()), false); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -278,16 +278,13 @@ public void convenienceMethods(HttpClient httpClient) { assertEquals(HELLO_WORLD_REPOSITORY_NAME, asyncClient.getRepositoryName()); assertEquals(HELLO_WORLD_REPOSITORY_NAME, client.getRepositoryName()); - assertTrue(asyncClient.getFullyQualifiedName().startsWith(registryName)); - assertTrue(asyncClient.getFullyQualifiedName().endsWith(HELLO_WORLD_REPOSITORY_NAME)); - assertTrue(client.getFullyQualifiedName().startsWith(registryName)); - assertTrue(client.getFullyQualifiedName().endsWith(HELLO_WORLD_REPOSITORY_NAME)); + assertTrue(asyncClient.getFullyQualifiedReference().startsWith(registryName)); + assertTrue(asyncClient.getFullyQualifiedReference().endsWith(LATEST_TAG_NAME)); + assertTrue(client.getFullyQualifiedReference().startsWith(registryName)); + assertTrue(client.getFullyQualifiedReference().endsWith(LATEST_TAG_NAME)); assertEquals(registryEndpoint, asyncClient.getRegistryEndpoint()); assertEquals(registryEndpoint, client.getRegistryEndpoint()); - - assertEquals(LATEST_TAG_NAME, asyncClient.getDigest()); - assertEquals(LATEST_TAG_NAME, client.getDigest()); } } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/RegistryArtifactTests.java b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/RegistryArtifactTests.java index c87060270478..f970e0adde70 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/RegistryArtifactTests.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/RegistryArtifactTests.java @@ -93,7 +93,7 @@ private RegistryArtifact getRegistryArtifactClient(String digest) { @MethodSource("getHttpClients") public void delete(HttpClient httpClient) { client = getRegistryArtifactClient(httpClient, V4_TAG_NAME); - String digest = getChildArtifactDigest(client.getManifestProperties().getManifestReferences()); + String digest = getChildArtifactDigest(client.getManifestProperties().getRelatedArtifacts()); asyncClient = getRegistryArtifactAsyncClient(httpClient, digest); @@ -209,7 +209,7 @@ public void updateTagProperties(HttpClient httpClient) { public void deleteFromRecordFile() { recordFileName = "RegistryArtifactTests.delete[1].json"; client = getRegistryArtifactClient(V4_TAG_NAME); - String digest = getChildArtifactDigest(client.getManifestProperties().getManifestReferences()); + String digest = getChildArtifactDigest(client.getManifestProperties().getRelatedArtifacts()); asyncClient = getRegistryArtifactAsyncClient(digest); client = getRegistryArtifactClient(digest); diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryTokenServiceTest.java b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryTokenServiceTest.java index bbac7663c59c..25716832495d 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryTokenServiceTest.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryTokenServiceTest.java @@ -71,6 +71,7 @@ public void setup() { public void refreshTokenRestAPICalledOnlyOnce() throws Exception { ContainerRegistryTokenService service = new ContainerRegistryTokenService( this.tokenCredential, + null, "myString", this.httpPipeline, this.serializerAdapter diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.getArtifactRegistry[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.getArtifactRegistry[1].json index 8d4629120cf2..2d11c98f2f1e 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.getArtifactRegistry[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.getArtifactRegistry[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "7a8c87a6-934c-496b-af98-f7103ce18d46", + "x-ms-client-request-id" : "070abf82-3974-46d5-8aaa-ce6d3aa643dc", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "c476a8a4-639f-4cc2-be05-ba0599f9a5bb", + "X-Ms-Correlation-Request-Id" : "a0af1196-16f5-4b72-9e77-930290eacadd", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.583333", + "x-ms-ratelimit-remaining-calls-per-second" : "160.166667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "e6b6544d-6ca2-4200-abbb-5b78f0feb5f9", + "x-ms-client-request-id" : "dec6276b-e19d-47cb-b91d-0fdabd2c3e7a", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "b36622ff-8711-47ea-bb1c-7604446aaade", + "X-Ms-Correlation-Request-Id" : "f7d76a51-8c6d-494e-bda2-0176373c5b2d", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.633333", + "x-ms-ratelimit-remaining-calls-per-second" : "161.916667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "43289b13-39b6-403c-a19f-adac1034be6f" + "x-ms-client-request-id" : "2df118a5-3fc9-4d91-851c-6d1093308b34" }, "Response" : { "content-length" : "404", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "dd24b883-4074-44a0-b3c6-c528c0081287", + "X-Ms-Correlation-Request-Id" : "31064988-512c-47d9-b33c-2534cd672574", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -71,20 +71,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "5ad4a439-1711-4207-bb38-3dba1dd711bd", + "x-ms-client-request-id" : "02356524-53ac-4dcb-9d3a-ec61c25327d9", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "37289000-0dcf-413a-b390-cbe5aff89647", + "X-Ms-Correlation-Request-Id" : "7e02fa0b-54f0-46cc-adf1-f97b10b41c8b", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.616667", + "x-ms-ratelimit-remaining-calls-per-second" : "163.166667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -93,7 +93,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "355abb69-d32c-4642-bb22-e64efd82b08e" + "x-ms-client-request-id" : "df7cf2aa-7ee4-46fb-8b7a-fe375363db2d" }, "Response" : { "content-length" : "1611", @@ -102,9 +102,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "54e25cd2-edb4-4cc0-8fd3-352106e8e684", + "X-Ms-Correlation-Request-Id" : "2c4beeaa-f5a6-4567-9c14-b20afb318c86", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifest\":{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"architecture\":\"mips64le\",\"os\":\"linux\"},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"architecture\":\"s390x\",\"os\":\"linux\"},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"architecture\":\"amd64\",\"os\":\"windows\"}]}}\n", @@ -116,20 +116,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "bb3af119-a020-4fc0-a3bb-3db4881d6a35", + "x-ms-client-request-id" : "9de38869-ccc1-4c85-8da0-72dc08e53ea0", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "fd7c36f0-d1cb-4f3b-8007-e78228e60baf", + "X-Ms-Correlation-Request-Id" : "cb864ebf-93dd-4c37-8707-50790cb08837", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.816667", + "x-ms-ratelimit-remaining-calls-per-second" : "160.116667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -138,20 +138,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "86588c64-e0fb-43fa-875d-774a7d046f03", + "x-ms-client-request-id" : "8421fd7d-0d7e-4cf7-88ad-c6ea6dfb4358", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "09e29808-45a5-4c4b-8993-5af9e80de1ba", + "X-Ms-Correlation-Request-Id" : "7deee9cd-0b54-4d28-b6ff-bc300b1ecf3e", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.6", + "x-ms-ratelimit-remaining-calls-per-second" : "163.133333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -160,7 +160,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "47a9d20c-dbcc-497e-ab19-2f772181b457" + "x-ms-client-request-id" : "db3689f6-4ff6-48c1-8ccf-6f40fddaf481" }, "Response" : { "content-length" : "404", @@ -169,9 +169,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "de565c10-18c7-4ef0-9f94-f1fa7ce6b9db", + "X-Ms-Correlation-Request-Id" : "76a10157-6366-46e5-b325-97399dc66371", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -183,20 +183,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "1ec07a1c-db4e-4964-a410-75bfb5fc52d5", + "x-ms-client-request-id" : "09ea700c-c0e7-4a16-84e4-39a16ee937aa", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "937a765c-22a9-475f-ba86-d8aa8dc3b57f", + "X-Ms-Correlation-Request-Id" : "1dccd4f7-bbc9-41a4-aa25-ccb69358e931", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.583333", + "x-ms-ratelimit-remaining-calls-per-second" : "163.116667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -205,7 +205,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "20b02587-e346-4d59-9cf1-f09842991aac" + "x-ms-client-request-id" : "bd19acbc-1a76-4d5f-8e13-d3157716c67f" }, "Response" : { "content-length" : "1611", @@ -214,9 +214,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "e0986c4c-a688-4357-9f7f-002da5493564", + "X-Ms-Correlation-Request-Id" : "83074961-ca53-4323-8f70-1c843300689d", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifest\":{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"architecture\":\"mips64le\",\"os\":\"linux\"},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"architecture\":\"s390x\",\"os\":\"linux\"},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"architecture\":\"amd64\",\"os\":\"windows\"}]}}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.getContainerRepository[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.getContainerRepository[1].json index 6411e39cf0b0..12290466e418 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.getContainerRepository[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.getContainerRepository[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "c6f118e1-dbf8-4034-aec7-7a6f0da166f6", + "x-ms-client-request-id" : "efb83dc8-c19e-47ca-be45-c3bd2ae7f816", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "921b844f-6d95-4e95-8e8d-f4ac3a6b3ef7", + "X-Ms-Correlation-Request-Id" : "cb419fac-af3d-49fe-8f1b-077b5bbccad6", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.35", + "x-ms-ratelimit-remaining-calls-per-second" : "162.483333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:14 GMT", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "4e361377-f544-4483-b79b-9162123a38be", + "x-ms-client-request-id" : "a3c6eb38-bd84-45a0-bb57-b48444ea3ba4", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "92e9b464-1b2e-4b38-be9c-742bcc813592", + "X-Ms-Correlation-Request-Id" : "72a4d64a-b0e7-48fd-aad6-6bbdc97fe122", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.533333", + "x-ms-ratelimit-remaining-calls-per-second" : "161.933333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:14 GMT", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "a417af19-b74f-4040-9e30-a83aefe5aef0" + "x-ms-client-request-id" : "ef221eca-7722-4ca4-9868-2dc890da69e3" }, "Response" : { "content-length" : "339", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:14 GMT", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "90295e0d-7ba7-4613-bcb1-af16d97b2500", + "X-Ms-Correlation-Request-Id" : "555c8e7e-a2a9-4e6f-8bef-cdbdcf8586a1", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"createdTime\":\"2021-05-11T23:47:44.9315937Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.4432439Z\",\"manifestCount\":12,\"tagCount\":5,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"teleportEnabled\":false}}\n", @@ -71,20 +71,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "e45f8e7b-a97d-4976-87a1-2c9bd7acf1bf", + "x-ms-client-request-id" : "031b5e81-28c8-42bf-b5d9-b0e63dc25778", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "e8b7b8ed-4226-420d-bb02-87b5c1a673d6", + "X-Ms-Correlation-Request-Id" : "e8226c24-094c-44a9-b588-149ba376f262", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.25", + "x-ms-ratelimit-remaining-calls-per-second" : "163.666667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:14 GMT", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -93,20 +93,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "77ebfa99-3c3d-499d-92ed-839a730c7f46", + "x-ms-client-request-id" : "02326fa4-0b8d-4520-8d4a-4cc52b4ea800", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "e4e43d17-8325-4a6e-b6d9-6ede34c2ace7", + "X-Ms-Correlation-Request-Id" : "4f610ffe-6a1b-44ae-8edd-eab4b95e967f", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.333333", + "x-ms-ratelimit-remaining-calls-per-second" : "160.516667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:14 GMT", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -115,7 +115,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "4d1e6b80-dfe6-4f4c-94f4-896d5d351ba9" + "x-ms-client-request-id" : "9d3bb9f6-002b-4a47-a1c2-a3cdc41db37c" }, "Response" : { "content-length" : "339", @@ -124,9 +124,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:14 GMT", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "7ad3961c-31e8-497c-953c-7e314f693e11", + "X-Ms-Correlation-Request-Id" : "2a5a9e05-1663-42dc-ac48-77dcb428453a", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"createdTime\":\"2021-05-11T23:47:44.9315937Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.4432439Z\",\"manifestCount\":12,\"tagCount\":5,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"teleportEnabled\":false}}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.listRepositoryNamesWithPageSize[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.listRepositoryNamesWithPageSize[1].json index 5ede03c094be..3a3137945d93 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.listRepositoryNamesWithPageSize[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.listRepositoryNamesWithPageSize[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d7e7953f-c617-4bf4-ac98-0425575dc38c", + "x-ms-client-request-id" : "485a8fd4-e9d2-4e35-a6bc-16cfc006910d", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "8545350a-c03d-41ba-8b81-5b66fc8f8d6f", + "X-Ms-Correlation-Request-Id" : "daa8c11b-87cf-497e-93b8-d6160b7900f9", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.283333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.75", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:04 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "a50f722c-8e9a-46c4-ac2d-536b9168ccab", + "x-ms-client-request-id" : "a65b596b-74a3-4cfb-aba7-9a8296fc0f5b", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "473a30e9-215d-4070-9cd2-47510364c74f", + "X-Ms-Correlation-Request-Id" : "7852820b-dead-4c5f-a732-105f6d8ff698", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165", + "x-ms-ratelimit-remaining-calls-per-second" : "164.55", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/_catalog?n=1", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f52de169-5e9c-4e0c-90c1-2000149d08c8" + "x-ms-client-request-id" : "3ec48c4a-c5aa-4977-b602-736e4eb8c9cd" }, "Response" : { "content-length" : "36", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "fe5e10d2-82c4-402f-b0ad-665f93767a86", + "X-Ms-Correlation-Request-Id" : "c5b33739-bf71-40e5-87aa-700ca351afc4", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"repositories\":[\"library/alpine\"]}\n", @@ -72,20 +72,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "7fd00e22-7bdf-4af7-b9d5-1396df8a70f2", + "x-ms-client-request-id" : "0c46dcac-e50d-42de-953c-e17748a82623", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "b2d5785a-161e-4e4e-bf24-e9a848365afd", + "X-Ms-Correlation-Request-Id" : "62f087ff-b7f8-4326-8261-78554be49207", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.55", + "x-ms-ratelimit-remaining-calls-per-second" : "166.45", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -94,7 +94,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/_catalog?last=library%2Falpine&n=1&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "3fb94aa5-2158-4d84-a4dd-67324acfd47e" + "x-ms-client-request-id" : "ec437ce9-2653-4f84-849a-dc63a298f643" }, "Response" : { "content-length" : "43", @@ -103,9 +103,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "3e867dab-a3a0-45c9-bb71-9f61f7f5d696", + "X-Ms-Correlation-Request-Id" : "3dd50ebf-5789-4f6f-bbf0-bc772ece5e54", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"repositories\":[\"library/hello-seattle\"]}\n", @@ -118,20 +118,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "a97e8201-e76a-42c2-a602-914ed0f5067f", + "x-ms-client-request-id" : "3ee697ba-0191-483a-945f-5334a040860c", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "15e746be-66c3-448a-a54b-e2635aa268fb", + "X-Ms-Correlation-Request-Id" : "47dcbe63-f44b-4c48-ac27-efe5642f3226", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.483333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.933333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -140,7 +140,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/_catalog?last=library%2Fhello-seattle&n=1&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "374d63f0-9f7d-455c-a68a-9cc542c93554" + "x-ms-client-request-id" : "1b118c54-279a-413e-9b8b-b94dfcd5db1c" }, "Response" : { "content-length" : "41", @@ -149,9 +149,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "0116cbc4-a972-425a-9103-4ab430bd40e9", + "X-Ms-Correlation-Request-Id" : "72ee1511-8352-4d90-abe0-76e80d5b9ef9", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"repositories\":[\"library/hello-world\"]}\n", @@ -163,20 +163,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "08db751e-9c85-4cdc-bfda-52c28157cfa4", + "x-ms-client-request-id" : "c9d61bba-ca6e-419b-9c5b-de68ae5543ce", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "ad49989d-8ef8-4154-b807-2b8c906e604a", + "X-Ms-Correlation-Request-Id" : "e75d3d35-165f-411f-89ec-4e2d5e802939", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.466667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.916667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:18 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -185,20 +185,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "4df2f767-d0ed-4bd8-b851-0f4e9eea6a42", + "x-ms-client-request-id" : "315bfdb0-fc9b-4991-85b7-ad222b1bee29", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "dcf3a0bf-04a5-4cc6-9a71-0e186a5c63f1", + "X-Ms-Correlation-Request-Id" : "0ce9d156-2ff9-487e-ba9c-83b4c59c668e", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.25", + "x-ms-ratelimit-remaining-calls-per-second" : "164.6", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:18 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -207,7 +207,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/_catalog?n=1", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "2d99812a-8168-4389-ad69-1bd4199fb8a7" + "x-ms-client-request-id" : "0ab85f29-e0e4-460b-b029-1188393500b5" }, "Response" : { "content-length" : "36", @@ -216,9 +216,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:18 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "6dd18535-c9f9-41a5-aea0-75de8c743b5b", + "X-Ms-Correlation-Request-Id" : "8d5f4e08-b5d8-4c05-8a5f-2ed7ce502747", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"repositories\":[\"library/alpine\"]}\n", @@ -231,20 +231,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d97e4b63-07b7-4ec2-827f-480605f4d3ef", + "x-ms-client-request-id" : "f97b2672-b06f-496e-8246-9de956286aa6", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "341b97ea-12d1-402d-836d-93d017347395", + "X-Ms-Correlation-Request-Id" : "52e6c561-cc0e-4694-a21e-5338e7b637f8", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.233333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.55", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:18 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -253,7 +253,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/_catalog?last=library%2Falpine&n=1&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "6cda7c8b-5d15-478c-90f4-3aeb02c7d4d7" + "x-ms-client-request-id" : "00b1d725-3afc-425f-8d79-a440b46ce0ef" }, "Response" : { "content-length" : "43", @@ -262,9 +262,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:18 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "d794c5cf-db29-4556-9a59-a55320c9d3f6", + "X-Ms-Correlation-Request-Id" : "de07c3b3-42a1-47b5-bdc2-31313bdb4da8", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"repositories\":[\"library/hello-seattle\"]}\n", @@ -277,20 +277,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "32bd4b55-2d46-4e34-aac6-efaf4bd8bb97", + "x-ms-client-request-id" : "0a464f08-3541-4491-bbdb-a2ceb1611be5", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "8b8bc172-b539-4c99-928a-b89cb453f406", + "X-Ms-Correlation-Request-Id" : "cdd1e495-fb88-4a56-8d1f-17a4700d38d8", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.216667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.883333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:18 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -299,7 +299,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/_catalog?last=library%2Fhello-seattle&n=1&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "b7baa450-9699-40a3-9bae-e06b7c648f09" + "x-ms-client-request-id" : "ed935666-4faa-4c4e-9e26-67e519c2cbc5" }, "Response" : { "content-length" : "41", @@ -308,9 +308,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:18 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "9fd4a5a8-ad3a-4d6d-ac7f-8c2790d489f2", + "X-Ms-Correlation-Request-Id" : "93732d87-cbab-4fcd-8ce1-96f04fd45b2c", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"repositories\":[\"library/hello-world\"]}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.listRepositoryNames[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.listRepositoryNames[1].json index c938fa2151b3..3955246e53ed 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.listRepositoryNames[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientIntegrationTests.listRepositoryNames[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "bb6bdba1-91f1-477d-8a81-c5e747643214", + "x-ms-client-request-id" : "99621209-243e-4368-8316-82959726b75e", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "7287b43f-6587-4fbd-8d52-9806a3779878", + "X-Ms-Correlation-Request-Id" : "a209af74-237e-4f0c-bd92-6634f9e064af", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.8", + "x-ms-ratelimit-remaining-calls-per-second" : "163.85", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:47 GMT", + "Date" : "Thu, 27 May 2021 17:50:34 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "31072b94-2370-4f16-898a-c0c4d44e0ed9", + "x-ms-client-request-id" : "b58e809c-dfe9-4cd6-ab52-910d8a40ad00", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "54c1d241-6da3-4e19-b4f0-c812ed356231", + "X-Ms-Correlation-Request-Id" : "23026c6b-4628-4dca-9ae8-3e0b927d4220", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.133333", + "x-ms-ratelimit-remaining-calls-per-second" : "163.983333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:34 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/_catalog", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "9ed6ac4f-26ca-4e3a-881b-7d654b6c1973" + "x-ms-client-request-id" : "6548a055-8c12-4bb1-be7b-375dc2f0b503" }, "Response" : { "content-length" : "82", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:34 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "b2c8dd43-9fde-4e91-9b6d-0af224f9631a", + "X-Ms-Correlation-Request-Id" : "97e60bc2-6878-46b6-aec8-90d199e3d9b6", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"repositories\":[\"library/alpine\",\"library/hello-seattle\",\"library/hello-world\"]}\n", @@ -71,20 +71,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "37bcc39f-3c93-4ba9-83b0-b9e57916e75e", + "x-ms-client-request-id" : "18865fe4-eb50-4c56-99f3-f896efa0fd85", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "f86fb708-1730-4baf-b38c-9015dc8376e4", + "X-Ms-Correlation-Request-Id" : "1c4d6a9f-cdbd-4513-b925-fe40812c279e", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.916667", + "x-ms-ratelimit-remaining-calls-per-second" : "160.916667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:34 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -93,20 +93,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "4a6c6f88-1bcb-464b-8618-9e43b6b6a93a", + "x-ms-client-request-id" : "e108a3c4-c2d7-4971-9c28-30fdf83696ed", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "ad540e9b-d687-4d28-b0c2-c24824c5a7cb", + "X-Ms-Correlation-Request-Id" : "6329d38d-3245-4d06-8516-23404fa7c6d2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.566667", + "x-ms-ratelimit-remaining-calls-per-second" : "160.55", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:34 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -115,7 +115,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/_catalog", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "cca0df25-bd76-40ac-a2b3-ec7795daaeaa" + "x-ms-client-request-id" : "b0335d1e-2462-480e-b726-7f643e4d51ad" }, "Response" : { "content-length" : "82", @@ -124,9 +124,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:48 GMT", + "Date" : "Thu, 27 May 2021 17:50:34 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "61c3044f-1ca4-482b-8ac6-9bf117fef98f", + "X-Ms-Correlation-Request-Id" : "89bfc320-f554-4aae-bbb9-888bc9bcf916", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"repositories\":[\"library/alpine\",\"library/hello-seattle\",\"library/hello-world\"]}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientTest.deleteRepositoryFromMethod.json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientTest.deleteRepositoryFromMethod.json index 19da2e44f663..d5f3d494523a 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientTest.deleteRepositoryFromMethod.json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientTest.deleteRepositoryFromMethod.json @@ -4,7 +4,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-seattle", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "0457a96f-5436-4a56-8a1a-a8e85a3b7407" + "x-ms-client-request-id" : "e313704f-1bb3-4c8d-bd30-ff9ba40bb3c8" }, "Response" : { "retry-after" : "0", @@ -18,7 +18,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-seattle", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f56786df-d2f4-453c-a1b6-674791268359" + "x-ms-client-request-id" : "f52ae57b-8773-428a-b2b8-760525cc6eb7" }, "Response" : { "retry-after" : "0", @@ -32,7 +32,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-seattle", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f514bb71-62f7-4ba1-90bc-b5a335c2392e" + "x-ms-client-request-id" : "03243bc3-52d4-4f02-b287-9fb83fecb07c" }, "Response" : { "retry-after" : "0", @@ -46,7 +46,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-seattle", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d81cdc2d-887d-4ec3-b253-d019525110f0" + "x-ms-client-request-id" : "9c7470c3-fce4-442a-ada7-e76d25f1d86e" }, "Response" : { "retry-after" : "0", @@ -60,7 +60,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-seattle", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "785f25d6-22fd-47ff-98b7-ddc9e6db3431" + "x-ms-client-request-id" : "326bb6f0-2271-49f3-8b47-97857b7852f1" }, "Response" : { "retry-after" : "0", @@ -74,7 +74,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-seattle", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "6934bd59-50a5-45c8-8a33-173907cffd78" + "x-ms-client-request-id" : "fc1ceb31-58f0-45e5-bca7-4b0cbcefba8b" }, "Response" : { "retry-after" : "0", @@ -88,7 +88,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-seattle", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f0866356-fcf9-456e-9bc3-78c8c0530650" + "x-ms-client-request-id" : "bb4ff59b-8681-41a6-8cad-cdc6af8ae958" }, "Response" : { "retry-after" : "0", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientTest.deleteRepository[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientTest.deleteRepository[1].json index f66d64e4d41a..d62d4dcdc30e 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientTest.deleteRepository[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryClientTest.deleteRepository[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "fdbe3a92-01e3-464a-86cf-3f5808bf0a0e", + "x-ms-client-request-id" : "deaab347-27f4-4ef6-b53f-4fd0fc01604a", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "acdd8e35-26a2-43b2-a2f6-e99f21feadc3", + "X-Ms-Correlation-Request-Id" : "1e395cf2-b980-42be-be31-1c21e0fcf919", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.616667", + "x-ms-ratelimit-remaining-calls-per-second" : "165.75", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:22 GMT", + "Date" : "Thu, 27 May 2021 17:50:09 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "053b5c1f-c016-4a7f-a407-3c819ff384ca", + "x-ms-client-request-id" : "3962dd56-6323-48de-b48a-2d58e1f319fc", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "47bac63a-e5c0-43d3-91b2-abd157532f55", + "X-Ms-Correlation-Request-Id" : "dfbac34b-9c76-43cd-af12-19df714bda05", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165", + "x-ms-ratelimit-remaining-calls-per-second" : "164.6", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:22 GMT", + "Date" : "Thu, 27 May 2021 17:50:09 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-seattle", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "7a327f54-4b1a-4adc-9aaf-d8da780ebce2" + "x-ms-client-request-id" : "b102e6d5-2ed9-425e-8390-af9800956074" }, "Response" : { "content-length" : "936", @@ -57,13 +57,13 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "202", - "Date" : "Wed, 19 May 2021 23:32:29 GMT", + "Date" : "Thu, 27 May 2021 17:50:12 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "2a023dba-3d3d-478f-8a8f-6ab9753cc8a2", + "X-Ms-Correlation-Request-Id" : "be79a567-1902-4504-88a3-f885ab50dcbc", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "X-Ms-Client-Request-Id" : "7a327f54-4b1a-4adc-9aaf-d8da780ebce2", - "X-Ms-Request-Id" : "619189c4-bdce-4279-83f7-c659c2452e23", + "X-Ms-Client-Request-Id" : "b102e6d5-2ed9-425e-8390-af9800956074", + "X-Ms-Request-Id" : "7f895d7c-944a-4d4a-877b-714b7fe49c5f", "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "7.000000", "Body" : "{\"manifestsDeleted\":[\"sha256:220d888ab6ad0f51269605a7ffc0798f442d33c140ed5051e20eec501bbf2202\",\"sha256:2c542cfa48db891b0d4667b1fd98c78428d0e4d7e59ab483dd027a185cf4dbe0\",\"sha256:5c9ac9b2b91bacbe58641a89cb130d6b1cdb8b040e48a76751335d01ef5d76b7\",\"sha256:6f29a27f990505592eb80fc3032334568562f5f682ee17ef9d6b090bfe387e25\",\"sha256:7a012702999ac3589aeb46d28ab2b9b6b82324d8504b55e5cf4fdc9a9f52558d\",\"sha256:80f072dcbce20f8745fa8ec7594ee1cc5e4c53910df1dc4886b03942f249ba76\",\"sha256:9f16da7cb4e19d8def2ae8343610e985b9c46f33867d4b724ba47a4145952621\",\"sha256:ae574da1bf2b023591ed9c40a086b6768369c511cbc2fad37545dbe3048de81e\",\"sha256:b6ed6e4cc14488cfce68e946d13ae329ccf3e8454b26d106f23e3dff38f0b955\",\"sha256:c22223dc179f142076c071e844254ba21cb2e53a7fbb52ff275865130f11c7c1\",\"sha256:d7f84c1d6f16b1006d6ed62783625113b480ea697664909601f51ef380d55523\",\"sha256:d91c24cf3e56abeb62b887ed721836ba88ed5a543e26d28328e312ab518088f3\"],\"tagsDeleted\":[\"latest\"]}\n", "Content-Type" : "application/json; charset=utf-8" @@ -74,20 +74,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "14c94dd4-fdbd-4ef4-b568-42cafb40455f", + "x-ms-client-request-id" : "0b021e74-181a-486b-92dc-d4c61e7795d1", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "d51de8e6-a092-458d-8a0a-82a911fa35fc", + "X-Ms-Correlation-Request-Id" : "6dbba0f2-8cfc-4e2d-a4d7-5276085b0239", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.933333", + "x-ms-ratelimit-remaining-calls-per-second" : "166.383333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:29 GMT", + "Date" : "Thu, 27 May 2021 17:50:12 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -96,7 +96,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-seattle", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "43d02354-7398-47b5-9ced-de094be3e3c8" + "x-ms-client-request-id" : "8ffc148a-8401-4edd-b536-1599000813e1" }, "Response" : { "content-length" : "99", @@ -105,9 +105,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:32:29 GMT", + "Date" : "Thu, 27 May 2021 17:50:12 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "0d81d337-2095-46cb-b53d-7a824e845e2a", + "X-Ms-Correlation-Request-Id" : "5435808d-63e4-4d6d-895a-90e7661966ff", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"errors\":[{\"code\":\"NAME_UNKNOWN\",\"message\":\"repository \\\"library/hello-seattle\\\" is not found\"}]}\n", @@ -119,20 +119,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "bcb3e091-26b3-4fd6-b612-eed2976f94f9", + "x-ms-client-request-id" : "e4b83b87-657e-49c8-9e2d-f9f7308b6218", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "9aefe353-a809-46c8-b2c6-56ba3f07228c", + "X-Ms-Correlation-Request-Id" : "5f1a136e-6ead-40af-bb3b-9334c77961d3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.916667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.6", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:29 GMT", + "Date" : "Thu, 27 May 2021 17:50:12 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -141,7 +141,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-seattle", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "652cd3ac-1cf5-4145-9c4a-2ab0a4a41746" + "x-ms-client-request-id" : "2db28f45-51c2-466b-83b5-922e06efcc3b" }, "Response" : { "content-length" : "129", @@ -150,13 +150,13 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:32:29 GMT", + "Date" : "Thu, 27 May 2021 17:50:12 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "560f0bf2-fdd8-41c7-98b6-61758dd6038f", + "X-Ms-Correlation-Request-Id" : "a15e1a29-f538-4554-84d8-f319cb3747bf", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "X-Ms-Client-Request-Id" : "652cd3ac-1cf5-4145-9c4a-2ab0a4a41746", - "X-Ms-Request-Id" : "27b5461c-f491-44c9-a266-8475ffc6d1b5", + "X-Ms-Client-Request-Id" : "2db28f45-51c2-466b-83b5-922e06efcc3b", + "X-Ms-Request-Id" : "1cdaa237-e4f7-43ea-8e98-a0be3a98a141", "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "8.000000", "Body" : "{\"errors\":[{\"code\":\"NAME_UNKNOWN\",\"message\":\"repository name not known to registry\",\"detail\":{\"name\":\"library/hello-seattle\"}}]}\n", "Content-Type" : "application/json; charset=utf-8" diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAnonymousAccessTests.listAnonymousRepositories[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAnonymousAccessTests.listAnonymousRepositories[1].json index f63abe23ead3..f8fae375f5f4 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAnonymousAccessTests.listAnonymousRepositories[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAnonymousAccessTests.listAnonymousRepositories[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "7e167744-fb5a-4c07-b54b-eea8c9034c8f", + "x-ms-client-request-id" : "05922e12-7f5d-4bc1-bad9-ec3671820d51", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "80b41a69-8bbe-4bd0-9b73-205b1c2f51a4", + "X-Ms-Correlation-Request-Id" : "f9330439-d35e-4333-9cf1-af445863c2c4", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.65", + "x-ms-ratelimit-remaining-calls-per-second" : "166.583333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:06 GMT", + "Date" : "Thu, 27 May 2021 17:49:54 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,7 +26,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/_catalog", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f61a3082-707f-44f7-bc9e-752b7351f3f4" + "x-ms-client-request-id" : "82438e47-7c95-406b-9084-6e74ec1f24d6" }, "Response" : { "content-length" : "41", @@ -35,9 +35,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:06 GMT", + "Date" : "Thu, 27 May 2021 17:49:54 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "bc2ca4b3-7175-4a61-bb29-75620109f0f9", + "X-Ms-Correlation-Request-Id" : "790be858-54fd-4308-b702-74127f36b5b3", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"repositories\":[\"library/hello-world\"]}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.getArtifactRegistry[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.getArtifactRegistry[1].json index ea1fd7055c2c..3a628d9d51b3 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.getArtifactRegistry[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.getArtifactRegistry[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "863e6772-a74a-4fef-856f-3391a6682489", + "x-ms-client-request-id" : "4e23333b-2fd9-4cc5-8c2f-14acea1db8ca", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "c1243eee-005d-4556-8ec1-79d233d1aa3b", + "X-Ms-Correlation-Request-Id" : "3a9d51d4-2264-4730-a731-5c9b71aae43b", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.416667", + "x-ms-ratelimit-remaining-calls-per-second" : "162.683333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:49 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "97382d47-062c-4f84-8446-b716f0a8af6c", + "x-ms-client-request-id" : "ab35bc64-0623-4d51-ab99-1d762b439bdf", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "c80c2f9a-eee0-4df6-972c-c7417e398aa9", + "X-Ms-Correlation-Request-Id" : "ffa8c3c3-bb51-47e8-b9fe-b70f900f393c", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.75", + "x-ms-ratelimit-remaining-calls-per-second" : "160.1", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:49 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "79fb20bf-c740-4cd1-a401-719ac32f0705" + "x-ms-client-request-id" : "825ad9e6-7e26-405a-b098-28af536c113a" }, "Response" : { "content-length" : "404", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:49 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "ecbde5ca-56ae-4807-b4d5-0baf137cf8f6", + "X-Ms-Correlation-Request-Id" : "9be4cec6-fa7d-40a7-922c-8e1efed9fecc", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -71,20 +71,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f625d1e5-99c5-4a0a-9abe-a4ecfb07e4d1", + "x-ms-client-request-id" : "32dbcff6-981f-43ce-a5cd-a5f8ea821e6b", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "9d0480f6-316b-4617-91fa-ea57230d5794", + "X-Ms-Correlation-Request-Id" : "798c9ed3-9799-4209-8218-3d0a2fb6268d", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.733333", + "x-ms-ratelimit-remaining-calls-per-second" : "161.9", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:49 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -93,7 +93,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "bd628f2d-7ad1-4932-9f56-573d6e3edbe2" + "x-ms-client-request-id" : "05026fbc-bf26-4c4d-b860-5fe2e466496a" }, "Response" : { "content-length" : "1611", @@ -102,9 +102,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:49 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "e817f7fd-f1ca-4e0a-b87a-3e7d2432c649", + "X-Ms-Correlation-Request-Id" : "563d0c82-70c1-4edc-b907-03f2bd3973bd", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifest\":{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"architecture\":\"mips64le\",\"os\":\"linux\"},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"architecture\":\"s390x\",\"os\":\"linux\"},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"architecture\":\"amd64\",\"os\":\"windows\"}]}}\n", @@ -116,20 +116,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "740c7d4f-ed1b-4f05-9f31-b554d6b2dd15", + "x-ms-client-request-id" : "d2e87453-353d-43e1-b4e2-6c4223b307fe", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "4292867b-1c0e-4630-a6b6-0f94bd2ddc8e", + "X-Ms-Correlation-Request-Id" : "52b4ab97-97c6-4c8f-81a5-820201dd2fb7", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.383333", + "x-ms-ratelimit-remaining-calls-per-second" : "159.566667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:50 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -138,20 +138,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "69c8e01b-b34b-4175-8e67-75897ba2b30d", + "x-ms-client-request-id" : "6fe34006-e88a-4e64-8161-aafa60c91e31", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "8dae9b2d-5e65-447c-960a-fba2201c8cc1", + "X-Ms-Correlation-Request-Id" : "122137c9-2ecc-46d8-be8a-5cf26230c659", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.216667", + "x-ms-ratelimit-remaining-calls-per-second" : "159.8", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:50 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -160,7 +160,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "94e16fce-e807-460f-851a-e4862331602d" + "x-ms-client-request-id" : "ac114f41-6bc8-43c8-a8dd-97f4f45c4a83" }, "Response" : { "content-length" : "404", @@ -169,9 +169,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:50 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "c78dad0c-d10b-4a9a-81ca-bec83458f164", + "X-Ms-Correlation-Request-Id" : "d375e85e-7429-4732-98e5-4ea4be9ab7b4", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -183,20 +183,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "5835087f-99f2-4180-8c76-88b17befa37a", + "x-ms-client-request-id" : "ef021de7-5ca3-42ba-9e1e-091c006a72c5", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "842e2a27-f9b5-4bf2-9ee3-d32a795bf494", + "X-Ms-Correlation-Request-Id" : "97606f80-4d5d-4f3a-8c3c-3954b9385798", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.2", + "x-ms-ratelimit-remaining-calls-per-second" : "163.3", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:51 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -205,7 +205,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "634e10a3-6b30-40c1-a94a-29bde6c0b7b5" + "x-ms-client-request-id" : "19559574-2b04-41a6-af60-fca94af0fe5c" }, "Response" : { "content-length" : "1611", @@ -214,9 +214,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:51 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "2d77b0f5-b745-45cc-a266-0eb29559f321", + "X-Ms-Correlation-Request-Id" : "d018d3af-56b5-40cf-a367-01e0aac87871", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifest\":{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"architecture\":\"mips64le\",\"os\":\"linux\"},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"architecture\":\"s390x\",\"os\":\"linux\"},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"architecture\":\"amd64\",\"os\":\"windows\"}]}}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.getPropertiesWithResponse[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.getPropertiesWithResponse[1].json index 05cc61858ed4..6bce68caa20c 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.getPropertiesWithResponse[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.getPropertiesWithResponse[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "4695d220-0abd-4ba6-908a-e809272363ba", + "x-ms-client-request-id" : "c76197d7-abae-4c64-8c0d-a189e19096f1", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "8ed3e737-7ce1-411c-9b84-b2b64867cfdc", + "X-Ms-Correlation-Request-Id" : "634e9546-b526-4f41-b5a5-85b7bb02fa24", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.45", + "x-ms-ratelimit-remaining-calls-per-second" : "165.983333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "dd7f6714-fd17-46b1-9b6a-b33c3b80bb71", + "x-ms-client-request-id" : "9b126f14-bd09-43af-bbbb-0a841d1071c4", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "6d7e62d5-00dc-4602-9f8d-202e15bbaa8c", + "X-Ms-Correlation-Request-Id" : "69600ef9-7683-48d8-83df-528345edcabc", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.6", + "x-ms-ratelimit-remaining-calls-per-second" : "166.616667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "47bae558-2118-41b6-8ef8-c9ecc536bcd6" + "x-ms-client-request-id" : "99c6416e-3dc8-4f20-864c-746e816bdcae" }, "Response" : { "content-length" : "339", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "b18042a1-3011-4beb-9e48-e86082d4813f", + "X-Ms-Correlation-Request-Id" : "f5ce06af-1f7b-452a-8577-ee37fef2bbff", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"createdTime\":\"2021-05-11T23:47:44.9315937Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.4432439Z\",\"manifestCount\":12,\"tagCount\":5,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"teleportEnabled\":false}}\n", @@ -71,20 +71,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "e4cb7489-f7fe-421e-bafb-01737ad37078", + "x-ms-client-request-id" : "cecfeaca-ebf3-457c-a468-2ff207069935", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "ca635cb5-c039-4636-9973-cd8f5f207f38", + "X-Ms-Correlation-Request-Id" : "889ace34-6077-458f-8368-04396b7e7aac", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.6", + "x-ms-ratelimit-remaining-calls-per-second" : "165.266667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -93,7 +93,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f93c7f40-d67c-4e90-ba22-db37dcd5a257" + "x-ms-client-request-id" : "c1bec540-7e85-4cb3-8f9c-8105c156717c" }, "Response" : { "content-length" : "339", @@ -102,9 +102,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "5dc118e5-6560-430f-9998-c208aafb6475", + "X-Ms-Correlation-Request-Id" : "68352bf8-d072-4cb5-8d46-71133f5d8854", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"createdTime\":\"2021-05-11T23:47:44.9315937Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.4432439Z\",\"manifestCount\":12,\"tagCount\":5,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"teleportEnabled\":false}}\n", @@ -116,20 +116,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f72af339-dbe8-4b0c-9c7c-70fc52ca3ee2", + "x-ms-client-request-id" : "7e9b92dd-c605-4fde-a55f-87dd8d1465cc", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "7260b8c4-0685-4d32-b5fe-cb136869e918", + "X-Ms-Correlation-Request-Id" : "ee572ace-bc98-4c80-bd9a-f5cd14a67353", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.566667", + "x-ms-ratelimit-remaining-calls-per-second" : "165.25", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -138,20 +138,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "697ec23a-c68a-410e-86c7-ab9147dba2ee", + "x-ms-client-request-id" : "4bee6720-a938-4ef0-b846-c016554acd42", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "11c154e5-c5cd-424a-afa6-ae13d809c677", + "X-Ms-Correlation-Request-Id" : "79e0615d-4c05-44c0-8c1b-69c739cc81d4", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.533333", + "x-ms-ratelimit-remaining-calls-per-second" : "165.2", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -160,7 +160,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "621c7a63-7043-4071-97e6-f102b33717cc" + "x-ms-client-request-id" : "016d633d-7fb4-41b7-8220-a5b295db3d79" }, "Response" : { "content-length" : "339", @@ -169,9 +169,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "41f03d59-f7dc-4dd8-99b2-84be833e0255", + "X-Ms-Correlation-Request-Id" : "73665a64-ef12-4e8b-a06a-1a68b0d26905", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"createdTime\":\"2021-05-11T23:47:44.9315937Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.4432439Z\",\"manifestCount\":12,\"tagCount\":5,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"teleportEnabled\":false}}\n", @@ -183,20 +183,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "7c9c14fb-1571-4bde-a376-7802f961279c", + "x-ms-client-request-id" : "af49b32c-7a5e-434f-b95a-5da3091f5b02", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "26163cee-482c-407f-8d69-cc79c6012bbd", + "X-Ms-Correlation-Request-Id" : "7818c0d4-ac4c-430f-adb1-fb4f59f49128", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.55", + "x-ms-ratelimit-remaining-calls-per-second" : "164.65", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -205,7 +205,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "5415cb83-e586-4fed-a4bd-20d17e3274b8" + "x-ms-client-request-id" : "9c5a0682-4ebb-4e31-b664-9d29c5bb2594" }, "Response" : { "content-length" : "339", @@ -214,9 +214,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "b18f9541-1013-4fa3-a4c4-b5463e3b3c6e", + "X-Ms-Correlation-Request-Id" : "a50a2250-34ce-4395-a6e2-1f1f00d765d8", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"createdTime\":\"2021-05-11T23:47:44.9315937Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.4432439Z\",\"manifestCount\":12,\"tagCount\":5,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"teleportEnabled\":false}}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.getUnknownRepositoryPropertiesWithResponse[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.getUnknownRepositoryPropertiesWithResponse[1].json index f41e64e753dc..b95117a02ade 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.getUnknownRepositoryPropertiesWithResponse[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.getUnknownRepositoryPropertiesWithResponse[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "db0a22ef-dd1a-42fc-b548-19ba888d8ab1", + "x-ms-client-request-id" : "58548c92-a51a-4bd9-9244-df65b4732b1e", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "f4f09470-e997-49bb-b0f4-e2c041124f68", + "X-Ms-Correlation-Request-Id" : "f9bd604c-3ec0-4c50-9485-9a3942e03a31", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.483333", + "x-ms-ratelimit-remaining-calls-per-second" : "162.666667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:49 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "3d161ad0-f03c-421b-879d-e3be5f5f2007", + "x-ms-client-request-id" : "3c786234-7ba6-454e-91aa-7a5ad6db14cf", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "47a96cdd-cb28-4489-a4ec-54d51b2596e7", + "X-Ms-Correlation-Request-Id" : "6e01a24b-d616-474d-89f5-f62fefb14fed", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.4", + "x-ms-ratelimit-remaining-calls-per-second" : "160.083333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:49 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/unknowntag", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "0cdfad86-f2ab-4a14-83c6-5a9304b1c52b" + "x-ms-client-request-id" : "19174aec-c297-43d5-9602-d95db6985c2c" }, "Response" : { "content-length" : "88", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:49 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "a74a90e2-cf77-425e-9b7f-76daa731cd22", + "X-Ms-Correlation-Request-Id" : "3acd1d8a-c2ed-45be-adf7-2b8c37ddc3b2", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"errors\":[{\"code\":\"NAME_UNKNOWN\",\"message\":\"repository \\\"unknowntag\\\" is not found\"}]}\n", @@ -71,20 +71,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "69afc80b-55ea-4bcb-8610-4b654f59f087", + "x-ms-client-request-id" : "082f7160-be4a-4ddc-928a-70e1531098d6", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "28620086-2510-4e76-86a1-a471d2da31c5", + "X-Ms-Correlation-Request-Id" : "eae46c56-8199-4015-8a6e-12dfa5019898", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.233333", + "x-ms-ratelimit-remaining-calls-per-second" : "161.883333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:49 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -93,7 +93,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/unknowntag", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "596b3fca-fb88-46bb-9cd9-8be4cdf9c70d" + "x-ms-client-request-id" : "2fee9ba9-755f-4d9d-b598-52aff1bed3e1" }, "Response" : { "content-length" : "88", @@ -102,9 +102,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:49 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "1586a5c0-7726-4044-b236-4cd26bba76eb", + "X-Ms-Correlation-Request-Id" : "16c84af6-1e72-4eb1-afd1-65cbd5d604fe", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"errors\":[{\"code\":\"NAME_UNKNOWN\",\"message\":\"repository \\\"unknowntag\\\" is not found\"}]}\n", @@ -116,20 +116,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f2144b61-f88e-4a6f-adce-086aa9537b00", + "x-ms-client-request-id" : "05a24008-4ac3-4ef3-baa1-c4f65c0c7e7e", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "632da65f-9b68-444c-ad1d-981a7cea1910", + "X-Ms-Correlation-Request-Id" : "229c7e58-1aba-4d38-b757-35e7e1d0e513", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.466667", + "x-ms-ratelimit-remaining-calls-per-second" : "163.1", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:50 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -138,20 +138,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "8ab4a906-bfdb-412d-be14-30e681cbaa5c", + "x-ms-client-request-id" : "ba3ef81c-d343-447a-ab4b-38f3d6e773ec", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "90e18846-df8b-4792-950b-2a67c2e049d6", + "X-Ms-Correlation-Request-Id" : "a957c169-5537-44ca-922c-ed4cb671e86a", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.366667", + "x-ms-ratelimit-remaining-calls-per-second" : "162.633333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:50 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -160,7 +160,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/unknowntag", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d0f25daa-2017-452a-89ba-e4119fcf4467" + "x-ms-client-request-id" : "cd2b4238-1513-4549-b06f-f136de58731c" }, "Response" : { "content-length" : "88", @@ -169,43 +169,21 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:50 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "90399444-e5ad-4a0a-a93c-b826d919af41", + "X-Ms-Correlation-Request-Id" : "b7230515-369a-46d9-9b30-97f1fab5a3df", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"errors\":[{\"code\":\"NAME_UNKNOWN\",\"message\":\"repository \\\"unknowntag\\\" is not found\"}]}\n", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token", - "Headers" : { - "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "ec121230-af1b-4746-9c60-fb09c4166f87", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "c8e8cb36-b827-4d3a-bfd4-7c053c7794a5", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.45", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null }, { "Method" : "GET", "Uri" : "https://REDACTED.azurecr.io/acr/v1/unknowntag", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "2ff4b8d1-668f-42dd-b09a-ab574674174b" + "x-ms-client-request-id" : "ee9583c6-4c23-420d-a098-ea1f56c61b48" }, "Response" : { "content-length" : "88", @@ -214,9 +192,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:50 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "da454dc9-7223-4fb3-8e59-ea9d86e75eae", + "X-Ms-Correlation-Request-Id" : "3acd1d8a-c2ed-45be-adf7-2b8c37ddc3b2", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"errors\":[{\"code\":\"NAME_UNKNOWN\",\"message\":\"repository \\\"unknowntag\\\" is not found\"}]}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifactsWithPageSizeAndOrderBy[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifactsWithPageSizeAndOrderBy[1].json index 89f016ca05be..bdb0e1f210b7 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifactsWithPageSizeAndOrderBy[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifactsWithPageSizeAndOrderBy[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "32dc639a-1cf1-4ad9-9ef1-646196214487", + "x-ms-client-request-id" : "55a27701-6834-49e9-8b2f-7898be510afe", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "4189d0be-f3a3-459f-96fd-6923797988d4", + "X-Ms-Correlation-Request-Id" : "47b86922-4f5d-4945-953b-87d2230b7470", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.916667", + "x-ms-ratelimit-remaining-calls-per-second" : "163.583333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "fbe743bd-919b-4560-bb60-e59145001c98", + "x-ms-client-request-id" : "3afb6316-d933-4660-9d14-74ecec79bbc1", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "8d2427f4-3abd-44bf-882b-a50cb183f11c", + "X-Ms-Correlation-Request-Id" : "8046d8b5-5b01-4aa0-b855-76cbf9aacf87", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.083333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.1", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "3d57e6f8-375e-4de1-963e-f15bf497a963" + "x-ms-client-request-id" : "37c7e78c-ebad-4070-9f25-61992884f1a2" }, "Response" : { "content-length" : "924", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "82e8d399-c3b4-455b-bc0e-a2f5e2fa8f33", + "X-Ms-Correlation-Request-Id" : "50364ee2-d807-4870-93d1-26cf690db2ad", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:f2266cbfc127c960fd30e76b7c792dc23b588c0db76233517e1891a4e357d519\",\"imageSize\":5325,\"createdTime\":\"2021-05-11T23:47:45.0311086Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.0311086Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.6813875Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.6813875Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -72,20 +72,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "71d673f6-41b2-4dbb-81bd-07022d6483cf", + "x-ms-client-request-id" : "549546a3-d474-4dd0-bbfd-560f575b8fae", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "f9e5fe7b-e0f4-4eca-94b6-e7264dd5a67b", + "X-Ms-Correlation-Request-Id" : "90abdf4c-b81d-4653-bce0-3d29a3b60cce", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.7", + "x-ms-ratelimit-remaining-calls-per-second" : "161.933333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -94,7 +94,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736656813875%26sha256%3Ae5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "6ef8352c-e095-4b97-8a1b-63a96119bc1b" + "x-ms-client-request-id" : "c596890d-2db3-4e0f-bf38-51b2f2c9e419" }, "Response" : { "content-length" : "954", @@ -103,9 +103,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "1826223a-2ec6-4b3e-8d5f-e51d09cc5fc8", + "X-Ms-Correlation-Request-Id" : "46860d01-a727-48f1-b517-d21a534dbc77", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.987848Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.987848Z\",\"architecture\":\"amd64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.0395297Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.0395297Z\",\"architecture\":\"arm64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -118,20 +118,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "4d439663-67f2-463e-907f-3150d4661a28", + "x-ms-client-request-id" : "b1ef1a80-aca5-41ca-84f9-c416a6608d05", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "33cee9e6-3221-4202-87b2-381a49a78c1a", + "X-Ms-Correlation-Request-Id" : "2981253d-3842-421e-9b03-df39ff291702", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.383333", + "x-ms-ratelimit-remaining-calls-per-second" : "160.216667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -140,7 +140,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736660395297%26sha256%3A963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "1deeade1-43fb-48c2-bd40-4a422b5029c0" + "x-ms-client-request-id" : "73dc4b6f-c3eb-41d4-beea-26f1eb984e55" }, "Response" : { "content-length" : "948", @@ -149,9 +149,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "20d0737d-f73c-4b51-8c1a-3d38fc239bd6", + "X-Ms-Correlation-Request-Id" : "21e084f4-62a2-412e-b162-83465d6ed59b", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.20562Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.20562Z\",\"architecture\":\"386\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.2891598Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.2891598Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -164,20 +164,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "1ecc903e-735a-4eba-8258-01e62e85ea42", + "x-ms-client-request-id" : "5b1e8dc4-fb2e-4576-b063-cba231ce8f00", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "8ab238aa-07fd-409c-95d7-f49728ea9b3b", + "X-Ms-Correlation-Request-Id" : "a08c35c9-c52f-48ab-b358-097f6e527d36", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.883333", + "x-ms-ratelimit-remaining-calls-per-second" : "160.916667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -186,7 +186,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736662891598%26sha256%3A50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "5a9f865a-541b-4dec-8039-dc73e245003f" + "x-ms-client-request-id" : "36dae92f-7b0a-4c4b-8b3d-8136c3b917e7" }, "Response" : { "content-length" : "959", @@ -195,9 +195,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "d7e711ca-9613-41b5-ae14-8f28d68ab9ec", + "X-Ms-Correlation-Request-Id" : "c2eb6a9e-3acb-45e4-9e0e-fc3ac0cacaa9", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5202078Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5202078Z\",\"architecture\":\"mips64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5811927Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5811927Z\",\"architecture\":\"s390x\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -210,20 +210,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "3f2ce123-a96f-42db-b0c8-8360c9da408e", + "x-ms-client-request-id" : "85075c57-778a-48a9-b6d8-add7c1ac0c1d", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "c305e252-2090-4dd2-b3e3-f385cc515266", + "X-Ms-Correlation-Request-Id" : "787c1763-a760-4b17-b75a-8379ed162e79", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.266667", + "x-ms-ratelimit-remaining-calls-per-second" : "162.8", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -232,7 +232,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736665811927%26sha256%3Ae49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f6c06b56-9498-4448-a534-791c605ae028" + "x-ms-client-request-id" : "1eddd5a6-c9f8-4945-a1f6-a30d918c688e" }, "Response" : { "content-length" : "961", @@ -241,9 +241,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "b7756f0e-a941-4629-a1da-cd55f42bc18d", + "X-Ms-Correlation-Request-Id" : "882e6625-3927-43d0-839d-9c3ca217e2a9", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:ea0cfb27fd41ea0405d3095880c1efa45710f5bcdddb7d7d5a7317ad4825ae14\",\"imageSize\":1125,\"createdTime\":\"2021-05-11T23:47:47.7915157Z\",\"lastUpdateTime\":\"2021-05-11T23:47:47.7915157Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:48.0163617Z\",\"lastUpdateTime\":\"2021-05-11T23:47:48.0163617Z\",\"architecture\":\"ppc64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -256,20 +256,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "1afc762d-61c5-4359-9dd7-84ea6841c260", + "x-ms-client-request-id" : "827cc463-7fe0-4465-a985-82e5d3222d4b", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "c3c204e8-e02e-48e1-94a8-a202043e9a3a", + "X-Ms-Correlation-Request-Id" : "acfcd6e6-afbb-442e-a76d-d1a3168f8e15", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.85", + "x-ms-ratelimit-remaining-calls-per-second" : "160.183333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -278,7 +278,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736680163617%26sha256%3Abb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "e5b03449-86ad-4d92-adea-eb91e3b68573" + "x-ms-client-request-id" : "0339f7e4-190a-497e-b620-c1a15268bff0" }, "Response" : { "content-length" : "940", @@ -287,9 +287,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "fb531e51-9b84-46fb-ba96-fd417da2edb1", + "X-Ms-Correlation-Request-Id" : "baa523a4-b6da-4f16-918b-809e9f66bc26", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"imageSize\":1125,\"createdTime\":\"2021-05-17T22:28:15.2899657Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.2899657Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -301,20 +301,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "8e91c8f6-a71a-49f2-8ecb-c6dc42fca34d", + "x-ms-client-request-id" : "16c70017-799e-4edc-939d-073b46826d62", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "6cbde385-f603-411a-a085-6f6315e5a01c", + "X-Ms-Correlation-Request-Id" : "ad4f41cd-73c1-4183-9053-4f29f29d8d78", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.216667", + "x-ms-ratelimit-remaining-calls-per-second" : "159.85", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -323,20 +323,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "37950a5b-e922-40a4-bdda-69f97d1afddc", + "x-ms-client-request-id" : "9f8f85c8-bfd3-4983-92ff-22735fa6b42e", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "623c0dd5-0c01-4328-aaf2-8276174a890e", + "X-Ms-Correlation-Request-Id" : "46f2bbf6-6ce5-4fd4-8859-b64b0623a790", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.966667", + "x-ms-ratelimit-remaining-calls-per-second" : "160.15", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -345,7 +345,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "1b038c9a-0766-4e8a-95da-5b3c5dbb8f2b" + "x-ms-client-request-id" : "d5796e63-4849-48a7-901c-4fadf1e8f59b" }, "Response" : { "content-length" : "924", @@ -354,9 +354,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "955004df-d09d-4e88-8f66-938323e5529f", + "X-Ms-Correlation-Request-Id" : "f4f0349e-7e04-41ca-a868-0404cb8b38f5", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:f2266cbfc127c960fd30e76b7c792dc23b588c0db76233517e1891a4e357d519\",\"imageSize\":5325,\"createdTime\":\"2021-05-11T23:47:45.0311086Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.0311086Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.6813875Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.6813875Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -369,20 +369,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "2e95c20e-ec61-4273-bcb8-954e39786058", + "x-ms-client-request-id" : "0caa0303-0fc5-45e5-a609-9c17155e24fa", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "8c5aff6d-cc84-4990-97ab-420c3e17a06d", + "X-Ms-Correlation-Request-Id" : "8abf8574-e1dc-48a7-8e84-f8c9090651a5", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.483333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.6", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -391,7 +391,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736656813875%26sha256%3Ae5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "1307434d-2a7e-4ef1-ae96-b0a1c4f63a9f" + "x-ms-client-request-id" : "e1c11b45-a924-4453-8db7-abc2dbbd3f00" }, "Response" : { "content-length" : "954", @@ -400,9 +400,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "369d2c5b-881b-40e8-8736-7d0ead2f6c03", + "X-Ms-Correlation-Request-Id" : "14a49b9a-1b0a-4f9e-af96-d3a38e448579", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.987848Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.987848Z\",\"architecture\":\"amd64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.0395297Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.0395297Z\",\"architecture\":\"arm64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -415,20 +415,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "2a607d44-9a3f-4a44-8c21-98377f2ea56a", + "x-ms-client-request-id" : "b8868a38-2ebe-40bd-b7f6-7075086dac1c", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "48d7c502-d12c-4270-9b3a-933dbf663461", + "X-Ms-Correlation-Request-Id" : "c29196ed-0776-4288-b39e-bdf19f5a6795", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.316667", + "x-ms-ratelimit-remaining-calls-per-second" : "160.133333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -437,7 +437,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736660395297%26sha256%3A963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "93a57d96-7255-43aa-a47a-37907e672cc8" + "x-ms-client-request-id" : "13079245-051f-4015-a4dd-50cac498d2a4" }, "Response" : { "content-length" : "948", @@ -446,9 +446,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "ddf50a6f-8b77-42b4-a86e-3fab0aaa72b0", + "X-Ms-Correlation-Request-Id" : "0db8d144-a2b6-49c1-b644-a5817cea823c", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.20562Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.20562Z\",\"architecture\":\"386\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.2891598Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.2891598Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -461,20 +461,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "63026906-049c-4d33-8fd5-e167548facd2", + "x-ms-client-request-id" : "f72f7aa5-5ff2-4c97-b6f2-dfde199f7ccc", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "716313aa-5160-4ac8-8786-133aa750f9dc", + "X-Ms-Correlation-Request-Id" : "f2f62cf9-1ba6-419e-b855-8e0a68220f6b", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.3", + "x-ms-ratelimit-remaining-calls-per-second" : "163.15", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -483,7 +483,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736662891598%26sha256%3A50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "a3723126-5d2f-48e7-9944-3e59473d07ff" + "x-ms-client-request-id" : "285354da-6d31-40cd-acad-4b68ff56a2d8" }, "Response" : { "content-length" : "959", @@ -492,9 +492,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "efc461cd-18e0-44b8-979d-b1442b121f41", + "X-Ms-Correlation-Request-Id" : "03ce9e13-05b4-4f48-9864-021dfe4165f0", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5202078Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5202078Z\",\"architecture\":\"mips64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5811927Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5811927Z\",\"architecture\":\"s390x\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -507,20 +507,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "48811664-6585-46b2-ad3b-bea318a0c48e", + "x-ms-client-request-id" : "085d4082-1cbf-4a57-b56c-dc8f5c3cd310", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "800e0c18-7846-41bb-abd3-366d722a9d20", + "X-Ms-Correlation-Request-Id" : "21d29739-b087-45c3-8957-4c2b9d2f5744", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.45", + "x-ms-ratelimit-remaining-calls-per-second" : "163.35", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -529,7 +529,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736665811927%26sha256%3Ae49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "b6d5ca4a-c22c-4b44-bc5b-69832ba4e56c" + "x-ms-client-request-id" : "a09ee1b9-53d3-451b-bad4-8a1f76b5027d" }, "Response" : { "content-length" : "961", @@ -538,9 +538,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "bdfcb573-9ea3-48e0-b27b-41222b096673", + "X-Ms-Correlation-Request-Id" : "621b4ff8-6e0c-41eb-9835-7f75ca6fa866", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:ea0cfb27fd41ea0405d3095880c1efa45710f5bcdddb7d7d5a7317ad4825ae14\",\"imageSize\":1125,\"createdTime\":\"2021-05-11T23:47:47.7915157Z\",\"lastUpdateTime\":\"2021-05-11T23:47:47.7915157Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:48.0163617Z\",\"lastUpdateTime\":\"2021-05-11T23:47:48.0163617Z\",\"architecture\":\"ppc64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -553,20 +553,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f26a16ff-80a6-49fd-b963-032784d6f021", + "x-ms-client-request-id" : "c9ca49a6-4496-4d7e-8746-e6ded4b6fa92", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "0c92edc9-2653-4a7a-b0e1-6ce7ca1ffb10", + "X-Ms-Correlation-Request-Id" : "096004d6-ad39-4127-a526-3bc6d8c32608", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.633333", + "x-ms-ratelimit-remaining-calls-per-second" : "162.733333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -575,7 +575,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736680163617%26sha256%3Abb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "faedb6c1-2783-4160-91af-8aa63bc94196" + "x-ms-client-request-id" : "29c2f48a-74f8-4e5f-90d0-f5979b95628e" }, "Response" : { "content-length" : "940", @@ -584,9 +584,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "048989a8-7ebe-4e39-bfa4-03c69d50faac", + "X-Ms-Correlation-Request-Id" : "fe0e2a44-61ec-42dd-8343-e321688dd921", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"imageSize\":1125,\"createdTime\":\"2021-05-17T22:28:15.2899657Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.2899657Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -598,20 +598,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "1560be8d-42d2-4218-83d4-35ddbac409fc", + "x-ms-client-request-id" : "7a50d14b-e4d0-4ee8-a0fb-6d5e63b9c795", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "4726cc5a-4a63-48f4-8995-048c7de207f9", + "X-Ms-Correlation-Request-Id" : "e9944ce7-8447-434a-9347-16a73833093f", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.933333", + "x-ms-ratelimit-remaining-calls-per-second" : "159.583333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -620,7 +620,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "fd8d202d-9ce0-4df0-8b93-30d12437ac0f" + "x-ms-client-request-id" : "12d8d4c5-1cb4-46eb-9682-aad2d26f6326" }, "Response" : { "content-length" : "924", @@ -629,9 +629,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "a5ab8f7e-8deb-479f-9cce-d671d8cbee78", + "X-Ms-Correlation-Request-Id" : "d3039d78-17b6-45f4-bd36-9227247ac064", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:f2266cbfc127c960fd30e76b7c792dc23b588c0db76233517e1891a4e357d519\",\"imageSize\":5325,\"createdTime\":\"2021-05-11T23:47:45.0311086Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.0311086Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.6813875Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.6813875Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -644,20 +644,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "67f5fa8e-5dcf-496b-87a1-61c418c1bd63", + "x-ms-client-request-id" : "64762bf9-8acc-48cf-9935-f5c0ea4f5418", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "99bad91d-3768-4319-b26d-82fb2011c302", + "X-Ms-Correlation-Request-Id" : "21d956ea-4f78-4c30-bed8-96d4c96c0c4b", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.1", + "x-ms-ratelimit-remaining-calls-per-second" : "159.833333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -666,7 +666,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736656813875%26sha256%3Ae5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "46f23241-4c55-4dbb-88d8-b2b034e03999" + "x-ms-client-request-id" : "2e63f434-e450-4999-87cc-557dabbd5743" }, "Response" : { "content-length" : "954", @@ -675,9 +675,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "7decc94e-dbbb-45fa-80f1-6a4885539143", + "X-Ms-Correlation-Request-Id" : "cd243642-6d60-4027-b443-daa5b3929bf7", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.987848Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.987848Z\",\"architecture\":\"amd64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.0395297Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.0395297Z\",\"architecture\":\"arm64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -690,20 +690,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f7076a8e-25cb-4ea9-94dd-6cce9470ff5d", + "x-ms-client-request-id" : "cf704324-a810-48eb-9d22-565f2ebfa466", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "d7c3ebc9-77a2-4f90-957c-4de4d72509e3", + "X-Ms-Correlation-Request-Id" : "d7766b69-108d-451e-8206-61a0567740f8", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.416667", + "x-ms-ratelimit-remaining-calls-per-second" : "163.333333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:46 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -712,7 +712,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736660395297%26sha256%3A963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "ded38b53-ca05-4740-b29c-653944f6cfa0" + "x-ms-client-request-id" : "36c56ea0-db36-4a61-89b3-8761bcf2d8cd" }, "Response" : { "content-length" : "948", @@ -721,9 +721,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:47 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "adbb5e08-b468-4cb9-90f6-f2ad3e4d1fef", + "X-Ms-Correlation-Request-Id" : "c4fb13fb-3e6f-422c-96ea-df67ea516fc0", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.20562Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.20562Z\",\"architecture\":\"386\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.2891598Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.2891598Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -736,20 +736,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "906ef3fd-c80c-41ec-ac01-028d9a9e3a38", + "x-ms-client-request-id" : "071d82c4-4eb5-4df2-b4b1-b53cb889373d", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "645b07e1-50c6-4d40-b9bc-2427a1515b25", + "X-Ms-Correlation-Request-Id" : "799a3e99-3d64-42c1-852c-a30f1a845f35", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.533333", + "x-ms-ratelimit-remaining-calls-per-second" : "162.7", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:47 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -758,7 +758,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736662891598%26sha256%3A50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "cf173d53-1280-4f3e-8d8b-9603522cdfa0" + "x-ms-client-request-id" : "8ef21355-8dec-42bd-adc1-df6b42c49ce4" }, "Response" : { "content-length" : "959", @@ -767,9 +767,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:47 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "37e342cb-b0b3-4c9a-b28b-5da59b62c3c9", + "X-Ms-Correlation-Request-Id" : "7f6a06db-1d24-429e-b5c4-773b15319cd2", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5202078Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5202078Z\",\"architecture\":\"mips64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5811927Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5811927Z\",\"architecture\":\"s390x\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -782,20 +782,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d8ee9c62-c8f2-4ce4-bb14-b0b90a105856", + "x-ms-client-request-id" : "7027e5be-765a-48c7-80e1-976f132849ff", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "c1bfb185-732c-4032-95e3-526ba914b243", + "X-Ms-Correlation-Request-Id" : "15e077d4-d091-447e-87cf-046967e7af74", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.4", + "x-ms-ratelimit-remaining-calls-per-second" : "159.816667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:47 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -804,7 +804,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736665811927%26sha256%3Ae49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "bbcb0670-b03d-4378-8d37-b323ac381348" + "x-ms-client-request-id" : "6ed684ad-a2a6-4bca-970f-8b3be048fb35" }, "Response" : { "content-length" : "961", @@ -813,9 +813,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:47 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "df257457-3825-40d7-ad2e-cabaa5084bf8", + "X-Ms-Correlation-Request-Id" : "e9f290e1-f816-4d0e-a187-4b6637208919", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:ea0cfb27fd41ea0405d3095880c1efa45710f5bcdddb7d7d5a7317ad4825ae14\",\"imageSize\":1125,\"createdTime\":\"2021-05-11T23:47:47.7915157Z\",\"lastUpdateTime\":\"2021-05-11T23:47:47.7915157Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:48.0163617Z\",\"lastUpdateTime\":\"2021-05-11T23:47:48.0163617Z\",\"architecture\":\"ppc64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -828,20 +828,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "83c9aa59-371a-415c-a990-6cb6849e051c", + "x-ms-client-request-id" : "92dfc954-68b9-431b-a903-3806d13aa4a7", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "e6f62bcd-3b5e-423a-9fd1-cafee9aa8849", + "X-Ms-Correlation-Request-Id" : "abaf1c6e-1b11-46a7-ba08-d6af6065de46", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.283333", + "x-ms-ratelimit-remaining-calls-per-second" : "163.316667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:47 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -850,7 +850,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=637563736680163617%26sha256%3Abb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d&n=2&orderby=timeasc", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "5c4ff937-0de2-4ea4-a636-8aa5ab403b59" + "x-ms-client-request-id" : "0c97dd19-ad7b-4301-ae88-6944b9080089" }, "Response" : { "content-length" : "940", @@ -859,9 +859,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:47 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "95a091b1-a3c3-49d0-a895-bc02a2744d94", + "X-Ms-Correlation-Request-Id" : "2279a9e7-59d5-4047-8908-9bcfdd5f73da", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"imageSize\":1125,\"createdTime\":\"2021-05-17T22:28:15.2899657Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.2899657Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifactsWithPageSizeNoOrderBy[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifactsWithPageSizeNoOrderBy[1].json index 706dc20bfd0b..dfa19958133c 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifactsWithPageSizeNoOrderBy[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifactsWithPageSizeNoOrderBy[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "0ddb1fe9-85d2-49f0-977e-ad7a67815c76", + "x-ms-client-request-id" : "3c18b023-db3f-43dc-8205-678774ed6c10", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "2a3baa65-edc5-41b0-9878-8ae74ed5c465", + "X-Ms-Correlation-Request-Id" : "55fea799-21a0-4866-bcb0-c51842036b6b", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.233333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.4", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:37 GMT", + "Date" : "Thu, 27 May 2021 17:50:31 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "02755ac1-dd71-46c6-ba6f-9184e52fc357", + "x-ms-client-request-id" : "ed362b00-58ec-4535-b022-57c136e5b3e1", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "51a47e92-71aa-42d2-8f08-840e8eb688b0", + "X-Ms-Correlation-Request-Id" : "0a709f0e-c058-489c-8215-af4fd39b2ab5", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.883333", + "x-ms-ratelimit-remaining-calls-per-second" : "163.466667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:37 GMT", + "Date" : "Thu, 27 May 2021 17:50:31 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?n=2", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "12ce84ed-7228-4009-9177-06f94d25a88b" + "x-ms-client-request-id" : "1eaf933b-f8b6-4719-9429-e829916379ae" }, "Response" : { "content-length" : "952", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:37 GMT", + "Date" : "Thu, 27 May 2021 17:50:31 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "8b03f300-add4-4490-ae07-649e40e10762", + "X-Ms-Correlation-Request-Id" : "3278009f-d580-4683-8375-892227e2eb1e", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.987848Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.987848Z\",\"architecture\":\"amd64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.2891598Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.2891598Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -72,20 +72,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "5bfd7ed8-284b-4997-9a56-5570f4b2d702", + "x-ms-client-request-id" : "27b794e4-9324-4976-b341-fca9b587f291", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "2ba127e6-2668-4272-9921-2bdb5742f43b", + "X-Ms-Correlation-Request-Id" : "2c400e25-7bf8-4cbc-8d1e-39bc2aee6af0", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.85", + "x-ms-ratelimit-remaining-calls-per-second" : "162.633333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:37 GMT", + "Date" : "Thu, 27 May 2021 17:50:31 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -94,7 +94,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3A50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "489b4254-2fb8-4b0b-a2a8-2cede0c1eb84" + "x-ms-client-request-id" : "9c5a58f5-0312-4e09-8584-d213b7ebef4b" }, "Response" : { "content-length" : "940", @@ -103,9 +103,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:37 GMT", + "Date" : "Thu, 27 May 2021 17:50:32 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "25ce2629-8de0-49af-ad50-12f33e183925", + "X-Ms-Correlation-Request-Id" : "50b737e5-d40b-4ad4-b94b-6fc8802b04aa", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"imageSize\":1125,\"createdTime\":\"2021-05-17T22:28:15.2899657Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.2899657Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -118,20 +118,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "fdc99f51-9c34-49cc-9bd2-adccfa17179c", + "x-ms-client-request-id" : "6aa07e3f-1b55-4036-978c-f2cf6dbffb90", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "4942d056-ddec-4ca9-97dc-a0a35190dfe9", + "X-Ms-Correlation-Request-Id" : "9682807c-0028-45d4-9dce-beb14857ff13", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.833333", + "x-ms-ratelimit-remaining-calls-per-second" : "163.3", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:32 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -140,7 +140,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3A7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "73f85351-3efe-4999-9cf6-bc230b4274e5" + "x-ms-client-request-id" : "ed9cbd3b-18dd-4153-811e-054907daaf32" }, "Response" : { "content-length" : "959", @@ -149,9 +149,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:32 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "63454373-44b9-4dde-9425-dde8b4dd1097", + "X-Ms-Correlation-Request-Id" : "4ff221e4-cc2e-421c-8ffa-07a0e5d4a5fd", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5202078Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5202078Z\",\"architecture\":\"mips64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.0395297Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.0395297Z\",\"architecture\":\"arm64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -164,20 +164,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "da749a3c-0020-44b0-a5b4-80269dd3db4c", + "x-ms-client-request-id" : "95b9f2c7-92bd-4d18-b182-284768690d8d", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "b490ba40-3493-429d-b339-298d22b2d43b", + "X-Ms-Correlation-Request-Id" : "872bbce4-563e-40c0-b807-90d252c42307", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.816667", + "x-ms-ratelimit-remaining-calls-per-second" : "160.95", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:32 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -186,7 +186,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3A963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "b253bf07-d840-4ed5-8a7e-184b3b681dfe" + "x-ms-client-request-id" : "3e050c54-b968-4f73-bace-1329d171d27e" }, "Response" : { "content-length" : "952", @@ -195,9 +195,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:32 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "63bce148-548d-4c01-bade-a9861ebaf288", + "X-Ms-Correlation-Request-Id" : "3bc44264-1892-4c53-bd53-a244d4f490b4", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:48.0163617Z\",\"lastUpdateTime\":\"2021-05-11T23:47:48.0163617Z\",\"architecture\":\"ppc64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.20562Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.20562Z\",\"architecture\":\"386\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -210,20 +210,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "bcf7891e-6c7b-45a6-a9ac-1784859bfcbe", + "x-ms-client-request-id" : "a6104149-161e-4c52-88f6-32b1f0fbcedf", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "bd81b83d-9824-46b5-b315-ac5623ca81c1", + "X-Ms-Correlation-Request-Id" : "ba2a7253-27ad-4fc7-b594-fdc91858cec7", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.283333", + "x-ms-ratelimit-remaining-calls-per-second" : "162.616667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:32 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -232,7 +232,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3Acb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "716f6c59-5290-4ee9-a76d-de4524ae0a57" + "x-ms-client-request-id" : "8b5a6128-35c2-4dd0-83f3-a1e45c819410" }, "Response" : { "content-length" : "954", @@ -241,9 +241,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:32 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "e50b0ee8-a4a5-4a66-a8b1-07527c3f23b8", + "X-Ms-Correlation-Request-Id" : "f3576886-4dfd-4660-b4d3-c33a1606d09a", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5811927Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5811927Z\",\"architecture\":\"s390x\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.6813875Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.6813875Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -256,20 +256,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "500b3b0f-177e-4345-aa4c-672307b78a45", + "x-ms-client-request-id" : "6dbd3136-1aac-49db-94cf-85f5ccbeac5f", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "5c405234-086b-4dae-b60a-e9e9f39d468b", + "X-Ms-Correlation-Request-Id" : "0c16f18d-b67c-472f-a3d5-f5d0753f992a", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.266667", + "x-ms-ratelimit-remaining-calls-per-second" : "160.566667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:32 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -278,7 +278,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3Ae5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "81fc0909-ce81-4b90-b2b4-fbb4b902022f" + "x-ms-client-request-id" : "9546ca6d-d1c2-44be-a85f-ef8a016dce30" }, "Response" : { "content-length" : "929", @@ -287,9 +287,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:32 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "334ac909-1f61-46aa-8fc1-89615727eac7", + "X-Ms-Correlation-Request-Id" : "9d00a2e1-39f0-4232-bd36-13e35c49ca77", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:ea0cfb27fd41ea0405d3095880c1efa45710f5bcdddb7d7d5a7317ad4825ae14\",\"imageSize\":1125,\"createdTime\":\"2021-05-11T23:47:47.7915157Z\",\"lastUpdateTime\":\"2021-05-11T23:47:47.7915157Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:f2266cbfc127c960fd30e76b7c792dc23b588c0db76233517e1891a4e357d519\",\"imageSize\":5325,\"createdTime\":\"2021-05-11T23:47:45.0311086Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.0311086Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -301,20 +301,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "73bceced-ec68-40ec-b353-6adae665bcd6", + "x-ms-client-request-id" : "0f8d8dcb-1929-4651-9670-1f74b14a3e8a", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "4fcb7f03-db84-4251-ba70-338ab8c14836", + "X-Ms-Correlation-Request-Id" : "9dc1774a-b0fe-4cb1-84ff-02327ee2ec97", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.183333", + "x-ms-ratelimit-remaining-calls-per-second" : "160.933333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:32 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -323,20 +323,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "9ce3d3c7-677e-498f-8151-3d11c1cdc4a3", + "x-ms-client-request-id" : "b115971a-2d1a-4882-a6c9-d6a59b7e7e33", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "ba5adf44-56bf-4260-88dc-1df2387c733c", + "X-Ms-Correlation-Request-Id" : "23533b11-b2fc-4819-b249-809718430ced", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.233333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.016667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:32 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -345,7 +345,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?n=2", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "c9ed9aac-71bf-4cad-a41c-6fd92b40d13a" + "x-ms-client-request-id" : "f868e99c-6360-4f2f-a92e-a9c6ce13cdd2" }, "Response" : { "content-length" : "952", @@ -354,9 +354,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:33 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "178d9ca2-ff0d-4e38-8cc1-9248bc379181", + "X-Ms-Correlation-Request-Id" : "6012b8b8-8dc9-472f-8745-e5ba8fda52fa", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.987848Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.987848Z\",\"architecture\":\"amd64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.2891598Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.2891598Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -369,20 +369,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "a69982af-7902-4f1d-ba96-38b4d19045cc", + "x-ms-client-request-id" : "4600f9c5-2347-4f6d-885f-475a6623101c", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "3d41e6b6-c3c6-467b-acc7-ff626449e74f", + "X-Ms-Correlation-Request-Id" : "94d42e27-b255-41de-8541-f5219e4999cb", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.216667", + "x-ms-ratelimit-remaining-calls-per-second" : "163.65", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:33 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -391,7 +391,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3A50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "e72a7de4-bee1-47a5-b872-b3b0a9370e47" + "x-ms-client-request-id" : "ae808c64-e439-4536-a6d3-5eb7d92da3f3" }, "Response" : { "content-length" : "940", @@ -400,9 +400,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:33 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "6306affe-7edc-41eb-8802-148a01235bb2", + "X-Ms-Correlation-Request-Id" : "65c92c10-c37e-41d9-a497-2cc423abfac3", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"imageSize\":1125,\"createdTime\":\"2021-05-17T22:28:15.2899657Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.2899657Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -415,20 +415,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "727b091c-bbe9-4dfa-82b4-d67475f31bb0", + "x-ms-client-request-id" : "c9722df4-691f-475d-83f6-d5dec6fa6c92", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "5ebd5843-77b5-4ad3-9ff9-c1287d933eaa", + "X-Ms-Correlation-Request-Id" : "62b742d4-4f4d-40d3-9c6f-5e7cf22decd6", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.2", + "x-ms-ratelimit-remaining-calls-per-second" : "163.983333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:38 GMT", + "Date" : "Thu, 27 May 2021 17:50:33 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -437,7 +437,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3A7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "788991e0-8874-454a-a89a-0004470c2122" + "x-ms-client-request-id" : "71cc699d-8ecb-418f-97b9-2b2e6a6dc225" }, "Response" : { "content-length" : "959", @@ -446,9 +446,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:39 GMT", + "Date" : "Thu, 27 May 2021 17:50:33 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "afca36ef-62ac-4905-ba6c-c4c8f6dc5502", + "X-Ms-Correlation-Request-Id" : "206bbea5-11e8-47f3-b9f3-ee53ad597473", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5202078Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5202078Z\",\"architecture\":\"mips64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.0395297Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.0395297Z\",\"architecture\":\"arm64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -461,20 +461,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d1a28ac7-f798-480a-b9bd-062dc0d6df18", + "x-ms-client-request-id" : "afe56382-aec1-4b6d-b590-e5217f3cb805", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "7aa81cad-b307-460c-bee4-b3d1c923a451", + "X-Ms-Correlation-Request-Id" : "415bb779-be43-41de-a5b8-048644b211ff", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.183333", + "x-ms-ratelimit-remaining-calls-per-second" : "163.95", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:39 GMT", + "Date" : "Thu, 27 May 2021 17:50:33 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -483,7 +483,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3A963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "483b106f-9af2-40ed-9ffe-6d880e5e42a9" + "x-ms-client-request-id" : "eeb5975f-ccaa-4295-9c90-d9f20759e60f" }, "Response" : { "content-length" : "952", @@ -492,9 +492,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:39 GMT", + "Date" : "Thu, 27 May 2021 17:50:33 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "4061e66d-7ed5-4da4-a35f-47de6d2e99d6", + "X-Ms-Correlation-Request-Id" : "07f9d62c-478f-4700-bf00-9d5c637e400c", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:48.0163617Z\",\"lastUpdateTime\":\"2021-05-11T23:47:48.0163617Z\",\"architecture\":\"ppc64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.20562Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.20562Z\",\"architecture\":\"386\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -507,20 +507,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "8406b033-7ff4-4055-9d69-1e30e2d3985d", + "x-ms-client-request-id" : "989a464a-c3e4-4b98-8d2a-0763b87e33f7", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "20489fe9-de87-4f39-945a-2b566f7931cd", + "X-Ms-Correlation-Request-Id" : "b1fb963f-b6f0-4a96-a83e-af044cb90037", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.75", + "x-ms-ratelimit-remaining-calls-per-second" : "160.683333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:39 GMT", + "Date" : "Thu, 27 May 2021 17:50:33 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -529,7 +529,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3Acb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "16c2ea94-6535-481b-907f-438f574923a3" + "x-ms-client-request-id" : "c62a1c1c-82ae-48e2-9512-4aed6d1d47b8" }, "Response" : { "content-length" : "954", @@ -538,9 +538,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:39 GMT", + "Date" : "Thu, 27 May 2021 17:50:33 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "e0f0e9b0-fa8a-4813-a99a-eb7d37b8ba68", + "X-Ms-Correlation-Request-Id" : "70a5f1e5-60ef-430f-bc0c-319bb902889c", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5811927Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5811927Z\",\"architecture\":\"s390x\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.6813875Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.6813875Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -553,20 +553,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "a43b3aa7-05ec-4ca5-8874-04fecb14a74c", + "x-ms-client-request-id" : "5b332e99-cb74-4959-9ae0-b5660f1cfa32", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "2c6b89d1-73b5-47a8-91f3-55b2dde004dc", + "X-Ms-Correlation-Request-Id" : "61b65424-720d-4f45-a219-0874fa682c8c", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.733333", + "x-ms-ratelimit-remaining-calls-per-second" : "163.9", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:39 GMT", + "Date" : "Thu, 27 May 2021 17:50:33 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -575,7 +575,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3Ae5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "61911cd8-cd17-4bad-af19-f99bffb9da98" + "x-ms-client-request-id" : "9a75bf78-7875-4872-876c-cc5034ff1c3d" }, "Response" : { "content-length" : "929", @@ -584,9 +584,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:39 GMT", + "Date" : "Thu, 27 May 2021 17:50:33 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "9ee9b8a2-07e7-4750-88c7-881302c6b220", + "X-Ms-Correlation-Request-Id" : "45faada1-efd6-47b4-9361-9a7285df973e", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:ea0cfb27fd41ea0405d3095880c1efa45710f5bcdddb7d7d5a7317ad4825ae14\",\"imageSize\":1125,\"createdTime\":\"2021-05-11T23:47:47.7915157Z\",\"lastUpdateTime\":\"2021-05-11T23:47:47.7915157Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:f2266cbfc127c960fd30e76b7c792dc23b588c0db76233517e1891a4e357d519\",\"imageSize\":5325,\"createdTime\":\"2021-05-11T23:47:45.0311086Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.0311086Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifactsWithPageSize[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifactsWithPageSize[1].json index e6a5d915daab..c5c65a7de639 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifactsWithPageSize[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifactsWithPageSize[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d5ba767b-78a0-461a-a7dd-a847e0ef561f", + "x-ms-client-request-id" : "2b9195d8-4a2b-4710-8437-a7ee9603231e", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "bbdc2cc1-bc46-4274-bf70-94c3b4dc8f4e", + "X-Ms-Correlation-Request-Id" : "a63577ee-bfb3-4e45-8444-879612433527", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.566667", + "x-ms-ratelimit-remaining-calls-per-second" : "160.5", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:50 GMT", + "Date" : "Thu, 27 May 2021 17:50:44 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "1691a27f-db01-486c-860b-fb26e395b860", + "x-ms-client-request-id" : "0a9b8cd6-557e-4f6c-950a-85755597b11e", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "f72b5f65-1c87-4bd7-91a2-2904555d9d6b", + "X-Ms-Correlation-Request-Id" : "e522c33c-6a83-4596-8434-c23a73d7e4b0", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.8", + "x-ms-ratelimit-remaining-calls-per-second" : "160.616667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:50 GMT", + "Date" : "Thu, 27 May 2021 17:50:44 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?n=2", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "19b72186-890d-4633-adb1-98a4dfd2e664" + "x-ms-client-request-id" : "5bffec23-64b8-48e3-b77a-465df29673ef" }, "Response" : { "content-length" : "952", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:50 GMT", + "Date" : "Thu, 27 May 2021 17:50:44 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "9874523c-22d3-4e75-a8d3-9fd81663b9b9", + "X-Ms-Correlation-Request-Id" : "b7b9d2ea-ee81-4054-9d78-d495e2394dd6", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.987848Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.987848Z\",\"architecture\":\"amd64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.2891598Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.2891598Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -72,20 +72,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d8ffe328-ceb3-4264-bb3b-04e807e2243e", + "x-ms-client-request-id" : "0b7740f8-c256-495e-883a-9bc223789483", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "3f1f5ea1-e1f6-460f-9ad8-430f783bbe06", + "X-Ms-Correlation-Request-Id" : "53f482ee-ef9c-40ec-8b6a-1a4129f341d2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.55", + "x-ms-ratelimit-remaining-calls-per-second" : "161.883333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:50 GMT", + "Date" : "Thu, 27 May 2021 17:50:44 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -94,7 +94,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3A50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "641925de-cc33-4dd5-80ee-7f293b3376f7" + "x-ms-client-request-id" : "cfa13f7d-9646-4feb-8fa9-a6d065845268" }, "Response" : { "content-length" : "940", @@ -103,9 +103,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:50 GMT", + "Date" : "Thu, 27 May 2021 17:50:44 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "7682ccc5-ed14-487a-80b1-1d399892f812", + "X-Ms-Correlation-Request-Id" : "b58b57c7-cb44-48c3-b825-f05a9baa2d9c", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"imageSize\":1125,\"createdTime\":\"2021-05-17T22:28:15.2899657Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.2899657Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -118,20 +118,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "c85e1848-01d1-450c-9f46-2182d6dd5744", + "x-ms-client-request-id" : "cbd2fa45-0ae8-4167-a173-2bc21e0627ba", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "7a907470-853e-41b2-885a-9970b7e3e7ab", + "X-Ms-Correlation-Request-Id" : "e22cd99f-66cf-4252-a80d-888e4a2d1ac1", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.55", + "x-ms-ratelimit-remaining-calls-per-second" : "160.766667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:50 GMT", + "Date" : "Thu, 27 May 2021 17:50:44 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -140,7 +140,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3A7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "595bdfc2-bd0b-47d5-969a-7622b40b1232" + "x-ms-client-request-id" : "8cd2cf5d-4355-4e9b-95cb-e2ebb7d78480" }, "Response" : { "content-length" : "959", @@ -149,9 +149,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:50 GMT", + "Date" : "Thu, 27 May 2021 17:50:44 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "c847b064-d673-49f2-9f85-d319cce7dfc7", + "X-Ms-Correlation-Request-Id" : "092df67b-7696-487b-8011-54ef448675cf", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5202078Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5202078Z\",\"architecture\":\"mips64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.0395297Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.0395297Z\",\"architecture\":\"arm64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -164,20 +164,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "a9912712-90dc-4ab0-9154-4d2fa30353b5", + "x-ms-client-request-id" : "19bc445c-300a-4ad0-994f-60ecc012a1f6", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "20e69aca-52fd-44ec-ac64-fc7ad7fb6053", + "X-Ms-Correlation-Request-Id" : "6dc9a16d-6848-402b-bcde-e553c3e6d4b3", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.366667", + "x-ms-ratelimit-remaining-calls-per-second" : "160.6", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:50 GMT", + "Date" : "Thu, 27 May 2021 17:50:44 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -186,7 +186,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3A963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "601d3754-a0b6-4be5-965e-cbefa970a209" + "x-ms-client-request-id" : "493db18b-547c-4b90-adbf-92cf46b5dd52" }, "Response" : { "content-length" : "952", @@ -195,9 +195,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:51 GMT", + "Date" : "Thu, 27 May 2021 17:50:44 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "743d6342-6967-42e4-96c9-e2f986ec9577", + "X-Ms-Correlation-Request-Id" : "e783bdd6-b7cd-4e8d-906f-1565897c7a28", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:48.0163617Z\",\"lastUpdateTime\":\"2021-05-11T23:47:48.0163617Z\",\"architecture\":\"ppc64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.20562Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.20562Z\",\"architecture\":\"386\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -210,20 +210,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "607a9040-ca80-4dc4-9802-46e95c8cfada", + "x-ms-client-request-id" : "461611ea-93c6-4b0d-9efa-867cc362fce2", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "a29786d9-65bf-488a-9449-73029e7b6d84", + "X-Ms-Correlation-Request-Id" : "c2fb1e99-a128-43b5-bb26-9a8b54192c73", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.783333", + "x-ms-ratelimit-remaining-calls-per-second" : "161.866667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:51 GMT", + "Date" : "Thu, 27 May 2021 17:50:44 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -232,7 +232,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3Acb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "aa5ac241-f743-4881-82d5-b841ffdc8067" + "x-ms-client-request-id" : "4f618bf8-2391-4e14-8200-8be4fd4fad5a" }, "Response" : { "content-length" : "954", @@ -241,9 +241,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:51 GMT", + "Date" : "Thu, 27 May 2021 17:50:44 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "89153c46-fbf6-40fc-b986-6bb1185651e0", + "X-Ms-Correlation-Request-Id" : "2b39f06b-fb78-4271-9a0f-795772d0b238", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5811927Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5811927Z\",\"architecture\":\"s390x\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.6813875Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.6813875Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -256,20 +256,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f246f0de-ad86-4947-af5b-3b1507ddd73f", + "x-ms-client-request-id" : "840ac2a4-862d-4513-93e3-c4c8d421accb", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "36e2dad4-0831-44f7-800d-c26592b7c885", + "X-Ms-Correlation-Request-Id" : "805fc97c-ad55-4168-a10e-5057ad3f3951", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.533333", + "x-ms-ratelimit-remaining-calls-per-second" : "160.75", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:51 GMT", + "Date" : "Thu, 27 May 2021 17:50:44 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -278,7 +278,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3Ae5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d72f75d0-763a-4c2a-81a2-16cfc883f177" + "x-ms-client-request-id" : "e2423b32-5974-4ca0-b1bf-8ccc2054741c" }, "Response" : { "content-length" : "929", @@ -287,9 +287,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:51 GMT", + "Date" : "Thu, 27 May 2021 17:50:44 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "ab648cc7-fed5-4aa5-9c50-abbd8479f072", + "X-Ms-Correlation-Request-Id" : "37df0048-2bc9-4eec-9697-c66522efe4a8", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:ea0cfb27fd41ea0405d3095880c1efa45710f5bcdddb7d7d5a7317ad4825ae14\",\"imageSize\":1125,\"createdTime\":\"2021-05-11T23:47:47.7915157Z\",\"lastUpdateTime\":\"2021-05-11T23:47:47.7915157Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:f2266cbfc127c960fd30e76b7c792dc23b588c0db76233517e1891a4e357d519\",\"imageSize\":5325,\"createdTime\":\"2021-05-11T23:47:45.0311086Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.0311086Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -301,20 +301,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "1a85da98-8cd0-4b23-9ef8-a9181de61995", + "x-ms-client-request-id" : "49b242a0-64c3-4293-af4c-108ade8ee0f0", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "c9969a80-8866-4874-b7ae-d5004971366b", + "X-Ms-Correlation-Request-Id" : "69fc415c-2661-4f77-89ea-50e7dde960ce", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.533333", + "x-ms-ratelimit-remaining-calls-per-second" : "162.116667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:51 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -323,20 +323,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "c6d435d1-8274-49f0-a7cb-35a8ed22f283", + "x-ms-client-request-id" : "b8d62215-8d3d-4da3-9770-d50a85d85958", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "e4f051e6-e018-464d-a501-152fbddc8321", + "X-Ms-Correlation-Request-Id" : "f8e2bca3-5be7-4531-8f0c-0b7cbc2b9d98", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.516667", + "x-ms-ratelimit-remaining-calls-per-second" : "161.95", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:51 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -345,7 +345,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?n=2", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "28feec5e-e011-4545-a8b7-b92755cc01d6" + "x-ms-client-request-id" : "a084bfce-4418-4fc8-af53-77209f13551e" }, "Response" : { "content-length" : "952", @@ -354,9 +354,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:51 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "96779e5a-35c5-459e-8fa0-91139d89e4db", + "X-Ms-Correlation-Request-Id" : "46ebcb8a-f9ce-4da1-9cd7-6e31eb63c82e", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.987848Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.987848Z\",\"architecture\":\"amd64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.2891598Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.2891598Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -369,20 +369,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "61e9a70d-c5ef-4eb2-afec-36ad2335179f", + "x-ms-client-request-id" : "b61aa7ff-7396-4996-8d94-1c6967cca803", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "2aca5361-def6-4649-913d-39139a88ac4f", + "X-Ms-Correlation-Request-Id" : "28613660-a579-43fb-ba0d-15034287d705", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.516667", + "x-ms-ratelimit-remaining-calls-per-second" : "160.85", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:51 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -391,7 +391,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3A50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "bc20d568-6604-47e0-aff5-c4b1994e1f26" + "x-ms-client-request-id" : "6e11f199-bb2b-4953-b6fe-9fb33316e584" }, "Response" : { "content-length" : "940", @@ -400,9 +400,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:51 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "547d1a33-d376-4bce-accd-bc8677063953", + "X-Ms-Correlation-Request-Id" : "5141c9c9-2bb2-413e-a791-963a1994c0f2", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"imageSize\":1125,\"createdTime\":\"2021-05-17T22:28:15.2899657Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.2899657Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -415,20 +415,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "a7cce0d2-1c93-4f66-9197-f0a676c1086e", + "x-ms-client-request-id" : "f8939379-5212-4a19-b68a-9268247d4fa9", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "89d6ae23-a0e0-4474-9717-d0e7d076ee37", + "X-Ms-Correlation-Request-Id" : "961c1e37-979b-4bff-9f86-802cd46751fb", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.316667", + "x-ms-ratelimit-remaining-calls-per-second" : "161.3", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:51 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -437,7 +437,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3A7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "0dfe1c46-0aea-4a55-9f3e-d4f0b8187744" + "x-ms-client-request-id" : "78d76e94-6921-4b7e-8bee-9d8a6ad9f13c" }, "Response" : { "content-length" : "959", @@ -446,9 +446,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:52 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "092e8780-09ea-4ce8-8ba8-3c6f357678d0", + "X-Ms-Correlation-Request-Id" : "8fa79ba5-f614-4d3e-9374-a710794f7a98", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5202078Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5202078Z\",\"architecture\":\"mips64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.0395297Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.0395297Z\",\"architecture\":\"arm64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -461,20 +461,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "7330ecb9-a125-4116-ac6f-e5af8c6b2099", + "x-ms-client-request-id" : "8205d0e1-a508-4cbc-8040-556c28c46cb3", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "5d481428-384a-489f-8607-d48c8597e220", + "X-Ms-Correlation-Request-Id" : "67e52ff7-2489-4b0e-91ff-67395f45cadb", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.766667", + "x-ms-ratelimit-remaining-calls-per-second" : "160.2", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:52 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -483,7 +483,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3A963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "18191f74-7d48-4f83-91c9-cbd03a2669fc" + "x-ms-client-request-id" : "a2a67fc0-aec7-43bb-b0ca-aa7f8fd6eb97" }, "Response" : { "content-length" : "952", @@ -492,9 +492,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:52 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "dee658c4-f631-42f1-8202-80fa5fe7be42", + "X-Ms-Correlation-Request-Id" : "88e9aed1-c6c2-4d95-a857-0c6b752f2318", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:48.0163617Z\",\"lastUpdateTime\":\"2021-05-11T23:47:48.0163617Z\",\"architecture\":\"ppc64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.20562Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.20562Z\",\"architecture\":\"386\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -507,20 +507,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "a7f7289c-5dbb-45fa-b3ee-2868d3e7cd33", + "x-ms-client-request-id" : "10d97630-3d3a-4ef0-aebc-9f68652acca2", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "f840736b-77df-4cfc-ade6-8379f24bb7a1", + "X-Ms-Correlation-Request-Id" : "89cd8969-a623-46f9-9463-18e66884844f", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.5", + "x-ms-ratelimit-remaining-calls-per-second" : "159.866667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:52 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -529,7 +529,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3Acb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "9b8fec3d-140c-48f5-934a-f9a35438b140" + "x-ms-client-request-id" : "5c7d4813-d104-462c-90bc-f312776add82" }, "Response" : { "content-length" : "954", @@ -538,9 +538,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:52 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "9e5c415c-53d8-4fc7-ac56-6f7862f35e55", + "X-Ms-Correlation-Request-Id" : "577bd027-852a-40d8-af34-8a61376abe16", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5811927Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5811927Z\",\"architecture\":\"s390x\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.6813875Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.6813875Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -553,20 +553,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "052ee659-78ea-40d4-a9c5-bcdafbaac0e8", + "x-ms-client-request-id" : "9e47fbc2-dc18-41b9-bcf8-2185198bdf32", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "64109e34-1010-4e5b-994f-fda733298395", + "X-Ms-Correlation-Request-Id" : "c241b0d4-1311-4b2e-868e-1ef4d4bf220e", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.5", + "x-ms-ratelimit-remaining-calls-per-second" : "159.6", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:52 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -575,7 +575,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests?last=sha256%3Ae5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9&n=2&orderby=", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "b6d91d2a-b479-4c47-9aad-fb13f2d4c37a" + "x-ms-client-request-id" : "485f0073-0830-4ded-b49e-a0b2716fd7c2" }, "Response" : { "content-length" : "929", @@ -584,9 +584,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:52 GMT", + "Date" : "Thu, 27 May 2021 17:50:45 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "02b30e1e-8726-4a88-ad61-bd66a68fd1b9", + "X-Ms-Correlation-Request-Id" : "af12019d-a0ac-43e0-8151-8b4d880b8723", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:ea0cfb27fd41ea0405d3095880c1efa45710f5bcdddb7d7d5a7317ad4825ae14\",\"imageSize\":1125,\"createdTime\":\"2021-05-11T23:47:47.7915157Z\",\"lastUpdateTime\":\"2021-05-11T23:47:47.7915157Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:f2266cbfc127c960fd30e76b7c792dc23b588c0db76233517e1891a4e357d519\",\"imageSize\":5325,\"createdTime\":\"2021-05-11T23:47:45.0311086Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.0311086Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifacts[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifacts[1].json index 1248b16b20fb..abe6b0a96aa5 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifacts[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.listArtifacts[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "46f0b415-bd1a-4f71-bb0d-e0dbede9e4e8", + "x-ms-client-request-id" : "d450f028-3edd-4c12-973f-6b7811d39b0d", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "dc33739b-e703-4489-a64f-f9f26840472d", + "X-Ms-Correlation-Request-Id" : "357a4275-8f4f-4c2f-84e4-d0b80ffa330e", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.966667", + "x-ms-ratelimit-remaining-calls-per-second" : "161.766667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:28 GMT", + "Date" : "Thu, 27 May 2021 17:50:21 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "0c1ede60-15a0-4173-8766-8c94ecb29533", + "x-ms-client-request-id" : "244d4db8-d7c8-4fd3-ad1e-7e9315c534c0", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "3f7e50cb-269b-46bb-a31e-9bab848c4596", + "X-Ms-Correlation-Request-Id" : "c0d399ab-fd4a-4401-8fa0-6cb9732e1e9b", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.016667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.183333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:28 GMT", + "Date" : "Thu, 27 May 2021 17:50:21 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "cff5a7e9-28ec-49c2-910e-ed609fa24957" + "x-ms-client-request-id" : "2cad12fc-8fe2-41ce-b2d9-551468c4f168" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:28 GMT", + "Date" : "Thu, 27 May 2021 17:50:22 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "10858a86-6a16-4f41-9f39-dcc80219843c", + "X-Ms-Correlation-Request-Id" : "c38884c1-8c7d-466d-941a-6e214b7fcac8", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.987848Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.987848Z\",\"architecture\":\"amd64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.2891598Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.2891598Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"imageSize\":1125,\"createdTime\":\"2021-05-17T22:28:15.2899657Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.2899657Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5202078Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5202078Z\",\"architecture\":\"mips64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.0395297Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.0395297Z\",\"architecture\":\"arm64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:48.0163617Z\",\"lastUpdateTime\":\"2021-05-11T23:47:48.0163617Z\",\"architecture\":\"ppc64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.20562Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.20562Z\",\"architecture\":\"386\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5811927Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5811927Z\",\"architecture\":\"s390x\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.6813875Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.6813875Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:ea0cfb27fd41ea0405d3095880c1efa45710f5bcdddb7d7d5a7317ad4825ae14\",\"imageSize\":1125,\"createdTime\":\"2021-05-11T23:47:47.7915157Z\",\"lastUpdateTime\":\"2021-05-11T23:47:47.7915157Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:f2266cbfc127c960fd30e76b7c792dc23b588c0db76233517e1891a4e357d519\",\"imageSize\":5325,\"createdTime\":\"2021-05-11T23:47:45.0311086Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.0311086Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", @@ -71,20 +71,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d14568b3-980d-4cb9-9009-ed3e5984bfe1", + "x-ms-client-request-id" : "c6e8e4c6-c93c-4fa3-b1ac-04790bcd278f", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "bb245d5a-d1df-41bf-80f0-74ea0e2d2d6b", + "X-Ms-Correlation-Request-Id" : "a9dc91dd-c87e-474d-8fa0-96209725ea03", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.6", + "x-ms-ratelimit-remaining-calls-per-second" : "162.316667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:29 GMT", + "Date" : "Thu, 27 May 2021 17:50:26 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -93,20 +93,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "bd8831fc-417c-4ee1-b2ae-8ec2dc2d60df", + "x-ms-client-request-id" : "dfb2715b-f1aa-422d-9397-b6d7b8e11197", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "a70e16b1-84ab-48ec-aba0-5f123eaf1b4a", + "X-Ms-Correlation-Request-Id" : "e92db5a4-432e-4ed4-a75c-155e2cdf0043", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.95", + "x-ms-ratelimit-remaining-calls-per-second" : "164", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:29 GMT", + "Date" : "Thu, 27 May 2021 17:50:26 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -115,7 +115,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "1fa381d6-e346-41db-b1e1-5a75148c9ff5" + "x-ms-client-request-id" : "86acf6e9-2dc4-4054-a978-ea552b994a03" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -124,9 +124,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:29 GMT", + "Date" : "Thu, 27 May 2021 17:50:26 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "bbbb3bb7-9260-4b28-8793-39075fa9fe02", + "X-Ms-Correlation-Request-Id" : "296b906c-6758-4ad6-9282-9e5d1140b28d", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifests\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.987848Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.987848Z\",\"architecture\":\"amd64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.2891598Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.2891598Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"imageSize\":1125,\"createdTime\":\"2021-05-17T22:28:15.2899657Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.2899657Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5202078Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5202078Z\",\"architecture\":\"mips64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.0395297Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.0395297Z\",\"architecture\":\"arm64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:48.0163617Z\",\"lastUpdateTime\":\"2021-05-11T23:47:48.0163617Z\",\"architecture\":\"ppc64le\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.20562Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.20562Z\",\"architecture\":\"386\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:46.5811927Z\",\"lastUpdateTime\":\"2021-05-11T23:47:46.5811927Z\",\"architecture\":\"s390x\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.6813875Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.6813875Z\",\"architecture\":\"arm\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:ea0cfb27fd41ea0405d3095880c1efa45710f5bcdddb7d7d5a7317ad4825ae14\",\"imageSize\":1125,\"createdTime\":\"2021-05-11T23:47:47.7915157Z\",\"lastUpdateTime\":\"2021-05-11T23:47:47.7915157Z\",\"architecture\":\"amd64\",\"os\":\"windows\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}},{\"digest\":\"sha256:f2266cbfc127c960fd30e76b7c792dc23b588c0db76233517e1891a4e357d519\",\"imageSize\":5325,\"createdTime\":\"2021-05-11T23:47:45.0311086Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.0311086Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineState\":\"Passed\"}}]}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.updateProperties[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.updateProperties[1].json index b1b5d53df250..3c6f8ce2b7d6 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.updateProperties[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRepositoryAsyncIntegrationTests.updateProperties[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f1b9675b-3b2a-45e8-bbf2-84e75390d2ec", + "x-ms-client-request-id" : "c072d085-201c-4efa-a881-1d2c58b4b376", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "467da17d-7d0d-4885-89c8-88dcf4603a92", + "X-Ms-Correlation-Request-Id" : "6476400b-ce85-44e5-9d2b-69574897590d", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.65", + "x-ms-ratelimit-remaining-calls-per-second" : "165.25", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "08ff3ccd-19f4-4260-b28e-04a765ffff21", + "x-ms-client-request-id" : "286c9ffa-b142-4622-8aec-a85415d5082b", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "66747c40-c7a4-45f1-977c-75c4f29ca02b", + "X-Ms-Correlation-Request-Id" : "3f871fb5-ed4a-4971-97fa-ea5b26f704a5", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.633333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.616667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:50:09 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f5c64922-aced-420f-8e83-6b4253ebb0f2", + "x-ms-client-request-id" : "31aa7eac-5f4a-400e-a9d3-e2b1c27138ce", "Content-Type" : "application/json" }, "Response" : { @@ -58,9 +58,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:10 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "067b2ea9-2c91-4744-aab4-a8f055115ba0", + "X-Ms-Correlation-Request-Id" : "31f0619e-e670-4a5c-b689-245078bd3706", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"createdTime\":\"2021-05-11T23:47:44.9315937Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.4432439Z\",\"manifestCount\":12,\"tagCount\":5,\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"teleportEnabled\":false}}\n", @@ -72,20 +72,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "cbcc4d0a-2a7c-4217-aa90-379787eff0c8", + "x-ms-client-request-id" : "5075d0dc-7003-4543-9fea-d981a5456750", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "a8a32ea4-5ded-40c5-9c76-005902a646ed", + "X-Ms-Correlation-Request-Id" : "8d3cb6fe-c5aa-4da9-8643-8e0ebe2b48c7", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.166667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.733333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:10 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -94,7 +94,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d6975dfa-67d1-440a-84ff-146c4be8bbdb", + "x-ms-client-request-id" : "99caa777-1a95-43f0-8db1-f77a7d4b41d2", "Content-Type" : "application/json" }, "Response" : { @@ -104,9 +104,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:18 GMT", + "Date" : "Thu, 27 May 2021 17:50:10 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "630690ef-1fe6-4ad6-8344-7e64f7531727", + "X-Ms-Correlation-Request-Id" : "62b5d85b-f2b1-4bd7-8574-aff0c377bd3e", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"createdTime\":\"2021-05-11T23:47:44.9315937Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.4432439Z\",\"manifestCount\":12,\"tagCount\":5,\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"teleportEnabled\":false}}\n", @@ -118,20 +118,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "777be114-7b9f-4f28-a9d2-56f1d5e1002e", + "x-ms-client-request-id" : "7cd3f3e8-771d-4e8b-8430-253871ac7c14", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "e0bf9d61-202a-411d-afb1-b63b55815b62", + "X-Ms-Correlation-Request-Id" : "1c0d9d9c-60b4-4a62-a5b4-dbd69fcf662b", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.966667", + "x-ms-ratelimit-remaining-calls-per-second" : "166.4", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:18 GMT", + "Date" : "Thu, 27 May 2021 17:50:11 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -140,20 +140,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "52a4ab78-ce2c-47b4-b637-6e868828ee5f", + "x-ms-client-request-id" : "0f8c6309-cb07-440a-b751-5237d43ec2fd", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "4686c058-73b1-43de-8c79-08384e1863f9", + "X-Ms-Correlation-Request-Id" : "f10fb486-270f-425f-8c4c-4e740bb7500e", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.883333", + "x-ms-ratelimit-remaining-calls-per-second" : "165.733333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:18 GMT", + "Date" : "Thu, 27 May 2021 17:50:11 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -162,7 +162,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "82a093a8-90bd-4e6b-9f29-f10e3dc6ee70", + "x-ms-client-request-id" : "23cabc1a-c624-4785-8df5-de4e9a0b3843", "Content-Type" : "application/json" }, "Response" : { @@ -172,9 +172,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:56 GMT", + "Date" : "Thu, 27 May 2021 17:50:11 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "de5015cd-65f3-4bcb-b08b-3cb2f614094c", + "X-Ms-Correlation-Request-Id" : "9fa8c8de-888f-4f3b-b70d-b08ca697e3d3", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"createdTime\":\"2021-05-11T23:47:44.9315937Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.4432439Z\",\"manifestCount\":12,\"tagCount\":5,\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"teleportEnabled\":false}}\n", @@ -186,20 +186,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d91f4095-b039-481a-bbfe-3ccc7e80147b", + "x-ms-client-request-id" : "920f511f-67d1-42b7-a035-f55d48818e8c", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "612d8652-4610-4670-88a1-74433f0f9c19", + "X-Ms-Correlation-Request-Id" : "bed0f06b-41ab-4350-92e5-f3ebe98efd76", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.983333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.65", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:56 GMT", + "Date" : "Thu, 27 May 2021 17:50:11 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -208,7 +208,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "e5749883-7b1b-440e-a105-3240fe1fd509", + "x-ms-client-request-id" : "f733d3fd-27d7-444b-bc56-8ac85cb1124a", "Content-Type" : "application/json" }, "Response" : { @@ -218,9 +218,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:56 GMT", + "Date" : "Thu, 27 May 2021 17:50:11 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "45db38cb-8956-44ea-b078-24b3ea6a0eaf", + "X-Ms-Correlation-Request-Id" : "27bae588-512f-4926-a906-d3d0ec8704f3", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"createdTime\":\"2021-05-11T23:47:44.9315937Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.4432439Z\",\"manifestCount\":12,\"tagCount\":5,\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"teleportEnabled\":false}}\n", @@ -232,20 +232,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "6d608a52-fbc7-41ff-8bac-b479fb3d3c94", + "x-ms-client-request-id" : "c374a994-ec70-4c40-b0d5-1f15e543b1f8", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "49493476-f0fd-4eaa-953c-fcc69a6a91c5", + "X-Ms-Correlation-Request-Id" : "ba7cf929-7352-496c-8e59-45249c355032", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.483333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.583333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:56 GMT", + "Date" : "Thu, 27 May 2021 17:50:12 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -254,20 +254,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "b54ba130-cee7-4593-937b-2e09a2594696", + "x-ms-client-request-id" : "b276f435-442e-4fab-970a-1d3f581db0b5", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "e6a95b86-863d-46ae-ba51-07ce123a86f8", + "X-Ms-Correlation-Request-Id" : "05d18ed7-f7d3-431b-b734-21ed2e13f50b", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.25", + "x-ms-ratelimit-remaining-calls-per-second" : "164.566667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:56 GMT", + "Date" : "Thu, 27 May 2021 17:50:12 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -276,7 +276,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "66968960-d446-43cf-a908-d3b6f3e90162", + "x-ms-client-request-id" : "45ca805a-7e51-460b-bbe5-5ecebccad921", "Content-Type" : "application/json" }, "Response" : { @@ -286,9 +286,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:59 GMT", + "Date" : "Thu, 27 May 2021 17:50:13 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "e71ef8eb-58fa-4296-bd2e-c61dca15a9f3", + "X-Ms-Correlation-Request-Id" : "8839e024-695f-4026-bee0-ad31b45de143", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"createdTime\":\"2021-05-11T23:47:44.9315937Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.4432439Z\",\"manifestCount\":12,\"tagCount\":5,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"teleportEnabled\":false}}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getMultiArchitectureImagePropertiesWithResponseThrows[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getMultiArchitectureImagePropertiesWithResponseThrows[1].json index be3919090ae5..9aa3112e7771 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getMultiArchitectureImagePropertiesWithResponseThrows[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getMultiArchitectureImagePropertiesWithResponseThrows[1].json @@ -4,11 +4,11 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/unknown:digest", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "894dd3be-ada0-408a-9c6c-5721db2a8125" + "x-ms-client-request-id" : "b29b18d6-35bc-498e-80dd-eb4c8066cabd" }, "Response" : { "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "a9a46887-12b3-4538-8f88-4b45609bccd4", + "X-Ms-Correlation-Request-Id" : "d9584696-c19c-407a-a717-04737b2f5f4a", "content-length" : "19", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Server" : "openresty", @@ -17,7 +17,7 @@ "retry-after" : "0", "StatusCode" : "404", "Body" : "404 page not found\n", - "Date" : "Wed, 19 May 2021 23:32:27 GMT", + "Date" : "Thu, 27 May 2021 17:50:42 GMT", "Content-Type" : "text/plain; charset=utf-8" }, "Exception" : null @@ -26,11 +26,11 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/unknown:digest", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f20411f1-468a-4d37-a31f-dbb56f94d5f1" + "x-ms-client-request-id" : "e848afe9-9739-4201-ab6f-e58645682eb8" }, "Response" : { "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "e3803975-605f-43a2-ad27-58ce86af4246", + "X-Ms-Correlation-Request-Id" : "18deec3d-d3b8-49b3-beed-17d4448ea4c9", "content-length" : "19", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Server" : "openresty", @@ -39,7 +39,7 @@ "retry-after" : "0", "StatusCode" : "404", "Body" : "404 page not found\n", - "Date" : "Wed, 19 May 2021 23:32:27 GMT", + "Date" : "Thu, 27 May 2021 17:50:42 GMT", "Content-Type" : "text/plain; charset=utf-8" }, "Exception" : null @@ -48,11 +48,11 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/unknown:digest", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "0089e161-32d7-44ba-8a3f-01470fb1356e" + "x-ms-client-request-id" : "5871fbd7-2a9c-4bd0-958d-2d3491c33faf" }, "Response" : { "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "8205f789-7f11-4825-9aa8-0adac17aacf7", + "X-Ms-Correlation-Request-Id" : "a9ddabe5-15c0-4861-975a-2c4ee8090440", "content-length" : "19", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Server" : "openresty", @@ -61,7 +61,7 @@ "retry-after" : "0", "StatusCode" : "404", "Body" : "404 page not found\n", - "Date" : "Wed, 19 May 2021 23:32:27 GMT", + "Date" : "Thu, 27 May 2021 17:50:42 GMT", "Content-Type" : "text/plain; charset=utf-8" }, "Exception" : null @@ -70,11 +70,11 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/unknown:digest", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "b7181040-fe48-4bf3-b98e-ae6da64f60e4" + "x-ms-client-request-id" : "20d558d9-61dc-40dc-8b76-f061fbb5e1a2" }, "Response" : { "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "c356c5e7-6d8b-41ba-95a0-37cc39cae983", + "X-Ms-Correlation-Request-Id" : "8e280a17-145c-4cb2-b62c-448bbc0abf55", "content-length" : "19", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Server" : "openresty", @@ -83,7 +83,7 @@ "retry-after" : "0", "StatusCode" : "404", "Body" : "404 page not found\n", - "Date" : "Wed, 19 May 2021 23:32:27 GMT", + "Date" : "Thu, 27 May 2021 17:50:42 GMT", "Content-Type" : "text/plain; charset=utf-8" }, "Exception" : null diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getMultiArchitectureImagePropertiesWithResponse[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getMultiArchitectureImagePropertiesWithResponse[1].json index f23e0fa36a62..bc712dc04f02 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getMultiArchitectureImagePropertiesWithResponse[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getMultiArchitectureImagePropertiesWithResponse[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f49069f9-bbdc-4df1-afb3-c2ab2a3847b6", + "x-ms-client-request-id" : "c54b97a8-cca3-4383-b667-2f38e060b664", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "85b944d6-d639-4e70-8c8c-1d906785c803", + "X-Ms-Correlation-Request-Id" : "310c3246-a236-4957-8117-f4d9b9981056", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.65", + "x-ms-ratelimit-remaining-calls-per-second" : "166.366667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:50:17 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "ba2fea99-149d-4756-b76a-079d3834775d", + "x-ms-client-request-id" : "1fe871ad-e611-41e1-9a1f-826a10645eab", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "be74172e-db25-461b-a635-e0997324b4e3", + "X-Ms-Correlation-Request-Id" : "91fda7a5-0e5a-4b73-8e0e-d51b7f3ceb6d", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.366667", + "x-ms-ratelimit-remaining-calls-per-second" : "165.65", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:50:17 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "9359335e-c3a2-460a-8d99-a1482faf0042" + "x-ms-client-request-id" : "39d0f569-b937-49b6-abe2-baf0fd2529c9" }, "Response" : { "content-length" : "404", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:50:17 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "76627673-4866-4bd3-ade1-49183fa946fb", + "X-Ms-Correlation-Request-Id" : "9cfb200f-b34f-47fa-8650-137cfb04ae58", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -71,20 +71,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "bf622553-42d0-42aa-9e3e-c61600d02761", + "x-ms-client-request-id" : "3ded6640-2a99-43ab-b29e-7674c3e5a865", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "63c4e11d-1da3-4118-ae92-68fb52d096e1", + "X-Ms-Correlation-Request-Id" : "06e772e9-330e-4af5-aa8a-a5e34bc6b356", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.633333", + "x-ms-ratelimit-remaining-calls-per-second" : "162.383333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:50:17 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -93,7 +93,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "efedc6d6-10a4-4971-a4c3-67663e8b1c27" + "x-ms-client-request-id" : "7ff5c25c-4aa7-42cc-a1a1-f925a3a1229a" }, "Response" : { "content-length" : "1611", @@ -102,9 +102,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:50:17 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "0f454804-e402-4506-8b66-69ef8f8d1a00", + "X-Ms-Correlation-Request-Id" : "5815fd22-a498-4922-836b-69b4f55a04d1", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifest\":{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"architecture\":\"mips64le\",\"os\":\"linux\"},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"architecture\":\"s390x\",\"os\":\"linux\"},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"architecture\":\"amd64\",\"os\":\"windows\"}]}}\n", @@ -116,20 +116,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "b850452b-d814-4979-b2d3-0c9b4103b35b", + "x-ms-client-request-id" : "d85e6678-f01f-4976-9ef6-f10fa8c3a6d9", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "ced254f1-6211-4efc-b4c7-af4b9cb1b0e8", + "X-Ms-Correlation-Request-Id" : "7c1681b9-d914-4c52-a557-879433022566", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.583333", + "x-ms-ratelimit-remaining-calls-per-second" : "162.55", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -138,20 +138,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "a00a8e81-8e91-4844-b60e-2dacce83f531", + "x-ms-client-request-id" : "f29d61c6-66a4-4ce1-b518-b27ab1a6075d", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "f13fab6c-0e4d-44c7-88c6-6fd0b3e805f1", + "X-Ms-Correlation-Request-Id" : "f6bdf52a-5c71-4f59-8843-11d4695c62c5", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.916667", + "x-ms-ratelimit-remaining-calls-per-second" : "162.933333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -160,7 +160,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "2b4e99b7-31c6-46dc-bbf5-9d03e63f1122" + "x-ms-client-request-id" : "948bbd7b-5f92-41b0-a05e-1a6a8dbc25cc" }, "Response" : { "content-length" : "1611", @@ -169,9 +169,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:18 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "47fa0ce5-2d1c-459b-a43a-e5aeb4f65273", + "X-Ms-Correlation-Request-Id" : "a53a9dd1-9501-4e3a-9e26-dc0b8d307cbe", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifest\":{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"architecture\":\"mips64le\",\"os\":\"linux\"},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"architecture\":\"s390x\",\"os\":\"linux\"},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"architecture\":\"amd64\",\"os\":\"windows\"}]}}\n", @@ -183,20 +183,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "b4f6b877-f351-4dee-926f-929c061ff9f8", + "x-ms-client-request-id" : "2ac5ef07-1ee7-4e56-953d-572e32eade8a", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "1a2b9dab-b7fb-474c-a18f-d92ad48c7aab", + "X-Ms-Correlation-Request-Id" : "5555c102-3a3c-4da4-9d2f-026750751e6a", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.35", + "x-ms-ratelimit-remaining-calls-per-second" : "164.533333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -205,20 +205,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "4273e69f-66f8-44f4-9246-7b017d4136e6", + "x-ms-client-request-id" : "15cb2197-0356-41f3-b050-43030371cf21", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "86e72f73-5f45-4466-a68c-c81efc954099", + "X-Ms-Correlation-Request-Id" : "321e3e63-20e5-4ae4-a8ad-b470b0522ef9", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.566667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.333333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -227,21 +227,21 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d82a7576-4af8-41ea-a926-2796464ebe69" + "x-ms-client-request-id" : "81dc8191-3aa2-4cde-9f0e-ef8b81676360" }, "Response" : { - "content-length" : "841", + "content-length" : "840", "Server" : "openresty", "X-Content-Type-Options" : "nosniff", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:18 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "2a09a3ac-d31b-4b61-87ed-613fdaf9abb3", + "X-Ms-Correlation-Request-Id" : "f46d8a8f-e758-444a-bad1-70baafa52894", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifest\":{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.987848Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.987848Z\",\"architecture\":\"amd64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineDetails\":\"{\\\"state\\\":\\\"Scan InProgress\\\",\\\"link\\\":\\\"https://aka.ms/test\\\",\\\"scanner\\\":\\\"Azure Security Monitoring-Qualys Scanner\\\",\\\"result\\\":{\\\"version\\\":\\\"5/19/2021 11:31:54 PM\\\",\\\"summary\\\":[{\\\"severity\\\":\\\"High\\\",\\\"count\\\":0},{\\\"severity\\\":\\\"Medium\\\",\\\"count\\\":0},{\\\"severity\\\":\\\"Low\\\",\\\"count\\\":0}]}}\",\"quarantineState\":\"Passed\"}}}\n", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifest\":{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"imageSize\":525,\"createdTime\":\"2021-05-11T23:47:45.987848Z\",\"lastUpdateTime\":\"2021-05-11T23:47:45.987848Z\",\"architecture\":\"amd64\",\"os\":\"linux\",\"mediaType\":\"application/vnd.docker.distribution.manifest.v2+json\",\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true,\"quarantineDetails\":\"{\\\"state\\\":\\\"Scan InProgress\\\",\\\"link\\\":\\\"https://aka.ms/test\\\",\\\"scanner\\\":\\\"Azure Security Monitoring-Qualys Scanner\\\",\\\"result\\\":{\\\"version\\\":\\\"5/27/2021 5:50:09 PM\\\",\\\"summary\\\":[{\\\"severity\\\":\\\"High\\\",\\\"count\\\":0},{\\\"severity\\\":\\\"Medium\\\",\\\"count\\\":0},{\\\"severity\\\":\\\"Low\\\",\\\"count\\\":0}]}}\",\"quarantineState\":\"Passed\"}}}\n", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -250,20 +250,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "4a7231ed-3832-43f7-ab25-3aad4fddf097", + "x-ms-client-request-id" : "5a09ba16-953a-40e8-9940-f9b4032dca82", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "117bf8fa-98e3-4871-a701-66af5bb8f031", + "X-Ms-Correlation-Request-Id" : "4b00fe86-f23c-4d5c-a719-26ef3e180d53", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.333333", + "x-ms-ratelimit-remaining-calls-per-second" : "162.366667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:18 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -272,7 +272,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d2fc0db0-421b-4e61-8a6d-7555e55ab8f2" + "x-ms-client-request-id" : "e5f347b2-d51b-4a59-a627-a61a8eef99ee" }, "Response" : { "content-length" : "1611", @@ -281,9 +281,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:18 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "773d911f-31e7-4c2b-a054-4c45f463f8a2", + "X-Ms-Correlation-Request-Id" : "920abff4-75a8-4fce-8575-f3973d7e50b5", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifest\":{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"architecture\":\"mips64le\",\"os\":\"linux\"},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"architecture\":\"s390x\",\"os\":\"linux\"},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"architecture\":\"amd64\",\"os\":\"windows\"}]}}\n", @@ -295,20 +295,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "8e82ac95-661d-435a-912b-8fa343b14ba0", + "x-ms-client-request-id" : "38c887fd-76e4-41d0-8834-f0cf4cada7e4", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "0866c03c-c71a-474d-ab05-2a0e9c82b94c", + "X-Ms-Correlation-Request-Id" : "f894e036-f1eb-42da-a03d-463f2035b343", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.9", + "x-ms-ratelimit-remaining-calls-per-second" : "164.433333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:13 GMT", + "Date" : "Thu, 27 May 2021 17:50:22 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -317,20 +317,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "5876ff87-9b30-4585-8515-f49d5c67786f", + "x-ms-client-request-id" : "f1ced39b-6525-4ba4-8d90-853bfeea6f88", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "a14f50e1-15ac-439e-bd5b-8e512670a038", + "X-Ms-Correlation-Request-Id" : "eb24638d-085a-46c8-adcc-47e54c00b151", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.533333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.166667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:13 GMT", + "Date" : "Thu, 27 May 2021 17:50:22 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -339,7 +339,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "573c09ea-34a2-4ef9-9538-1ad8b714c0b6" + "x-ms-client-request-id" : "af3c35a1-3ae2-4fed-b10c-45affe3aaaa9" }, "Response" : { "content-length" : "404", @@ -348,9 +348,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:13 GMT", + "Date" : "Thu, 27 May 2021 17:50:22 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "8119b477-c04f-4573-b842-8abb27be66ce", + "X-Ms-Correlation-Request-Id" : "e0b40b0e-496d-4748-b814-55cfa710d351", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -362,20 +362,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "fd62e8b3-8f8c-4da3-8f7d-dd3436ae5cea", + "x-ms-client-request-id" : "878c7005-94ea-4118-82cf-9664abe67099", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "b2780d67-8091-44b9-81cd-6a4d6613e3d5", + "X-Ms-Correlation-Request-Id" : "59287c06-202d-4c7d-99aa-27071439b270", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.516667", + "x-ms-ratelimit-remaining-calls-per-second" : "162.716667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:13 GMT", + "Date" : "Thu, 27 May 2021 17:50:22 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -384,7 +384,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "e3b10e9b-86ce-47d7-af2f-dad514309888" + "x-ms-client-request-id" : "c8d09ce1-15c5-4ae5-9468-b707b3c936dc" }, "Response" : { "content-length" : "1611", @@ -393,9 +393,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:13 GMT", + "Date" : "Thu, 27 May 2021 17:50:22 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "8dfb0d0f-8b62-4ab8-8878-d94cde4d3ec8", + "X-Ms-Correlation-Request-Id" : "b26a7685-90c8-4f3e-8338-b199a5c98d6a", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifest\":{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"architecture\":\"mips64le\",\"os\":\"linux\"},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"architecture\":\"s390x\",\"os\":\"linux\"},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"architecture\":\"amd64\",\"os\":\"windows\"}]}}\n", @@ -407,20 +407,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "77442014-e1d1-492a-9352-43a57a2f16d7", + "x-ms-client-request-id" : "45294158-8f06-49a5-9223-aa86718ee938", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "bdc5d7ef-ac47-40a3-8cc4-415e3c63d5c6", + "X-Ms-Correlation-Request-Id" : "f535fa7d-f730-4b2e-97e8-10efd495f814", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.316667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.15", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:13 GMT", + "Date" : "Thu, 27 May 2021 17:50:22 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -429,7 +429,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "89468468-1e11-42c9-8bfa-d9d99b96556c" + "x-ms-client-request-id" : "80877447-b9ee-42ec-9b69-e83be7472c66" }, "Response" : { "content-length" : "1611", @@ -438,9 +438,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:13 GMT", + "Date" : "Thu, 27 May 2021 17:50:22 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "d89ed8e3-66de-44ff-84d5-1e8c043098bd", + "X-Ms-Correlation-Request-Id" : "eb2d87cd-7863-492a-a15b-c119452f1690", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifest\":{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"architecture\":\"mips64le\",\"os\":\"linux\"},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"architecture\":\"s390x\",\"os\":\"linux\"},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"architecture\":\"amd64\",\"os\":\"windows\"}]}}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getTagPropertiesWithResponseThrows[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getTagPropertiesWithResponseThrows[1].json index 5a2ac1f521dc..c74a410d3451 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getTagPropertiesWithResponseThrows[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getTagPropertiesWithResponseThrows[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "7ef715e8-577c-46ef-bbd0-78025b17ed82", + "x-ms-client-request-id" : "9c10b1bb-0ae3-4b11-b204-df9aafeb708a", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "5eca3690-2df0-41cd-9624-4296338d192e", + "X-Ms-Correlation-Request-Id" : "7d13a2f3-cf9d-4843-a6e1-a2ae65ca5f72", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.95", + "x-ms-ratelimit-remaining-calls-per-second" : "162.583333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:50:27 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "06d5e2c9-c963-4834-9928-9176c73c196d", + "x-ms-client-request-id" : "456f4476-9005-412e-971d-fe8db2e9efe1", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "29afce99-19e8-4da6-b5b2-c9fa0af174e0", + "X-Ms-Correlation-Request-Id" : "15bbd99a-795a-4769-a1d3-adb3f35c96f8", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.616667", + "x-ms-ratelimit-remaining-calls-per-second" : "163.2", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:50:27 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/unknowntag", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "73f2bb66-4890-4178-a164-33ca89adf9d8" + "x-ms-client-request-id" : "d93d8939-633d-4584-a88d-597287d67010" }, "Response" : { "content-length" : "81", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:50:27 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "4026fa51-0740-4402-a1b7-726362b7405a", + "X-Ms-Correlation-Request-Id" : "bc0bd73f-df0a-4b41-9ddd-aba3917b99b9", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"errors\":[{\"code\":\"TAG_UNKNOWN\",\"message\":\"the specified tag does not exist\"}]}\n", @@ -71,20 +71,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "c52c880a-9350-46f7-8654-b4ee1441c414", + "x-ms-client-request-id" : "979e2b33-9afb-4260-9a0f-92ab4393214a", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "a03e4ec1-8af3-4730-ba80-a4207166d8b0", + "X-Ms-Correlation-Request-Id" : "af669816-b2c9-4db7-8b49-b603196f8363", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.616667", + "x-ms-ratelimit-remaining-calls-per-second" : "163.95", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:50:27 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -93,7 +93,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/unknowntag", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "75586cd6-1f74-4d18-8874-b156b6294ea4" + "x-ms-client-request-id" : "a499db47-3bbc-4885-bd05-8d22e959c4ad" }, "Response" : { "content-length" : "81", @@ -102,9 +102,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:32:11 GMT", + "Date" : "Thu, 27 May 2021 17:50:27 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "282c5ba2-67ba-4e0d-88f8-f08b06a68fbc", + "X-Ms-Correlation-Request-Id" : "829ae81b-5c21-4f94-9af6-bf238be64328", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"errors\":[{\"code\":\"TAG_UNKNOWN\",\"message\":\"the specified tag does not exist\"}]}\n", @@ -116,20 +116,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d8217903-b8fd-473f-a146-cbc51f5a84da", + "x-ms-client-request-id" : "9846b708-7bb6-42af-bfaa-74f1d42b9239", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "b815c9a1-1b7f-4458-91d8-62bb228b2348", + "X-Ms-Correlation-Request-Id" : "d0eb8608-e7bd-455a-9999-583502530dc8", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.933333", + "x-ms-ratelimit-remaining-calls-per-second" : "163.933333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:28 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -138,20 +138,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d84d4c32-71ec-4ed4-b217-b5b7050a589e", + "x-ms-client-request-id" : "f64d6764-bdd4-4222-b927-859b264e4f3d", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "7dbb4b5f-cf9a-4309-8396-4895e6765651", + "X-Ms-Correlation-Request-Id" : "ff69f0e8-7f88-405e-b419-a1dc085e95e2", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.366667", + "x-ms-ratelimit-remaining-calls-per-second" : "162.366667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:28 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -160,7 +160,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/unknowntag", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "a02de941-2d55-4e26-870f-8fa8eaa096b6" + "x-ms-client-request-id" : "d9f17b7b-d4b1-406f-8575-59d85f78e587" }, "Response" : { "content-length" : "81", @@ -169,9 +169,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:28 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "7182c001-6644-424f-9b28-5833286790e9", + "X-Ms-Correlation-Request-Id" : "ad991718-7c3c-437a-9d7e-f7f07a72b302", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"errors\":[{\"code\":\"TAG_UNKNOWN\",\"message\":\"the specified tag does not exist\"}]}\n", @@ -183,20 +183,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "dc30b8ee-088e-4a10-8fb9-e8b4f4e13c0b", + "x-ms-client-request-id" : "2dcb4565-f863-42c9-a004-17281da0e5a7", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "fffcbc35-5015-43ad-a4a9-b319357a7471", + "X-Ms-Correlation-Request-Id" : "fe54018a-b648-4c0a-9f80-53bd995fb7fd", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.566667", + "x-ms-ratelimit-remaining-calls-per-second" : "162.25", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:28 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -205,7 +205,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/unknowntag", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "e329825c-6475-44f0-8709-487220618b09" + "x-ms-client-request-id" : "189096c5-8232-4a44-be57-bad879d995c6" }, "Response" : { "content-length" : "81", @@ -214,9 +214,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:28 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "fc94e59e-bf02-468d-aebd-c9dd4024d7f2", + "X-Ms-Correlation-Request-Id" : "d8add092-48b5-4f78-8370-5196302e737a", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"errors\":[{\"code\":\"TAG_UNKNOWN\",\"message\":\"the specified tag does not exist\"}]}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getTagProperties[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getTagProperties[1].json index 31f739b80419..3d9ca1665e25 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getTagProperties[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.getTagProperties[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "0f6793af-0535-46ca-a2be-4156ea7c5c29", + "x-ms-client-request-id" : "b1ea2958-9d27-4a3c-941b-7d2624826b21", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "7e55e9be-449a-4c02-86db-516d05b8cd9f", + "X-Ms-Correlation-Request-Id" : "42603557-3c66-48b1-b925-7d5508b962f4", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.516667", + "x-ms-ratelimit-remaining-calls-per-second" : "162.6", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:26 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "b21b10e8-3266-4a5a-abeb-881fc412a152", + "x-ms-client-request-id" : "afa020ff-2b59-4ada-a024-f5cbbeb972eb", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "fee9786a-5b8b-4936-8d2c-3886036828ac", + "X-Ms-Correlation-Request-Id" : "1dc319c9-2eb0-4a65-a2f5-b562bd430531", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.316667", + "x-ms-ratelimit-remaining-calls-per-second" : "163.233333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:26 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/v1", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "0abca924-5ebf-43f1-be2c-e0ae1391d2cd" + "x-ms-client-request-id" : "bdbda7de-a11b-4dc4-80c5-353d93838512" }, "Response" : { "content-length" : "401", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:26 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "873195b6-966f-431b-a9b4-8a715a27e8d3", + "X-Ms-Correlation-Request-Id" : "90d1a7c4-6006-4c6c-8238-71fae9dac356", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"v1\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.7129279Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.6590696Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -71,20 +71,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "359ad562-9913-4e4e-933c-d6e38ce0c794", + "x-ms-client-request-id" : "8c963288-7a55-401a-975c-7442000646d1", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "5d74db1c-8a64-4812-bd33-d1bf1d1e2bf1", + "X-Ms-Correlation-Request-Id" : "6b7db44d-0963-41de-a9b2-04535e6a32a6", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.266667", + "x-ms-ratelimit-remaining-calls-per-second" : "163.983333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:26 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -93,7 +93,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "7fcd4559-2cb0-41e8-9e89-6e60bb7e757b" + "x-ms-client-request-id" : "81fa16e6-7fea-4157-92ec-d5fe849145a5" }, "Response" : { "content-length" : "404", @@ -102,9 +102,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:26 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "0e4e0e23-1eed-496f-b2a6-ce00d832a913", + "X-Ms-Correlation-Request-Id" : "8fcd23d9-ffe2-4eb3-bf75-20567b04dfa2", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -116,20 +116,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "92459e4d-66af-4da5-8b92-4f37eb3ab1df", + "x-ms-client-request-id" : "70f04469-aaf2-4b54-8f88-c562fd31c34b", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "f99d40e7-7ac7-495d-a6ed-070d0494d33b", + "X-Ms-Correlation-Request-Id" : "750d5a27-7604-4006-b773-23ded70d5f97", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.7", + "x-ms-ratelimit-remaining-calls-per-second" : "163.216667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:26 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -138,20 +138,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "6c651359-c5e6-4633-980a-d1d4f7111dc5", + "x-ms-client-request-id" : "c44e6ed4-f84b-4415-b60b-375f5b8abb79", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "7b6a5010-8c9a-4861-9cbf-d8e81a6303aa", + "X-Ms-Correlation-Request-Id" : "1150aa22-ec33-4171-a6af-9490a821d812", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.533333", + "x-ms-ratelimit-remaining-calls-per-second" : "162.3", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:26 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -160,7 +160,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/v1", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "67695c7d-db5d-49a1-b44f-66ff75498e36" + "x-ms-client-request-id" : "af71d4ac-6944-4c5d-ae9e-040a7a2effd8" }, "Response" : { "content-length" : "401", @@ -169,9 +169,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:26 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "823f9731-9011-4da9-9721-5edb54e24881", + "X-Ms-Correlation-Request-Id" : "09045a4c-be42-4f89-ac4f-e470f655e535", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"v1\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.7129279Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.6590696Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -183,20 +183,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "788670a5-83d9-4036-82b1-142bdff00910", + "x-ms-client-request-id" : "637befe4-262b-45ea-a742-6397e9a7e611", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "91ec39c9-35d2-49a6-8824-8f4b3c8cc36b", + "X-Ms-Correlation-Request-Id" : "a07bd58f-3755-43f8-9dae-74809446cdd1", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.5", + "x-ms-ratelimit-remaining-calls-per-second" : "164.416667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:26 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -205,7 +205,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "8b7aadda-65c4-420b-97c8-a0b0196a9676" + "x-ms-client-request-id" : "428a0784-a4b1-4516-997d-2344e429d8df" }, "Response" : { "content-length" : "404", @@ -214,9 +214,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:26 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "98f86b64-7918-491c-a124-73ab4afda9f8", + "X-Ms-Correlation-Request-Id" : "174c93a7-758f-441e-a7eb-25d3863761ea", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithInvalidPageSize[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithInvalidPageSize[1].json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithInvalidPageSize[1].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithPageSizeAndOrderBy[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithPageSizeAndOrderBy[1].json new file mode 100644 index 000000000000..957b5fef3726 --- /dev/null +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithPageSizeAndOrderBy[1].json @@ -0,0 +1,549 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "e9ffe9d6-1eb7-4cc2-8337-874b64f35621", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "a1355545-27f9-498f-a993-967bf9687f77", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "160.9", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"refresh_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:35 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "15c0d1b3-9673-4959-9b28-2d0a62e86e6e", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "51ff0663-d788-44bf-9774-e58c86e81208", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "163.783333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:35 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "e1858738-8e2c-4fa5-a932-37d892b01b78" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:35 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "cf45f253-f497-4f51-a300-d4bb6ad3f7ce", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "e935e993-c750-4755-9486-b7164f1bc930", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "31c1ff33-193d-415d-9672-eb191ffc136b", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "160.666667", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:35 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?n=2&orderby=timeasc&digest=sha256%3A5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "9bbdb87f-690c-4e8f-99d7-322574f83192" + }, + "Response" : { + "content-length" : "716", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:35 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "6d2b5b8f-0c46-44a1-98d9-5983808d7076", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v1\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.7129279Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.6590696Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Link" : "; rel=\"next\"", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "169376b4-e11d-4cc8-87f6-1e8d6be3ef5d", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "b6b45885-478f-421b-a822-d3af50cb5026", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "163.766667", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:35 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?last=637568872946590696%26v1&n=2&orderby=timeasc", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "4980f16a-1a9e-4081-945d-77d546aee557" + }, + "Response" : { + "content-length" : "713", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:35 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "e0d6d47e-805f-4ef0-920e-978cdaa4fee5", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"v2\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.0126201Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7458296Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v4\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.6426668Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.7843587Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Link" : "; rel=\"next\"", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "a6b3736d-f504-4335-a550-b764829be949", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "f42decdc-b0f4-4e6a-9845-d95f1c440011", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "163.733333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:35 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?last=637568872957843587%26v4&n=2&orderby=timeasc", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "a70ef0c9-2d20-4903-a7fb-8d483abd025a" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:35 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "56539e43-237f-4b03-aaa2-1d74910e9d42", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"v3\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.2738111Z\",\"lastUpdateTime\":\"2021-05-17T22:28:16.0118757Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "9402cb18-ed0c-4417-be12-bca37b878a9f", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "c57465d3-2737-4783-b412-5f3a488a076e", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "160.65", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"refresh_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "e3b91f82-e57b-4299-aeef-f48e808a528a", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "03706b1e-66a2-48e6-8ee7-c860833231b3", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "160.533333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "0b7ac9f7-8132-473c-b915-9e70f56306e1" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "c2b321b5-c958-43e8-9bca-5e44547a1115", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "67211460-a3cf-4ac2-88c6-7cacf1e284e0", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "a6b4144f-a014-4000-a000-cb017fd4b2e7", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "160.883333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?n=2&orderby=timeasc&digest=sha256%3A5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "e0202708-2701-4879-8e19-f6870bb5dccc" + }, + "Response" : { + "content-length" : "716", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "4a1a6a4f-2e82-46eb-8409-2680d2f0b803", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v1\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.7129279Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.6590696Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Link" : "; rel=\"next\"", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "997711cb-f9de-4988-93bf-94c42589ee3f", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "520a95dc-4031-478d-aeb9-702fef1b95c6", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "160.866667", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?last=637568872946590696%26v1&n=2&orderby=timeasc", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "739af3ca-9f50-4673-b47a-410cc743d40c" + }, + "Response" : { + "content-length" : "713", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "a451c243-0bc0-4966-a422-a06fdfed9348", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"v2\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.0126201Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7458296Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v4\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.6426668Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.7843587Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Link" : "; rel=\"next\"", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "f8d55e85-02fb-4c56-92e5-54179701808c", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "134118b8-a2d5-435b-b2da-cb5f9879ade3", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "163.7", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?last=637568872957843587%26v4&n=2&orderby=timeasc", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "c2c3e7e1-0839-4ef6-b9df-f3f9ad6f5d27" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "18d1d78f-68ce-4b4b-b302-ba7f14b88bc1", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"v3\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.2738111Z\",\"lastUpdateTime\":\"2021-05-17T22:28:16.0118757Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "0357a2e8-008b-42b5-9689-4af7d8d1eb8d", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "8fe3ded1-e0f2-4c21-8c4c-46c90807ef96", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "160.85", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?n=2&orderby=timeasc&digest=sha256%3A5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "ea7b945c-3452-4835-b769-97e519b390fb" + }, + "Response" : { + "content-length" : "716", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "ac316aa8-ec60-4a4c-8918-0e6bbc7059b8", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v1\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.7129279Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.6590696Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Link" : "; rel=\"next\"", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "e7b6b006-b360-483f-a7a9-33f95b437e44", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "8552dbb2-226a-403a-ae60-f8769b81a781", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "163.683333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?last=637568872946590696%26v1&n=2&orderby=timeasc", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "f5f0fc49-228b-4b5b-9841-a9e050ee48af" + }, + "Response" : { + "content-length" : "713", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "e258f86d-6ef0-445b-992f-591f07507bbd", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"v2\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.0126201Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7458296Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v4\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.6426668Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.7843587Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Link" : "; rel=\"next\"", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "5a114f6b-81a5-4180-a7cb-d51fe9e92eeb", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "5fe2414f-edc0-4663-b8a5-4067f97cf329", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "163.933333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?last=637568872957843587%26v4&n=2&orderby=timeasc", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "0e02460a-38d0-4ce2-8701-11f8389aca23" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:36 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "348eb99f-4c01-4c2b-af80-3bf3ed7dc547", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"v3\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.2738111Z\",\"lastUpdateTime\":\"2021-05-17T22:28:16.0118757Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithPageSizeNoOrderBy[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithPageSizeNoOrderBy[1].json new file mode 100644 index 000000000000..457de555c214 --- /dev/null +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithPageSizeNoOrderBy[1].json @@ -0,0 +1,412 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "f602db48-bd70-4987-a9ae-8d41581808fa", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "bbbe1285-4b2a-4052-ab08-beffd128b9da", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "166.65", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"refresh_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "285e5e7e-29fa-4039-910f-9f268aa2fc7c", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "f7275246-4ecf-478e-8720-983fd67bd4a6", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "166.633333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "94eb165b-dd24-472c-9c52-92c6201a3692" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "c9023a75-db10-46f6-8bf5-522f9a6ebed2", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "c1f6fd66-fcb5-43b0-851a-d1633e44f3ed", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "1fa7fecd-ab42-483e-b12b-8e9665a034be", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "165.233333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?n=2&digest=sha256%3A5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "6a35ac9e-da89-4f28-bfce-79386584cf1c" + }, + "Response" : { + "content-length" : "716", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "4a5b8a12-fad9-404e-bcde-a13b0609323a", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v1\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.7129279Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.6590696Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Link" : "; rel=\"next\"", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "12dcc599-b170-4dd7-905d-df698b28aebd", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "61a3b44b-9e53-445a-a877-55c36dc9dd97", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "165.866667", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?last=v1&n=2&orderby=", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "d8b990ba-5b87-4a48-8abc-cfa48c9e9a69" + }, + "Response" : { + "content-length" : "713", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "81546439-2452-45f1-985f-206f6afe083c", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"v2\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.0126201Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7458296Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v3\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.2738111Z\",\"lastUpdateTime\":\"2021-05-17T22:28:16.0118757Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Link" : "; rel=\"next\"", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "d29b5636-792e-4f60-8a26-a01984a35db4", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "e84ff0fd-7d5c-4fc9-bf9a-3ac382a6166b", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "166.566667", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?last=v3&n=2&orderby=", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "00e30e95-40e6-4b1d-99ba-55966afbc43c" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "e68223a7-5ae2-4390-a556-0a82f5d22213", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"v4\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.6426668Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.7843587Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "b22b88f2-54bf-484f-abd0-64174474f199", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "822b9a54-04aa-4d73-9db0-a6432c084656", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "164.966667", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"refresh_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "1eded602-5c29-42cc-90ff-b12e68f1ad81", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "5f67bd46-46ac-4069-907f-fcf18556d50c", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "164.8", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "911fd250-bbf0-473d-b11f-a19c008e1107" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "4622518b-9ae8-48bd-847e-3ad9e329397d", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "33c27722-9b61-43cb-af95-35ce5d4b0910", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "112cf25d-ff9f-40c6-a4a5-98402eadd07e", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "164.983333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?n=2&digest=sha256%3A5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "a6ed2da3-82bd-4748-a4b1-c6c0630cdfbe" + }, + "Response" : { + "content-length" : "716", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "4d459713-f1af-4435-b56d-d6e0a673504e", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v1\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.7129279Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.6590696Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Link" : "; rel=\"next\"", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "929dc106-9c56-41c8-9ae8-d44e2200b48b", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "5c6a4a9e-f6f7-4df5-b2a6-0bab567ce2c3", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "164.616667", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?last=v1&n=2&orderby=", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "4557252d-68f8-4264-9aeb-ce1dd66b96c7" + }, + "Response" : { + "content-length" : "713", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "f32020f7-ddbb-4b7d-8d2b-d48dfed5d548", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"v2\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.0126201Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7458296Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v3\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.2738111Z\",\"lastUpdateTime\":\"2021-05-17T22:28:16.0118757Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Link" : "; rel=\"next\"", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "2becad32-a83b-477d-870c-372e0e7278c6", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "c850abe2-7053-46d1-97c9-db570abf47c6", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "165.833333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?last=v3&n=2&orderby=", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "839c356d-9a25-4d7f-a5a2-3c71af0f3692" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "43f7bf6f-6f13-4ba2-9fa1-9d395148df33", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"v4\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.6426668Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.7843587Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithPageSize[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithPageSize[1].json new file mode 100644 index 000000000000..adb4bf37d2d2 --- /dev/null +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagPropertiesWithPageSize[1].json @@ -0,0 +1,320 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "60d60fa1-0075-4706-b674-7848f7efc3d4", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "e57a8cac-bfc3-4f71-bf40-cac6fc2da88a", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "163.65", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"refresh_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "8eef261e-7c8a-41e3-9968-b26ffdb25dbf", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "33621bec-c1fa-46eb-aace-5ebaeea2e17b", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "161.916667", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "5938b152-3285-420c-bf3d-085d4ab593ea" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "6f1c8506-586a-4a66-9ccb-c351952b1ebd", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "53b5e8d5-77c0-4af4-a718-eb277f094f43", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "6a181f85-2f64-4807-8c4f-5b20018fe1e4", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "160.833333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?n=2&digest=sha256%3A5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "ee1d3c52-3040-4447-9527-2fa571082df8" + }, + "Response" : { + "content-length" : "716", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "30f51054-e0e9-4fae-9f54-b14a4d8e75e8", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v1\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.7129279Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.6590696Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Link" : "; rel=\"next\"", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "3ec2e778-779a-4f6d-96ff-b2ea64eeb586", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "e4bd8b2d-66db-4792-870d-cfd0428cd87d", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "160.633333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?last=v1&n=2&orderby=", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "5ae97ae5-9228-473a-990e-8aaf39490c9f" + }, + "Response" : { + "content-length" : "713", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "7059f8d9-13aa-4a1a-8e13-c71859594bdf", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"v2\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.0126201Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7458296Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v3\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.2738111Z\",\"lastUpdateTime\":\"2021-05-17T22:28:16.0118757Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Link" : "; rel=\"next\"", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "af7781dd-5c4b-4a72-a2ae-6f8705466cbc", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "82a7cddf-6b59-49bc-aeab-f241764a4f53", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "161.9", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?last=v3&n=2&orderby=", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "ee008678-e1f6-4a6f-9d5b-beb349dbb012" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "d7eae950-cb72-4edc-9482-8a2898ed86a4", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"v4\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.6426668Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.7843587Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "ee8dbf02-eafa-4e23-a9b4-640b51e374e8", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "c2e30128-3c4d-4e41-a64b-fe0dbad63ccf", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "160.816667", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"refresh_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "0ed4edb1-4127-4468-b640-612e4a072f93", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "c12ccb83-01c1-4572-84cc-7ac76b3d3add", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "163.633333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "25b44b82-457b-4eee-b779-ca5ead0bc3c1" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "1c4fcad1-e366-4a7b-ab3a-75f65ab426b8", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "4cb193e5-f005-4071-846b-bee12248b6d2", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "4ff5bc32-672a-4bb5-98f3-626c84a52305", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "162.35", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?digest=sha256%3A5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "987918cc-0859-490e-b21d-f0f624ba08a8" + }, + "Response" : { + "content-length" : "1643", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:38 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "138f3e83-2a57-400f-b824-2b0b15ec8602", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v1\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.7129279Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.6590696Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v2\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.0126201Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7458296Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v3\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.2738111Z\",\"lastUpdateTime\":\"2021-05-17T22:28:16.0118757Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v4\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.6426668Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.7843587Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagProperties[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagProperties[1].json new file mode 100644 index 000000000000..59d924318209 --- /dev/null +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactAsyncIntegrationTests.listTagProperties[1].json @@ -0,0 +1,474 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "ede109e5-41d6-4c7c-b2ad-1b93ea1622fc", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "172efb7e-7bc4-4834-9cf3-f9474d2f7b05", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "166.55", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"refresh_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "6e857514-4565-446d-928e-b4667b9561ed", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "89216c7d-bc82-4da0-851f-0fb9f8ea1bd8", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "165.283333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "f145dd79-4b05-41b4-b1b0-bb416548deb0" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "3ec0aed3-a9e0-47f4-9d45-560e44c4505a", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "f615e863-dd90-4c25-804c-f01dca234a4b", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "5f4542ec-feef-48d4-98a0-ad3845018218", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "166.583333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_manifests/sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "8e48914e-f026-44b0-85c0-09dcfdee1c26" + }, + "Response" : { + "content-length" : "1611", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "435edbd0-f91f-402a-90b0-d77cbfd2f2f8", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"manifest\":{\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"imageSize\":5325,\"createdTime\":\"2021-05-17T22:28:14.7976969Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7976969Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:e5785cb0c62cebbed4965129bae371f0589cadd6d84798fb58c2c5f9e237efd9\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:963612c5503f3f1674f315c67089dee577d8cc6afc18565e0b4183ae355fb343\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:cb55d8f7347376e1ba38ca740904b43c9a52f66c7d2ae1ef1a0de1bc9f40df98\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:88b2e00179bd6c4064612403c8d42a13de7ca809d61fee966ce9e129860a8a90\",\"architecture\":\"mips64le\",\"os\":\"linux\"},{\"digest\":\"sha256:bb7ab0fa94fdd78aca84b27a1bd46c4b811051f9b69905d81f5f267fc6546a9d\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:e49abad529e5d9bd6787f3abeab94e09ba274fe34731349556a850b9aebbf7bf\",\"architecture\":\"s390x\",\"os\":\"linux\"},{\"digest\":\"sha256:7fed95756fe4ebeb6eb1d82c2176e0800a02807cc66fe48beb179e57c54ddcf1\",\"architecture\":\"amd64\",\"os\":\"windows\"}]}}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "f7670ecc-4ce4-4065-892f-c52f786acd31", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "1e711752-efbc-4bfe-ab10-8fa0d4c4e3fb", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "165.95", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"refresh_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "2457358e-321c-4436-9370-f13b2efbaedf", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "a098c424-4034-4cd7-991c-bf8318dd0db2", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "164.666667", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?digest=sha256%3A5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "33acbea1-b26c-4717-98fb-bdc25300cf67" + }, + "Response" : { + "content-length" : "1643", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "8566f7f1-4686-46cf-b017-f9776e7058eb", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v1\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.7129279Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.6590696Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v2\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.0126201Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7458296Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v3\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.2738111Z\",\"lastUpdateTime\":\"2021-05-17T22:28:16.0118757Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v4\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.6426668Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.7843587Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "367c2366-f66f-4aed-a13b-9826231a40d6", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "706626bc-c26f-454f-9c7b-bb8a5e98da03", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "165.233333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"refresh_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "8665df53-add5-42b8-bea1-88a1fbb7d582", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "cc064b52-ed7f-4288-88dc-a5e0c7033d40", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "164.633333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?digest=sha256%3A5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "34b3215b-78df-4877-bd78-44fd75d119b7" + }, + "Response" : { + "content-length" : "1643", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "ccde69cf-f756-4257-a2bf-255f07d93f31", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v1\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.7129279Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.6590696Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v2\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.0126201Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7458296Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v3\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.2738111Z\",\"lastUpdateTime\":\"2021-05-17T22:28:16.0118757Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v4\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.6426668Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.7843587Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "55919883-174c-4867-9438-6f6928bd3359", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "e629a82b-6979-4d95-aec7-b039ea09fd26", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "164.783333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"refresh_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "323ee1fc-1c2a-4b0f-b7b1-bb40d870ce64", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "047eb31f-39c6-4a32-9cef-bf1103c729af", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "164.583333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "d8040cf9-eacb-415e-8f0a-0193c88c4535" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "74cd2dd1-93a8-4df9-abde-90633248e5a8", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "fecd7174-7851-4f6d-849a-5299aaa8711e", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "3a3ea82e-1083-4b5e-8eb0-8e0de1c44a01", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "164.633333", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?digest=sha256%3A5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "c215e009-83fb-4e36-9036-09aa9aebd2e0" + }, + "Response" : { + "content-length" : "1643", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "cd4e9d32-39e4-4b3a-b3c1-3f3a611bfaef", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v1\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.7129279Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.6590696Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v2\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.0126201Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7458296Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v3\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.2738111Z\",\"lastUpdateTime\":\"2021-05-17T22:28:16.0118757Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v4\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.6426668Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.7843587Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "7e78414e-22bf-4647-9de5-efbf9fb14597", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "24977919-d66a-4410-80f7-b4d43c8df252", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "164.766667", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"refresh_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "b97a2518-b8e0-4ad0-a48e-b50b97c8c041", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "40fda2a7-c88f-434d-b0db-325b65287112", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "166.466667", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags/latest", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "a82f0f82-43d9-444b-9877-64b848c6ce80" + }, + "Response" : { + "content-length" : "404", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "4efda1d0-4bf9-44b5-8ab4-478bca9c51b9", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tag\":{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "c26230c3-8e24-4197-a4d5-eb4904f5e2cf", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "d656646e-03ab-4e55-8d5d-2f5ede536b89", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "Connection" : "keep-alive", + "x-ms-ratelimit-remaining-calls-per-second" : "165.816667", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Fhello-world/_tags?digest=sha256%3A5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c", + "Headers" : { + "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", + "x-ms-client-request-id" : "ea64e030-cd94-438f-aab4-e9ed829e40fb" + }, + "Response" : { + "content-length" : "1643", + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "febf59bc-c1a3-4265-a80d-c7948404f5bd", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/hello-world\",\"tags\":[{\"name\":\"latest\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:44.9689538Z\",\"lastUpdateTime\":\"2021-05-17T22:28:13.877174Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v1\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.7129279Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.6590696Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v2\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.0126201Z\",\"lastUpdateTime\":\"2021-05-17T22:28:14.7458296Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v3\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.2738111Z\",\"lastUpdateTime\":\"2021-05-17T22:28:16.0118757Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}},{\"name\":\"v4\",\"digest\":\"sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c\",\"createdTime\":\"2021-05-11T23:47:47.6426668Z\",\"lastUpdateTime\":\"2021-05-17T22:28:15.7843587Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}]}\n", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.deleteFromRecordFile.json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.deleteFromRecordFile.json index 29a4e3af3f89..1db5af83123f 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.deleteFromRecordFile.json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.deleteFromRecordFile.json @@ -4,7 +4,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v4", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f895e0c6-a768-4125-a5c3-e7914557cfe2" + "x-ms-client-request-id" : "3b6fc888-44f5-455c-ae5b-37a6b60dd6c1" }, "Response" : { "retry-after" : "0", @@ -18,7 +18,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_manifests/sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "227d459e-3d69-4819-b77f-e0aa1f85bf51" + "x-ms-client-request-id" : "fc8cf132-423e-4d48-baec-3fef9a9ec2ab" }, "Response" : { "retry-after" : "0", @@ -32,7 +32,7 @@ "Uri" : "https://REDACTED.azurecr.io/v2/library%2Falpine/manifests/sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "b59ff816-9595-46b8-a4c5-9cd5c92614f1" + "x-ms-client-request-id" : "6936c50c-ee1f-4ae0-a0d7-207d21eda5c6" }, "Response" : { "retry-after" : "0", @@ -44,7 +44,7 @@ "Uri" : "https://REDACTED.azurecr.io/v2/library%2Falpine/manifests/sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "948b63fb-e8af-4064-8c62-348eb2f4a694" + "x-ms-client-request-id" : "1bf8d48c-aef6-4194-895d-3bbacb31c462" }, "Response" : { "retry-after" : "0", @@ -56,7 +56,7 @@ "Uri" : "https://REDACTED.azurecr.io/v2/library%2Falpine/manifests/sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "c3f51cd2-cf2e-45ca-bbb8-9a0d872a8513" + "x-ms-client-request-id" : "6e5364c8-59c6-4c46-bdab-6d04f3b1b502" }, "Response" : { "retry-after" : "0", @@ -68,7 +68,7 @@ "Uri" : "https://REDACTED.azurecr.io/v2/library%2Falpine/manifests/sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "c397597a-d20e-45d2-961c-3731793c271d" + "x-ms-client-request-id" : "e0d5ffb5-4a0f-45ea-b883-9adf0759f316" }, "Response" : { "retry-after" : "0", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.deleteTagFromRecordFile.json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.deleteTagFromRecordFile.json index 5385b4c86952..f317955a9837 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.deleteTagFromRecordFile.json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.deleteTagFromRecordFile.json @@ -4,7 +4,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v3", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "27f21500-4af2-4a4f-a626-ea002c587bfa" + "x-ms-client-request-id" : "5d65e724-564f-4c4d-ba79-74f47873788e" }, "Response" : { "retry-after" : "0", @@ -16,7 +16,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v3", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "968c36e3-950a-4572-b714-5cddd3298f04" + "x-ms-client-request-id" : "eebfc7a3-dbbe-481d-9e39-5bd291df2d37" }, "Response" : { "retry-after" : "0", @@ -28,7 +28,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v3", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "faee5601-373b-4517-b162-5b56b02aab61" + "x-ms-client-request-id" : "bc2f7f66-c237-40ee-83e2-5cab7ab01d02" }, "Response" : { "retry-after" : "0", @@ -40,7 +40,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v3", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "e1e07048-7c1e-4898-a014-fda777cd9fcc" + "x-ms-client-request-id" : "3ccfab91-9b4d-4e8d-b58e-def5891f3b75" }, "Response" : { "retry-after" : "0", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.deleteTag[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.deleteTag[1].json index e755f1a496c6..0bac86b8af78 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.deleteTag[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.deleteTag[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d1b7db02-c608-440e-adc5-b0bb6c4dbdb2", + "x-ms-client-request-id" : "441b36f3-6619-4dfc-b1f2-4706dcc875ce", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "97224c3b-b36c-4146-bc2d-4da1e0b5da84", + "X-Ms-Correlation-Request-Id" : "345e27c1-959e-44aa-bbe0-fa6d230118ed", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.4", + "x-ms-ratelimit-remaining-calls-per-second" : "165.883333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:09 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "2230986b-82bc-4139-badc-6b73fca73ff6", + "x-ms-client-request-id" : "ec4383b5-da28-4a9c-922b-35b72d467d68", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "66a4fec2-ad11-449b-acb0-8cfdc66dee52", + "X-Ms-Correlation-Request-Id" : "46e57b0b-c1cb-446b-9c6a-30e0614857a9", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.55", + "x-ms-ratelimit-remaining-calls-per-second" : "166.6", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:09 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v3", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "13c38bb3-206e-4bc1-89b2-77048bbff092" + "x-ms-client-request-id" : "a530ad24-88e1-497a-88c0-3513050962c2" }, "Response" : { "content-length" : "0", @@ -57,14 +57,14 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "202", - "Date" : "Wed, 19 May 2021 23:33:09 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "X-Ms-Int-Docker-Content-Digest" : "sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "4e7ada57-fbbf-4371-bfac-cacd8b8d818d", + "X-Ms-Correlation-Request-Id" : "bddd8ef8-e80f-43e1-9136-e7cf9db030ad", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "X-Ms-Client-Request-Id" : "13c38bb3-206e-4bc1-89b2-77048bbff092", - "X-Ms-Request-Id" : "88a66b69-669e-4c7a-a123-6cdda1d0d8bc", + "X-Ms-Client-Request-Id" : "a530ad24-88e1-497a-88c0-3513050962c2", + "X-Ms-Request-Id" : "2295cb4d-c29b-4117-ae72-14c03edef0b4", "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "8.000000" }, "Exception" : null @@ -73,20 +73,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "80f247be-c759-4ffc-a2de-af5fc1112b42", + "x-ms-client-request-id" : "5c51373e-3278-4173-9d22-dae6ef6d80e1", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "13a13420-2896-4b9b-9221-05acfbf88695", + "X-Ms-Correlation-Request-Id" : "c8b1f73b-a3d3-4372-a943-9a5daa523138", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.266667", + "x-ms-ratelimit-remaining-calls-per-second" : "166.55", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:09 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -95,7 +95,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v3", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "9db08289-726c-47a2-8da1-fb58971a92bd" + "x-ms-client-request-id" : "096edc63-e19b-4109-81bc-3cfe1bb2589f" }, "Response" : { "content-length" : "81", @@ -104,9 +104,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:33:09 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "db8473ef-bec9-4008-8f5f-501db5ab1514", + "X-Ms-Correlation-Request-Id" : "2d3bfa4e-5b23-49c3-b864-0fe6d2d827ee", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"errors\":[{\"code\":\"TAG_UNKNOWN\",\"message\":\"the specified tag does not exist\"}]}\n", @@ -118,20 +118,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "a83dc09a-4e98-4d61-9fe2-5d5e6038d193", + "x-ms-client-request-id" : "09f7a8d0-aeae-4870-af0c-db2acca6e00e", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "e1202ba5-56a3-4581-8c45-7e8cec388eb0", + "X-Ms-Correlation-Request-Id" : "669f81dd-0d88-48ab-a6e6-d219ec7aa956", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.266667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.783333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:09 GMT", + "Date" : "Thu, 27 May 2021 17:50:09 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -140,7 +140,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v3", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "aa255bcd-f9fe-4772-9c7c-f9714f953bec" + "x-ms-client-request-id" : "55b224d2-852b-41f1-ae29-0f943e3d1b24" }, "Response" : { "content-length" : "81", @@ -149,14 +149,14 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:33:09 GMT", + "Date" : "Thu, 27 May 2021 17:50:09 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "d70309dd-524d-4f78-b6b6-9571cc117284", + "X-Ms-Correlation-Request-Id" : "4a1218a1-7f6b-4861-9bc4-36d2e6d29f9d", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "X-Ms-Client-Request-Id" : "aa255bcd-f9fe-4772-9c7c-f9714f953bec", - "X-Ms-Request-Id" : "1ed71ab3-8705-4ffd-8e30-5009ec279e5c", - "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "7.000000", + "X-Ms-Client-Request-Id" : "55b224d2-852b-41f1-ae29-0f943e3d1b24", + "X-Ms-Request-Id" : "d4c70fdf-5d46-48d5-9b72-2c9e1e28d26b", + "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "8.000000", "Body" : "{\"errors\":[{\"code\":\"TAG_UNKNOWN\",\"message\":\"the specified tag does not exist\"}]}\n", "Content-Type" : "application/json; charset=utf-8" }, diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.delete[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.delete[1].json index dc8cee63c29a..8d034357f354 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.delete[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.delete[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d073bf6b-4597-4b53-b497-55f5a628b206", + "x-ms-client-request-id" : "471d7b0a-5675-43f9-b5d1-b4e4f0fafd00", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "48aec9ed-d2a2-4580-b8b8-b05c783270c1", + "X-Ms-Correlation-Request-Id" : "0bd33715-4506-4a13-a805-14ef44e0399a", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.55", + "x-ms-ratelimit-remaining-calls-per-second" : "166.583333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "f746c192-c043-4105-a13c-8c21fddbb017", + "x-ms-client-request-id" : "07f84c89-2042-4326-87a8-c7372dd426a3", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "59350f16-76d7-46de-bbfa-9a286e7ddeac", + "X-Ms-Correlation-Request-Id" : "4bb0bf50-c490-4d04-ba3f-c005dd3d2bf7", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.583333", + "x-ms-ratelimit-remaining-calls-per-second" : "165.016667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v4", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "e22a1a26-5578-48bb-a5a5-03d8e59536ca" + "x-ms-client-request-id" : "1be03054-2a3d-416e-b769-fb468637ded2" }, "Response" : { "content-length" : "396", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "fa2d2a37-c03d-4d8f-9cc4-8ebed3d07994", + "X-Ms-Correlation-Request-Id" : "034f0636-42e8-4f2b-951b-005f871596f6", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"tag\":{\"name\":\"v4\",\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"createdTime\":\"2021-05-11T23:33:34.2901102Z\",\"lastUpdateTime\":\"2021-05-11T23:33:34.2901102Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -71,20 +71,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "1377f740-d1d7-4d02-910b-e6a1102e3f75", + "x-ms-client-request-id" : "d0387784-9826-4a77-a379-405927bb01cd", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "5a8e3fdc-4ce7-49c5-b6b6-8aa13fe869ad", + "X-Ms-Correlation-Request-Id" : "a26d9d78-1bf8-4e9b-a04e-0fed079af2de", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.55", + "x-ms-ratelimit-remaining-calls-per-second" : "166.533333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -93,21 +93,21 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_manifests/sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "3274e243-a395-4701-b451-8cf8728ba2bf" + "x-ms-client-request-id" : "a49dcd1d-a545-4860-9880-fa046ac08b7c" }, "Response" : { - "content-length" : "1359", + "content-length" : "1355", "Server" : "openresty", "X-Content-Type-Options" : "nosniff", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:12 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "09f20012-d920-40e8-98fc-dd535d24b715", + "X-Ms-Correlation-Request-Id" : "7a810ce0-076a-4b7f-b29f-68523d92cd79", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"manifest\":{\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"imageSize\":3696,\"createdTime\":\"2021-05-11T23:33:32.7469627Z\",\"lastUpdateTime\":\"2021-05-11T23:33:32.7469627Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:ea73ecf48cd45e250f65eb731dd35808175ae37d70cca5d41f9ef57210737f04\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:9663906b1c3bf891618ebcac857961531357525b25493ef717bca0f86f581ad6\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:8f18fae117ec6e5777cc62ba78cbb3be10a8a38639ccfb949521abd95c8301a4\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:5de788243acadd50526e70868b86d12ad79f3793619719ae22e0d09e8c873a66\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:827525365ff718681b0688621e09912af49a17611701ee4d421ba50d57c13f7e\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:a090d7c93c8e9ab88946367500756c5f50cd660e09deb4c57494989c1f23fa5a\",\"architecture\":\"s390x\",\"os\":\"linux\"}]}}\n", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"manifest\":{\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"imageSize\":3696,\"createdTime\":\"2021-05-11T23:33:32.7469627Z\",\"lastUpdateTime\":\"2021-05-11T23:33:32.7469627Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:ea73ecf48cd45e250f65eb731dd35808175ae37d70cca5d41f9ef57210737f04\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:9663906b1c3bf891618ebcac857961531357525b25493ef717bca0f86f581ad6\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:8f18fae117ec6e5777cc62ba78cbb3be10a8a38639ccfb949521abd95c8301a4\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:5de788243acadd50526e70868b86d12ad79f3793619719ae22e0d09e8c873a66\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:827525365ff718681b0688621e09912af49a17611701ee4d421ba50d57c13f7e\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:a090d7c93c8e9ab88946367500756c5f50cd660e09deb4c57494989c1f23fa5a\",\"architecture\":\"s390x\",\"os\":\"linux\"}]}}\n", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -116,20 +116,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "179f0fc9-70cd-4dd0-8a1f-ade99fec5909", + "x-ms-client-request-id" : "c5cc4bde-9aba-4db7-9e78-420147164e1b", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "9368ca9f-b3d1-4639-a715-697c0a420227", + "X-Ms-Correlation-Request-Id" : "670f2f8b-5559-48cd-b2ba-6e627db29c76", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.266667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.733333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -138,20 +138,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "3433c5c1-5685-4759-b63a-c056a2c70884", + "x-ms-client-request-id" : "fcbe502b-269d-401b-a01c-07b63bbf957c", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "5fdd7496-a3b4-4909-9dd1-1c579e8f48b8", + "X-Ms-Correlation-Request-Id" : "da78fce5-0493-409c-ab95-0d9462f6ca67", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.516667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.533333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -160,7 +160,7 @@ "Uri" : "https://REDACTED.azurecr.io/v2/library%2Falpine/manifests/sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "6d13d70c-1595-4e65-a6fe-4a11494ddb93" + "x-ms-client-request-id" : "1b10a568-1b7e-4e19-9a25-0a37ee8177aa" }, "Response" : { "content-length" : "0", @@ -169,13 +169,13 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "202", - "Date" : "Wed, 19 May 2021 23:32:21 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "e7751314-bc2b-4a55-a998-c44d9ab18fad", + "X-Ms-Correlation-Request-Id" : "1861b1cd-ecf4-48dc-94b2-12bd7e7223ff", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "X-Ms-Client-Request-Id" : "6d13d70c-1595-4e65-a6fe-4a11494ddb93", - "X-Ms-Request-Id" : "573dfd4a-5b3e-4def-9bd0-aad609834908", + "X-Ms-Client-Request-Id" : "1b10a568-1b7e-4e19-9a25-0a37ee8177aa", + "X-Ms-Request-Id" : "2137dc80-591d-4a30-b053-8452dac5ac6c", "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "8.000000" }, "Exception" : null @@ -184,20 +184,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "5681c00a-9826-40e5-954d-023c7dd71d9e", + "x-ms-client-request-id" : "b03036cc-e8a3-409a-b9a3-fc624ec592ea", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "cebc2bbc-c7c1-4b9f-bf90-b080afccda2c", + "X-Ms-Correlation-Request-Id" : "09bf7394-6c72-4e4d-ad07-adb6d6e2c8d5", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.633333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.516667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:21 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -206,7 +206,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_manifests/sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "0e98d262-6b43-4128-8ed2-40284e1b61af" + "x-ms-client-request-id" : "2f5f82c8-9182-4b23-a3ad-5c3ee4466b69" }, "Response" : { "content-length" : "70", @@ -215,9 +215,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:32:22 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "7fe4fb0e-5287-4c64-bd40-4f28bb898112", + "X-Ms-Correlation-Request-Id" : "e747a9cc-cc0e-4e7c-bad5-bc7c8ff9c4c9", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"errors\":[{\"code\":\"MANIFEST_UNKNOWN\",\"message\":\"manifest unknown\"}]}\n", @@ -229,20 +229,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "02057de3-6e4f-4be0-907a-f951b1da9f8f", + "x-ms-client-request-id" : "071d8631-33fa-4688-adde-a7d3771d5dbf", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "2fd1a748-4005-452a-9033-f1412d5b0eec", + "X-Ms-Correlation-Request-Id" : "6daceebf-7828-431f-9348-9a9c017e8130", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.033333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.583333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:22 GMT", + "Date" : "Thu, 27 May 2021 17:50:05 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -251,7 +251,7 @@ "Uri" : "https://REDACTED.azurecr.io/v2/library%2Falpine/manifests/sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "87694921-5a5d-47ec-9592-ef10926d43c9" + "x-ms-client-request-id" : "85844d54-7bcf-494b-ac63-d977c62b2863" }, "Response" : { "content-length" : "147", @@ -260,14 +260,14 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Wed, 19 May 2021 23:32:22 GMT", + "Date" : "Thu, 27 May 2021 17:50:06 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "d27086ff-4bd1-44a3-b289-141ade8b43b1", + "X-Ms-Correlation-Request-Id" : "cdc93678-e590-4364-90ad-4985f5a55758", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "X-Ms-Client-Request-Id" : "87694921-5a5d-47ec-9592-ef10926d43c9", - "X-Ms-Request-Id" : "ee42d2c8-91b1-4288-8443-427bc9c486ef", - "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "8.000000", + "X-Ms-Client-Request-Id" : "85844d54-7bcf-494b-ac63-d977c62b2863", + "X-Ms-Request-Id" : "923303ce-0a07-452d-94d8-97c984633cd9", + "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "7.000000", "Body" : "{\"errors\":[{\"code\":\"MANIFEST_UNKNOWN\",\"message\":\"manifest sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748 is not found\"}]}\n", "Content-Type" : "application/json; charset=utf-8" }, diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.updateManifestProperties[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.updateManifestProperties[1].json index 2ffdfefcf87c..e437f4557f34 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.updateManifestProperties[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.updateManifestProperties[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d20486db-2efb-481d-948e-c87328142ac5", + "x-ms-client-request-id" : "15260354-2b5b-446e-a9d1-602f28bad9a7", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "503521a0-4dc5-47b5-a81a-a4a0f3e943f4", + "X-Ms-Correlation-Request-Id" : "7323b12b-5c71-4a82-86f0-5185fbfd848e", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.733333", + "x-ms-ratelimit-remaining-calls-per-second" : "165.3", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:37 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "c8a34a66-195e-4fc2-bdae-fdba28729298", + "x-ms-client-request-id" : "70568902-023e-4893-80d1-efda9bb6be41", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "b6a960a7-4ba1-46d6-b153-12a8d4588976", + "X-Ms-Correlation-Request-Id" : "691f3083-58c7-4395-8266-f0421191d168", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.333333", + "x-ms-ratelimit-remaining-calls-per-second" : "165.216667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:37 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v1", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "8eac8f63-4081-495e-a70b-4a530a37739e" + "x-ms-client-request-id" : "8f661e9b-8fac-470e-896e-aa7ee0613050" }, "Response" : { "content-length" : "396", @@ -57,9 +57,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:37 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "31d2b66d-5f64-43a5-b41d-dbdfe696e245", + "X-Ms-Correlation-Request-Id" : "79078354-1198-4ecf-86f1-fef89231cbed", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"tag\":{\"name\":\"v1\",\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"createdTime\":\"2021-05-11T23:33:33.7829226Z\",\"lastUpdateTime\":\"2021-05-11T23:33:33.7829226Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -71,20 +71,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "08d0d92f-c9d0-4d8d-b0c4-a11c8ed1c9c4", + "x-ms-client-request-id" : "9b624477-fb1a-4890-b00c-5853f82b3270", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "aa8db4d9-2417-4253-b06a-8a0ad6c09677", + "X-Ms-Correlation-Request-Id" : "64cbd4a3-763d-4174-b44d-d842b9489f9b", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.316667", + "x-ms-ratelimit-remaining-calls-per-second" : "165.033333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:37 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -93,7 +93,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_manifests/sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "ff357f06-4458-46e7-920e-073a3064f9b5", + "x-ms-client-request-id" : "eade807a-2d4e-4641-9cfc-ceb362c4bfcd", "Content-Type" : "application/json" }, "Response" : { @@ -103,9 +103,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "a6511062-e4f5-45ff-9a03-79f01544fe71", + "X-Ms-Correlation-Request-Id" : "489bcf87-751d-4d42-9632-591f886bf88a", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"manifest\":{\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"imageSize\":3696,\"createdTime\":\"2021-05-11T23:33:32.7469627Z\",\"lastUpdateTime\":\"2021-05-11T23:33:32.7469627Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:ea73ecf48cd45e250f65eb731dd35808175ae37d70cca5d41f9ef57210737f04\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:9663906b1c3bf891618ebcac857961531357525b25493ef717bca0f86f581ad6\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:8f18fae117ec6e5777cc62ba78cbb3be10a8a38639ccfb949521abd95c8301a4\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:5de788243acadd50526e70868b86d12ad79f3793619719ae22e0d09e8c873a66\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:827525365ff718681b0688621e09912af49a17611701ee4d421ba50d57c13f7e\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:a090d7c93c8e9ab88946367500756c5f50cd660e09deb4c57494989c1f23fa5a\",\"architecture\":\"s390x\",\"os\":\"linux\"}]}}\n", @@ -117,20 +117,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "aa08bf54-b4f2-4313-92f5-18a7f62e67cd", + "x-ms-client-request-id" : "81995d40-0c94-4af3-8dc1-16054a130c69", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "b1188314-6301-400f-a220-0134b0ab7fe0", + "X-Ms-Correlation-Request-Id" : "455d2701-d976-40e0-83d7-84d20c37b65f", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.466667", + "x-ms-ratelimit-remaining-calls-per-second" : "165.966667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:49:59 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -139,22 +139,22 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_manifests/sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "ac82e48c-abdc-4e64-81c7-e506560fbc57", + "x-ms-client-request-id" : "52cbafa9-10e4-4f26-95d7-3ce345db30fc", "Content-Type" : "application/json" }, "Response" : { - "content-length" : "1360", + "content-length" : "1355", "Server" : "openresty", "X-Content-Type-Options" : "nosniff", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:00 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "b5f8c58d-abc8-4fac-b53b-8cabb1946181", + "X-Ms-Correlation-Request-Id" : "5d33eb07-3112-4308-9035-106f75b9e6d1", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"manifest\":{\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"imageSize\":3696,\"createdTime\":\"2021-05-11T23:33:32.7469627Z\",\"lastUpdateTime\":\"2021-05-11T23:33:32.7469627Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:ea73ecf48cd45e250f65eb731dd35808175ae37d70cca5d41f9ef57210737f04\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:9663906b1c3bf891618ebcac857961531357525b25493ef717bca0f86f581ad6\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:8f18fae117ec6e5777cc62ba78cbb3be10a8a38639ccfb949521abd95c8301a4\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:5de788243acadd50526e70868b86d12ad79f3793619719ae22e0d09e8c873a66\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:827525365ff718681b0688621e09912af49a17611701ee4d421ba50d57c13f7e\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:a090d7c93c8e9ab88946367500756c5f50cd660e09deb4c57494989c1f23fa5a\",\"architecture\":\"s390x\",\"os\":\"linux\"}]}}\n", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"manifest\":{\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"imageSize\":3696,\"createdTime\":\"2021-05-11T23:33:32.7469627Z\",\"lastUpdateTime\":\"2021-05-11T23:33:32.7469627Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:ea73ecf48cd45e250f65eb731dd35808175ae37d70cca5d41f9ef57210737f04\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:9663906b1c3bf891618ebcac857961531357525b25493ef717bca0f86f581ad6\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:8f18fae117ec6e5777cc62ba78cbb3be10a8a38639ccfb949521abd95c8301a4\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:5de788243acadd50526e70868b86d12ad79f3793619719ae22e0d09e8c873a66\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:827525365ff718681b0688621e09912af49a17611701ee4d421ba50d57c13f7e\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:a090d7c93c8e9ab88946367500756c5f50cd660e09deb4c57494989c1f23fa5a\",\"architecture\":\"s390x\",\"os\":\"linux\"}]}}\n", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -163,20 +163,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "217b80b2-1f7e-4bbe-8750-ccf462c0aaec", + "x-ms-client-request-id" : "cf95e59f-08ae-4326-851f-fee30cea1347", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "ea329f39-79c9-463c-9cf2-aaae82936299", + "X-Ms-Correlation-Request-Id" : "19525c40-4255-4ad6-822c-cc4e7b3d0353", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.266667", + "x-ms-ratelimit-remaining-calls-per-second" : "166.516667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -185,20 +185,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "50fce406-77e8-4c48-b895-68c353361935", + "x-ms-client-request-id" : "d7f8fdd1-e743-47dc-a0d0-70778f8a4540", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "eea0e33f-afbe-40b4-b5c5-979f6e9e5936", + "X-Ms-Correlation-Request-Id" : "0918ed15-b85a-467f-8bf3-107770a63269", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.433333", + "x-ms-ratelimit-remaining-calls-per-second" : "165.85", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -207,7 +207,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v1", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "d25d1abb-b5e9-47d4-a756-53cf47054554" + "x-ms-client-request-id" : "ed1af17c-6d37-46d9-a184-9745b3d02d84" }, "Response" : { "content-length" : "396", @@ -216,9 +216,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "e2fd3714-4454-432a-a413-42208783f9b0", + "X-Ms-Correlation-Request-Id" : "9bc435b8-9f60-41ae-9069-375d1b55b92a", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"tag\":{\"name\":\"v1\",\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"createdTime\":\"2021-05-11T23:33:33.7829226Z\",\"lastUpdateTime\":\"2021-05-11T23:33:33.7829226Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -230,20 +230,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "3bd67411-ddad-45bc-a8c6-4fde26585077", + "x-ms-client-request-id" : "3edf2271-4061-4552-ac4d-ea3f66b50b9d", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "60a46680-4fee-4d75-bb2c-ea7b02efae6a", + "X-Ms-Correlation-Request-Id" : "5c214867-9462-4f6a-ab0a-9d1a40fed542", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.616667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.65", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -252,22 +252,22 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_manifests/sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "c020021d-5ec0-4a03-9ec1-236594c282d3", + "x-ms-client-request-id" : "7b6b7736-0d7a-47da-8c4b-65ff40b7a4ea", "Content-Type" : "application/json" }, "Response" : { - "content-length" : "1360", + "content-length" : "1355", "Server" : "openresty", "X-Content-Type-Options" : "nosniff", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "f1a196b7-b55e-4b3c-a672-aa2c318c39d5", + "X-Ms-Correlation-Request-Id" : "93f07137-9b19-4a83-a785-067d00301ee3", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"manifest\":{\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"imageSize\":3696,\"createdTime\":\"2021-05-11T23:33:32.7469627Z\",\"lastUpdateTime\":\"2021-05-11T23:33:32.7469627Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:ea73ecf48cd45e250f65eb731dd35808175ae37d70cca5d41f9ef57210737f04\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:9663906b1c3bf891618ebcac857961531357525b25493ef717bca0f86f581ad6\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:8f18fae117ec6e5777cc62ba78cbb3be10a8a38639ccfb949521abd95c8301a4\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:5de788243acadd50526e70868b86d12ad79f3793619719ae22e0d09e8c873a66\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:827525365ff718681b0688621e09912af49a17611701ee4d421ba50d57c13f7e\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:a090d7c93c8e9ab88946367500756c5f50cd660e09deb4c57494989c1f23fa5a\",\"architecture\":\"s390x\",\"os\":\"linux\"}]}}\n", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"manifest\":{\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"imageSize\":3696,\"createdTime\":\"2021-05-11T23:33:32.7469627Z\",\"lastUpdateTime\":\"2021-05-11T23:33:32.7469627Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:ea73ecf48cd45e250f65eb731dd35808175ae37d70cca5d41f9ef57210737f04\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:9663906b1c3bf891618ebcac857961531357525b25493ef717bca0f86f581ad6\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:8f18fae117ec6e5777cc62ba78cbb3be10a8a38639ccfb949521abd95c8301a4\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:5de788243acadd50526e70868b86d12ad79f3793619719ae22e0d09e8c873a66\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:827525365ff718681b0688621e09912af49a17611701ee4d421ba50d57c13f7e\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:a090d7c93c8e9ab88946367500756c5f50cd660e09deb4c57494989c1f23fa5a\",\"architecture\":\"s390x\",\"os\":\"linux\"}]}}\n", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -276,20 +276,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "80711aa9-e0e2-4e3b-b6f4-562a648fa641", + "x-ms-client-request-id" : "147dd24c-7c45-439b-b5a1-32b8704a7620", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "2a32ef19-d5fe-4b72-b7a2-77ab165a7486", + "X-Ms-Correlation-Request-Id" : "d96791e9-2c6d-49e7-8945-e68f6bc681a6", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.6", + "x-ms-ratelimit-remaining-calls-per-second" : "166.5", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:01 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -298,22 +298,22 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_manifests/sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "71cf385b-4b55-4233-b445-69b90207f01a", + "x-ms-client-request-id" : "94822bcc-ebe7-4a78-b736-e972eb8a4c1a", "Content-Type" : "application/json" }, "Response" : { - "content-length" : "1360", + "content-length" : "1355", "Server" : "openresty", "X-Content-Type-Options" : "nosniff", - "Connection" : "close", + "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:03 GMT", + "Date" : "Thu, 27 May 2021 17:50:00 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "193453f2-1c95-4dea-9c60-9b307c5a6459", + "X-Ms-Correlation-Request-Id" : "84624b09-6331-41da-8645-3a979dc3fd34", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"manifest\":{\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"imageSize\":3696,\"createdTime\":\"2021-05-11T23:33:32.7469627Z\",\"lastUpdateTime\":\"2021-05-11T23:33:32.7469627Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:ea73ecf48cd45e250f65eb731dd35808175ae37d70cca5d41f9ef57210737f04\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:9663906b1c3bf891618ebcac857961531357525b25493ef717bca0f86f581ad6\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:8f18fae117ec6e5777cc62ba78cbb3be10a8a38639ccfb949521abd95c8301a4\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:5de788243acadd50526e70868b86d12ad79f3793619719ae22e0d09e8c873a66\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:827525365ff718681b0688621e09912af49a17611701ee4d421ba50d57c13f7e\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:a090d7c93c8e9ab88946367500756c5f50cd660e09deb4c57494989c1f23fa5a\",\"architecture\":\"s390x\",\"os\":\"linux\"}]}}\n", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"manifest\":{\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"imageSize\":3696,\"createdTime\":\"2021-05-11T23:33:32.7469627Z\",\"lastUpdateTime\":\"2021-05-11T23:33:32.7469627Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:ea73ecf48cd45e250f65eb731dd35808175ae37d70cca5d41f9ef57210737f04\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:9663906b1c3bf891618ebcac857961531357525b25493ef717bca0f86f581ad6\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:8f18fae117ec6e5777cc62ba78cbb3be10a8a38639ccfb949521abd95c8301a4\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:5de788243acadd50526e70868b86d12ad79f3793619719ae22e0d09e8c873a66\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:827525365ff718681b0688621e09912af49a17611701ee4d421ba50d57c13f7e\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:a090d7c93c8e9ab88946367500756c5f50cd660e09deb4c57494989c1f23fa5a\",\"architecture\":\"s390x\",\"os\":\"linux\"}]}}\n", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -322,20 +322,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "31e6404f-178c-406e-8721-a4a82a26e2ab", + "x-ms-client-request-id" : "07f80f22-fe6d-46a4-b8a7-5f3cbe5a66b0", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "4699d317-cad3-4431-84c2-df01ca5976ce", + "X-Ms-Correlation-Request-Id" : "a0bfc5ec-5eb1-4381-b053-70a0ecba7211", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.033333", + "x-ms-ratelimit-remaining-calls-per-second" : "166.483333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:03 GMT", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -344,20 +344,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "7c614500-afdf-4e24-a9ac-148d52fc026b", + "x-ms-client-request-id" : "312b4d69-be47-483c-9eac-0ff59685acda", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "b285f6c7-3e97-4eb1-9557-553c1c64e013", + "X-Ms-Correlation-Request-Id" : "e0aca523-f8b7-4949-bae3-056d78dbd89b", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.483333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.566667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:03 GMT", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -366,7 +366,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v1", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "c0e20137-98ad-4455-901c-1449e64d9a18" + "x-ms-client-request-id" : "07f50a18-f7de-4815-9a2a-0b1ffce9a13d" }, "Response" : { "content-length" : "396", @@ -375,9 +375,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:03 GMT", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "422d9b9d-54d6-486f-9996-2029ccfd6070", + "X-Ms-Correlation-Request-Id" : "0b50cb64-af94-4ab9-b452-b36f34e7b76e", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"tag\":{\"name\":\"v1\",\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"createdTime\":\"2021-05-11T23:33:33.7829226Z\",\"lastUpdateTime\":\"2021-05-11T23:33:33.7829226Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -389,20 +389,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "0c03c541-fae6-49c2-b2fb-61e199cfcb3d", + "x-ms-client-request-id" : "d14e84ef-68c3-4f63-9cd5-f5910f84d1f7", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "05b8fcaa-43e6-4bd5-912e-db9d7cf46999", + "X-Ms-Correlation-Request-Id" : "bcc13516-1ba7-4dc1-9861-2f6cf45b43b0", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.1", + "x-ms-ratelimit-remaining-calls-per-second" : "164.616667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:33:03 GMT", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -411,22 +411,22 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_manifests/sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "c48ddf26-73ff-4f74-b943-9cb41d4d48e2", + "x-ms-client-request-id" : "bb016a5a-63a2-4bb8-9cb0-ef6c027ab685", "Content-Type" : "application/json" }, "Response" : { - "content-length" : "1359", + "content-length" : "1354", "Server" : "openresty", "X-Content-Type-Options" : "nosniff", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:33:04 GMT", + "Date" : "Thu, 27 May 2021 17:50:01 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "fa8770bf-aa44-4564-b71f-828ad4ad6c46", + "X-Ms-Correlation-Request-Id" : "4b2067a8-0def-4b69-882a-2677613be24a", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"manifest\":{\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"imageSize\":3696,\"createdTime\":\"2021-05-11T23:33:32.7469627Z\",\"lastUpdateTime\":\"2021-05-11T23:33:32.7469627Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v3\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:ea73ecf48cd45e250f65eb731dd35808175ae37d70cca5d41f9ef57210737f04\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:9663906b1c3bf891618ebcac857961531357525b25493ef717bca0f86f581ad6\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:8f18fae117ec6e5777cc62ba78cbb3be10a8a38639ccfb949521abd95c8301a4\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:5de788243acadd50526e70868b86d12ad79f3793619719ae22e0d09e8c873a66\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:827525365ff718681b0688621e09912af49a17611701ee4d421ba50d57c13f7e\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:a090d7c93c8e9ab88946367500756c5f50cd660e09deb4c57494989c1f23fa5a\",\"architecture\":\"s390x\",\"os\":\"linux\"}]}}\n", + "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"manifest\":{\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"imageSize\":3696,\"createdTime\":\"2021-05-11T23:33:32.7469627Z\",\"lastUpdateTime\":\"2021-05-11T23:33:32.7469627Z\",\"mediaType\":\"application/vnd.docker.distribution.manifest.list.v2+json\",\"tags\":[\"latest\",\"v1\",\"v2\",\"v4\"],\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true},\"references\":[{\"digest\":\"sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748\",\"architecture\":\"amd64\",\"os\":\"linux\"},{\"digest\":\"sha256:ea73ecf48cd45e250f65eb731dd35808175ae37d70cca5d41f9ef57210737f04\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:9663906b1c3bf891618ebcac857961531357525b25493ef717bca0f86f581ad6\",\"architecture\":\"arm\",\"os\":\"linux\"},{\"digest\":\"sha256:8f18fae117ec6e5777cc62ba78cbb3be10a8a38639ccfb949521abd95c8301a4\",\"architecture\":\"arm64\",\"os\":\"linux\"},{\"digest\":\"sha256:5de788243acadd50526e70868b86d12ad79f3793619719ae22e0d09e8c873a66\",\"architecture\":\"386\",\"os\":\"linux\"},{\"digest\":\"sha256:827525365ff718681b0688621e09912af49a17611701ee4d421ba50d57c13f7e\",\"architecture\":\"ppc64le\",\"os\":\"linux\"},{\"digest\":\"sha256:a090d7c93c8e9ab88946367500756c5f50cd660e09deb4c57494989c1f23fa5a\",\"architecture\":\"s390x\",\"os\":\"linux\"}]}}\n", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.updateTagProperties[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.updateTagProperties[1].json index e9d0802b11b5..7d3432f4bf0a 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.updateTagProperties[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/RegistryArtifactTests.updateTagProperties[1].json @@ -4,20 +4,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "146f11ad-64a2-4eab-8c54-4818d9175cd9", + "x-ms-client-request-id" : "eb2ee028-5e55-436e-9fd8-91155f46863e", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "c34b6495-6a73-4071-b006-498d77a7ec1d", + "X-Ms-Correlation-Request-Id" : "f1305441-ae31-47f3-aae1-32db6d377b1c", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.5", + "x-ms-ratelimit-remaining-calls-per-second" : "165.8", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:06 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -26,20 +26,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "1f1de5ac-6ae2-4921-8fe8-73809eb22566", + "x-ms-client-request-id" : "ee3f2132-2e91-4905-8d18-e49a32dbc9d6", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "778712ad-f7e4-4b90-8356-084e714b6006", + "X-Ms-Correlation-Request-Id" : "683627a1-d1e8-4d2e-8745-56dd8315564e", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.716667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.5", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:06 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -48,7 +48,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v2", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "ae773a99-63f2-4fca-9d0e-1376e8a33369", + "x-ms-client-request-id" : "dbf62c3b-dc8a-484a-b326-bd22f0e86657", "Content-Type" : "application/json" }, "Response" : { @@ -58,9 +58,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:06 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "ee61bc55-0b70-4e89-83e2-ca1a3d103a51", + "X-Ms-Correlation-Request-Id" : "01bca345-425d-4103-b648-3c1c0df56b5c", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"tag\":{\"name\":\"v2\",\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"createdTime\":\"2021-05-11T23:33:33.4763945Z\",\"lastUpdateTime\":\"2021-05-11T23:33:33.4763945Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -72,20 +72,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "23256184-f63f-48f1-9432-6d33a0740d04", + "x-ms-client-request-id" : "cd09f796-c5c6-45fd-b455-1e856a21869d", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "93831263-2b96-463d-ad5d-c2c1cd7d9aae", + "X-Ms-Correlation-Request-Id" : "67bd1ae9-b065-4323-887e-285b7e3f4a8f", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.983333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.45", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:17 GMT", + "Date" : "Thu, 27 May 2021 17:50:06 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -94,7 +94,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v2", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "b0d5497d-6025-4455-a89a-773a551f85d6", + "x-ms-client-request-id" : "734cd963-1b06-477e-85c1-d984b3da082f", "Content-Type" : "application/json" }, "Response" : { @@ -104,9 +104,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:18 GMT", + "Date" : "Thu, 27 May 2021 17:50:06 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "825ace49-c186-4d5e-995c-645e2059ce96", + "X-Ms-Correlation-Request-Id" : "11062df5-4dd5-4362-986b-495c5ece9622", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"tag\":{\"name\":\"v2\",\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"createdTime\":\"2021-05-11T23:33:33.4763945Z\",\"lastUpdateTime\":\"2021-05-11T23:33:33.4763945Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -118,20 +118,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "4f491f46-79b6-4aef-87f9-108c098c7d46", + "x-ms-client-request-id" : "ca7f4737-772c-4b5b-babb-2510a401062c", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "ff5f01c2-eea5-42fc-8ff3-6004c73b1940", + "X-Ms-Correlation-Request-Id" : "a65a8db9-e8a7-4993-8f6d-ab398842c935", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "165.05", + "x-ms-ratelimit-remaining-calls-per-second" : "164.683333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:18 GMT", + "Date" : "Thu, 27 May 2021 17:50:06 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -140,20 +140,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "48eb69b0-5670-4390-858d-5cb67870ebdb", + "x-ms-client-request-id" : "d56d6821-7011-459a-975f-28d34647c8dc", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "b223bf21-6b4e-4ef5-a5d8-f0f08aa3bd73", + "X-Ms-Correlation-Request-Id" : "447e847a-a040-4571-911c-49a75690344d", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "166.2", + "x-ms-ratelimit-remaining-calls-per-second" : "164.483333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:18 GMT", + "Date" : "Thu, 27 May 2021 17:50:06 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -162,7 +162,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v2", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "51daa7e6-a7c6-44c4-b90d-c9f4da000eb2", + "x-ms-client-request-id" : "9e130473-24d5-45e1-b62f-0b2f0ac7228a", "Content-Type" : "application/json" }, "Response" : { @@ -172,9 +172,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:07 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "40397700-b0af-449b-ba1f-be1a2a8a30ed", + "X-Ms-Correlation-Request-Id" : "02d8f9dc-7ef0-4008-a263-45154f472e2c", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"tag\":{\"name\":\"v2\",\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"createdTime\":\"2021-05-11T23:33:33.4763945Z\",\"lastUpdateTime\":\"2021-05-11T23:33:33.4763945Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -186,20 +186,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "b8ec20e7-b31a-40e8-894f-a04325fb62f0", + "x-ms-client-request-id" : "091a02d9-0419-4424-9a97-8c2b4b7920f4", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "777df7e9-3d4e-4a3b-b903-083a93229b5e", + "X-Ms-Correlation-Request-Id" : "ed475432-1020-4f43-a89a-8f4042530a65", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.716667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.383333", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:55 GMT", + "Date" : "Thu, 27 May 2021 17:50:07 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -208,7 +208,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v2", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "1b76da65-0e03-4510-83a1-f12a3471ea54", + "x-ms-client-request-id" : "fe11f774-414e-4475-b65d-98de3a529859", "Content-Type" : "application/json" }, "Response" : { @@ -218,9 +218,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:56 GMT", + "Date" : "Thu, 27 May 2021 17:50:07 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "68778256-1960-4358-96f2-a4f54340567c", + "X-Ms-Correlation-Request-Id" : "4d89fc6a-7457-46e6-81ce-0c810216360b", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"tag\":{\"name\":\"v2\",\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"createdTime\":\"2021-05-11T23:33:33.4763945Z\",\"lastUpdateTime\":\"2021-05-11T23:33:33.4763945Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":false,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", @@ -232,20 +232,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "a163038f-ec08-4016-939a-c6be662d215f", + "x-ms-client-request-id" : "793af9a0-d623-49dd-ad69-80f82ec579f4", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "73805006-35ee-41c9-930b-d34223e14367", + "X-Ms-Correlation-Request-Id" : "d913faad-aa25-4b21-8523-4e2e7aa6fa83", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "163.316667", + "x-ms-ratelimit-remaining-calls-per-second" : "164.666667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:56 GMT", + "Date" : "Thu, 27 May 2021 17:50:07 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -254,20 +254,20 @@ "Uri" : "https://REDACTED.azurecr.io/oauth2/token", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "e56d4673-88fe-4f4e-8e96-192b3a601e67", + "x-ms-client-request-id" : "064f1fa5-d261-41f3-8dd4-6d44d2463e21", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "8a4bb1c0-1ef4-40fd-a559-b39e7eb46bb5", + "X-Ms-Correlation-Request-Id" : "b7ce5031-8d88-43fd-b90e-bfa0b268aa19", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", "Connection" : "keep-alive", - "x-ms-ratelimit-remaining-calls-per-second" : "164.433333", + "x-ms-ratelimit-remaining-calls-per-second" : "164.466667", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Wed, 19 May 2021 23:32:56 GMT", + "Date" : "Thu, 27 May 2021 17:50:07 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -276,7 +276,7 @@ "Uri" : "https://REDACTED.azurecr.io/acr/v1/library%2Falpine/_tags/v2", "Headers" : { "User-Agent" : "azsdk-java-UnknownName/UnknownVersion (11.0.10; Windows 10; 10.0)", - "x-ms-client-request-id" : "14c72f86-20c2-4055-ab2f-bb078fb9d0ca", + "x-ms-client-request-id" : "91cdb523-9c27-4d69-926d-98a8e62e7ba5", "Content-Type" : "application/json" }, "Response" : { @@ -286,9 +286,9 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Wed, 19 May 2021 23:32:56 GMT", + "Date" : "Thu, 27 May 2021 17:50:07 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "20d1ddd5-f868-46aa-9f35-261b6ca75ff4", + "X-Ms-Correlation-Request-Id" : "83a6b972-b966-4085-a206-ee04e074eb1c", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Body" : "{\"registry\":\"pallavitcontainerregistry.azurecr.io\",\"imageName\":\"library/alpine\",\"tag\":{\"name\":\"v2\",\"digest\":\"sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f\",\"createdTime\":\"2021-05-11T23:33:33.4763945Z\",\"lastUpdateTime\":\"2021-05-11T23:33:33.4763945Z\",\"signed\":false,\"changeableAttributes\":{\"deleteEnabled\":true,\"writeEnabled\":true,\"readEnabled\":true,\"listEnabled\":true}}}\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/swagger/autorest.md b/sdk/containerregistry/azure-containers-containerregistry/swagger/autorest.md index e55dbfc20853..b5d468af7e18 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/swagger/autorest.md +++ b/sdk/containerregistry/azure-containers-containerregistry/swagger/autorest.md @@ -29,7 +29,7 @@ autorest --java --use:@autorest/java@4.0.x ### Code generation settings ``` yaml -input-file: containerregistry.json +input-file: https://github.com/Azure/azure-rest-api-specs/blob/5bcf8b9ce0d230830b172c2d9753cbbb4abf325b/specification/containerregistry/data-plane/Azure.ContainerRegistry/preview/2019-08-15-preview/containerregistry.json java: true output-folder: ./.. generate-client-as-impl: true @@ -40,7 +40,7 @@ add-context-parameter: true context-client-method-parameter: true service-interface-as-public: true models-subpackage: implementation.models -custom-types: ManifestOrderBy,TagOrderBy,ArtifactArchitecture,ArtifactOperatingSystem,ArtifactManifestReference,RepositoryProperties +custom-types: ArtifactManifestOrderBy,ArtifactTagOrderBy,ArtifactArchitecture,ArtifactOperatingSystem,ArtifactManifestPlatform,RepositoryProperties custom-types-subpackage: models ``` @@ -118,20 +118,20 @@ directive: $["properties"]["tag"].readOnly = true; ``` -### Set modelAsString flag for the enum values of TagOrderBy +### Set modelAsString flag for the enum values of ArtifactTagOrderBy ```yaml directive: - from: swagger-document - where: $.definitions.TagOrderBy + where: $.definitions.ArtifactTagOrderBy transform: > $["x-ms-enum"].modelAsString = true; ``` -### Set modelAsString flag for the enum values of ManifestOrderBy +### Set modelAsString flag for the enum values of ArtifactManifestOrderBy ```yaml directive: - from: swagger-document - where: $.definitions.ManifestOrderBy + where: $.definitions.ArtifactManifestOrderBy transform: > $["x-ms-enum"].modelAsString = true; ``` diff --git a/sdk/containerregistry/azure-containers-containerregistry/swagger/containerregistry.json b/sdk/containerregistry/azure-containers-containerregistry/swagger/containerregistry.json deleted file mode 100644 index e23aabd88b38..000000000000 --- a/sdk/containerregistry/azure-containers-containerregistry/swagger/containerregistry.json +++ /dev/null @@ -1,3093 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Container Registry", - "description": "Metadata API definition for the Azure Container Registry runtime", - "version": "2019-08-15-preview" - }, - "x-ms-parameterized-host": { - "hostTemplate": "{url}", - "useSchemePrefix": false, - "positionInOperation": "first", - "parameters": [ - { - "$ref": "#/parameters/Url" - } - ] - }, - "securityDefinitions": { - "registry_auth": { - "type": "basic" - }, - "registry_oauth2": { - "type": "apiKey", - "in": "header", - "name": "Authorization" - } - }, - "security": [ - { - "registry_auth": [], - "registry_oauth2": [] - } - ], - "tags": [ - { - "name": "ContainerRegistry", - "description": "Registry Operations" - }, - { - "name": "ContainerRegistryBlob", - "description": "Blob Operations" - } - ], - "schemes": [ - "https" - ], - "produces": [ - "application/json" - ], - "paths": { - "/v2/": { - "get": { - "tags": [ - "Registry" - ], - "description": "Tells whether this Docker Registry instance supports Docker Registry HTTP API v2", - "operationId": "ContainerRegistry_CheckDockerV2Support", - "x-ms-examples": { - "Check Docker Registry V2 Support": { - "$ref": "./examples/GetDockerRegistryV2Support.json" - } - }, - "responses": { - "200": { - "description": "Successful response. API v2 supported" - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - } - }, - "/v2/{name}/manifests/{reference}": { - "get": { - "tags": [ - "Repository" - ], - "description": "Get the manifest identified by `name` and `reference` where `reference` can be a tag or digest.", - "x-ms-examples": { - "Get manifest": { - "$ref": "./examples/GetManifest.json" - } - }, - "operationId": "ContainerRegistry_GetManifest", - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/ImageReference" - }, - { - "name": "accept", - "in": "header", - "description": "Accept header string delimited by comma. For example, application/vnd.docker.distribution.manifest.v2+json", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Returns the requested manifest file in a larger combined group", - "schema": { - "$ref": "#/definitions/Manifest" - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - }, - "put": { - "tags": [ - "Repository" - ], - "x-ms-long-running-operation": false, - "description": "Put the manifest identified by `name` and `reference` where `reference` can be a tag or digest.", - "x-ms-examples": { - "Put manifest": { - "$ref": "./examples/CreateManifest.json" - } - }, - "consumes": [ - "application/vnd.docker.distribution.manifest.v2+json" - ], - "operationId": "ContainerRegistry_CreateManifest", - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/ImageReference" - }, - { - "$ref": "#/parameters/ManifestBody" - } - ], - "responses": { - "201": { - "description": "The manifest is updated", - "schema": {}, - "headers": { - "Docker-Content-Digest": { - "type": "string", - "description": "Identifies the docker upload uuid for the current request." - }, - "Location": { - "type": "string", - "description": "The canonical location url of the uploaded manifest." - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The length of the requested blob content." - } - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - }, - "delete": { - "tags": [ - "Repository" - ], - "description": "Delete the manifest identified by `name` and `reference`. Note that a manifest can _only_ be deleted by `digest`.", - "x-ms-examples": { - "Delete manifest": { - "$ref": "./examples/DeleteManifest.json" - } - }, - "operationId": "ContainerRegistry_DeleteManifest", - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/DigestReference" - } - ], - "responses": { - "202": { - "description": "The manifest has been deleted" - }, - "404": { - "description": "The manifest was not found" - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - } - }, - "/v2/{name}/blobs/{digest}": { - "get": { - "produces": [ - "application/octet-stream" - ], - "tags": [ - "ContainerRegistryBlob" - ], - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/Digest" - } - ], - "x-ms-examples": { - "Get a blob from digest": { - "$ref": "./examples/GetBlob.json" - } - }, - "description": "Retrieve the blob from the registry identified by digest.", - "operationId": "ContainerRegistryBlob_GetBlob", - "responses": { - "200": { - "description": "The blob identified by digest is available. The blob content will be present in the body of the response.", - "schema": { - "description": "blob binary data", - "type": "file", - "format": "file" - }, - "headers": { - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The length of the requested blob content." - }, - "Docker-Content-Digest": { - "description": "Digest of the targeted content for the request.", - "type": "string" - } - } - }, - "307": { - "description": "The blob identified by digest is available at the provided location.", - "headers": { - "Location": { - "type": "string", - "description": "The location where the layer should be accessible." - } - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - }, - "head": { - "tags": [ - "ContainerRegistryBlob" - ], - "description": "Same as GET, except only the headers are returned.", - "operationId": "ContainerRegistryBlob_CheckBlobExists", - "x-ms-examples": { - "Head for a Blob Chunk": { - "$ref": "./examples/CheckBlob.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/Digest" - } - ], - "responses": { - "200": { - "description": "The blob identified by digest is available. The blob content will be present in the body of the response.", - "headers": { - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The length of the requested blob content." - }, - "Docker-Content-Digest": { - "description": "Digest of the targeted content for the request.", - "type": "string" - } - } - }, - "307": { - "description": "The blob identified by digest is available at the provided location.", - "headers": { - "Location": { - "type": "string", - "description": "The location where the layer should be accessible." - } - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - }, - "delete": { - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/Digest" - } - ], - "description": "Removes an already uploaded blob.", - "produces": [ - "application/octet-stream" - ], - "tags": [ - "ContainerRegistryBlob" - ], - "operationId": "ContainerRegistryBlob_DeleteBlob", - "x-ms-examples": { - "Delete a blob": { - "$ref": "./examples/DeleteBlob.json" - } - }, - "responses": { - "202": { - "description": "The blob identified by digest is available. The blob content will be present in the body of the response.", - "schema": { - "description": "blob binary data", - "type": "file", - "format": "file" - }, - "headers": { - "Docker-Content-Digest": { - "description": "Digest of the targeted content for the request.", - "type": "string" - } - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - } - }, - "/v2/{name}/blobs/uploads/": { - "post": { - "tags": [ - "ContainerRegistryBlob" - ], - "description": "Mount a blob identified by the `mount` parameter from another repository.", - "operationId": "ContainerRegistryBlob_MountBlob", - "x-ms-examples": { - "Mount a blob from repository": { - "$ref": "./examples/MountBlob.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/From" - }, - { - "$ref": "#/parameters/Mount" - } - ], - "responses": { - "201": { - "description": "The blob has been created in the registry and is available at the provided location.", - "headers": { - "Location": { - "description": "Provided location for blob", - "type": "string" - }, - "Docker-Upload-UUID": { - "description": "Identifies the docker upload uuid for the current request.", - "type": "string" - }, - "Docker-Content-Digest": { - "description": "Digest of the targeted content for the request.", - "type": "string" - } - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - } - }, - "/{nextBlobUuidLink}": { - "get": { - "tags": [ - "ContainerRegistryBlob" - ], - "parameters": [ - { - "$ref": "#/parameters/NextLink" - } - ], - "description": "Retrieve status of upload identified by uuid. The primary purpose of this endpoint is to resolve the current status of a resumable upload.", - "operationId": "ContainerRegistryBlob_GetUploadStatus", - "x-ms-examples": { - "Get blob status": { - "$ref": "./examples/GetBlobStatus.json" - } - }, - "responses": { - "204": { - "description": "The upload is known and in progress. The last received offset is available in the Range header.", - "headers": { - "Range": { - "description": "Range indicating the current progress of the upload.", - "type": "string" - }, - "Docker-Upload-UUID": { - "description": "Identifies the docker upload uuid for the current request.", - "type": "string" - } - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - }, - "patch": { - "security": [ - { - "registry_auth": [], - "registry_oauth2": [] - } - ], - "tags": [ - "ContainerRegistryBlob" - ], - "description": "Upload a stream of data without completing the upload.", - "operationId": "ContainerRegistryBlob_UploadChunk", - "x-ms-examples": { - "Upload Blob": { - "$ref": "./examples/UploadBlob.json" - } - }, - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/RawData" - }, - { - "$ref": "#/parameters/NextLink" - } - ], - "responses": { - "202": { - "description": "The stream of data has been accepted and the current progress is available in the range header. The updated upload location is available in the Location header.", - "headers": { - "Location": { - "description": "Provided location for blob", - "type": "string" - }, - "Range": { - "description": "Range indicating the current progress of the upload.", - "type": "string" - }, - "Docker-Upload-UUID": { - "description": "Identifies the docker upload uuid for the current request.", - "type": "string" - } - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - }, - "put": { - "tags": [ - "ContainerRegistryBlob" - ], - "consumes": [ - "application/octet-stream" - ], - "description": "Complete the upload, providing all the data in the body, if necessary. A request without a body will just complete the upload with previously uploaded content.", - "operationId": "ContainerRegistryBlob_CompleteUpload", - "x-ms-examples": { - "End a blob upload": { - "$ref": "./examples/EndBlobUpload.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/BlobQueryDigest" - }, - { - "$ref": "#/parameters/RawDataOptional" - }, - { - "$ref": "#/parameters/NextLink" - } - ], - "responses": { - "201": { - "description": "The upload has been completed and accepted by the registry.", - "headers": { - "Location": { - "description": "Provided location for blob", - "type": "string" - }, - "Range": { - "description": "Range indicating the current progress of the upload.", - "type": "string" - }, - "Docker-Content-Digest": { - "description": "Digest of the targeted content for the request.", - "type": "string" - } - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - }, - "delete": { - "tags": [ - "ContainerRegistryBlob" - ], - "parameters": [ - { - "$ref": "#/parameters/NextLink" - } - ], - "description": "Cancel outstanding upload processes, releasing associated resources. If this is not called, the unfinished uploads will eventually timeout.", - "operationId": "ContainerRegistryBlob_CancelUpload", - "x-ms-examples": { - "End a blob upload": { - "$ref": "./examples/CancelBlobUpload.json" - } - }, - "responses": { - "204": { - "description": "The upload has been successfully deleted." - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - } - }, - "/acr/v1/_catalog": { - "get": { - "tags": [ - "Registry" - ], - "description": "List repositories", - "operationId": "ContainerRegistry_GetRepositories", - "x-ms-pageable": { - "itemName": "repositories", - "nextLinkName": "link" - }, - "x-ms-examples": { - "Get repositories in a registry": { - "$ref": "./examples/GetRepositoryList.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/QueryLast" - }, - { - "$ref": "#/parameters/QueryNum" - } - ], - "responses": { - "200": { - "headers": { - "Link": { - "description": "next paginated result", - "type": "string" - } - }, - "description": "Returns a list of repositories", - "schema": { - "$ref": "#/definitions/Repositories" - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - } - }, - "/acr/v1/{name}": { - "get": { - "tags": [ - "Registry" - ], - "description": "Get repository attributes", - "operationId": "ContainerRegistry_GetProperties", - "x-ms-examples": { - "Get details of repository": { - "$ref": "./examples/GetRepositoryAttributes.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ImageName" - } - ], - "responses": { - "200": { - "description": "Returns a list of attributes", - "schema": { - "$ref": "#/definitions/RepositoryAttributes" - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - }, - "delete": { - "tags": [ - "Registry" - ], - "description": "Delete the repository identified by `name`", - "operationId": "ContainerRegistry_DeleteRepository", - "x-ms-examples": { - "Delete a repository": { - "$ref": "./examples/DeleteAcrRepository.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ImageName" - } - ], - "responses": { - "202": { - "description": "The repository is deleted" - }, - "404": { - "description": "The repository is not found." - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - }, - "patch": { - "tags": [ - "Registry" - ], - "description": "Update the attribute identified by `name` where `reference` is the name of the repository.", - "operationId": "ContainerRegistry_SetProperties", - "x-ms-examples": { - "Update repository attributes": { - "$ref": "./examples/UpdateRepositoryAttributes.json" - } - }, - "consumes": [ - "application/json" - ], - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/RepositoryAttributeValue" - } - ], - "responses": { - "200": { - "description": "The attributes are updated", - "schema": { - "$ref": "#/definitions/RepositoryAttributes" - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - } - }, - "/acr/v1/{name}/_tags": { - "get": { - "tags": [ - "Repository" - ], - "description": "List tags of a repository", - "operationId": "ContainerRegistry_GetTags", - "x-ms-examples": { - "Get tags of a repository": { - "$ref": "./examples/GetTagList.json" - } - }, - "x-ms-pageable": { - "itemName": "tags", - "nextLinkName": "link" - }, - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/QueryLast" - }, - { - "$ref": "#/parameters/QueryNum" - }, - { - "$ref": "#/parameters/QueryOrderBy" - }, - { - "$ref": "#/parameters/QueryDigest" - } - ], - "responses": { - "200": { - "headers": { - "Link": { - "description": "next paginated result", - "type": "string" - } - }, - "description": "Tag details of a repository", - "schema": { - "$ref": "#/definitions/TagList" - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - } - }, - "/acr/v1/{name}/_tags/{reference}": { - "get": { - "tags": [ - "Repository" - ], - "description": "Get tag attributes by tag", - "operationId": "ContainerRegistry_GetTagProperties", - "x-ms-examples": { - "Get tag attributes": { - "$ref": "./examples/GetTagAttributes.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/TagReference" - } - ], - "responses": { - "200": { - "description": "Tag attributes", - "schema": { - "$ref": "#/definitions/TagAttributes" - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - }, - "patch": { - "tags": [ - "Repository" - ], - "description": "Update tag attributes", - "operationId": "ContainerRegistry_UpdateTagAttributes", - "consumes": [ - "application/json" - ], - "x-ms-examples": { - "Update attributes of a tag": { - "$ref": "./examples/UpdateTagAttributes.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/TagReference" - }, - { - "$ref": "#/parameters/TagAttributeValue" - } - ], - "responses": { - "200": { - "description": "The attributes are updated", - "schema": { - "$ref": "#/definitions/TagAttributes" - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - }, - "delete": { - "tags": [ - "Repository" - ], - "description": "Delete tag", - "operationId": "ContainerRegistry_DeleteTag", - "consumes": [ - "application/json" - ], - "x-ms-examples": { - "Delete a tag": { - "$ref": "./examples/DeleteTag.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/TagReference" - } - ], - "responses": { - "202": { - "description": "The tag is deleted" - }, - "404": { - "description": "The tag was not found" - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - } - }, - "/acr/v1/{name}/_manifests": { - "get": { - "tags": [ - "Repository" - ], - "description": "List manifests of a repository", - "operationId": "ContainerRegistry_GetManifests", - "x-ms-examples": { - "Get list of available manifests": { - "$ref": "./examples/GetManifestList.json" - } - }, - "x-ms-pageable": { - "itemName": "manifests", - "nextLinkName": "link" - }, - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/QueryLast" - }, - { - "$ref": "#/parameters/QueryNum" - }, - { - "$ref": "#/parameters/QueryOrderBy" - } - ], - "responses": { - "200": { - "headers": { - "Link": { - "description": "next paginated result", - "type": "string" - } - }, - "description": "Returns a list of manifests", - "schema": { - "$ref": "#/definitions/AcrManifests" - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - } - }, - "/acr/v1/{name}/_manifests/{digest}": { - "get": { - "tags": [ - "Repository" - ], - "description": "Get manifest attributes", - "operationId": "ContainerRegistry_GetManifestProperties", - "x-ms-examples": { - "Get manifest attributes": { - "$ref": "./examples/GetManifestAttributes.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/Digest" - } - ], - "responses": { - "200": { - "description": "List of attributes", - "schema": { - "$ref": "#/definitions/ManifestAttributes" - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - }, - "patch": { - "tags": [ - "Repository" - ], - "description": "Update properties of a manifest", - "operationId": "ContainerRegistry_UpdateManifestProperties", - "consumes": [ - "application/json" - ], - "x-ms-examples": { - "Update attributes of a manifest": { - "$ref": "./examples/UpdateManifestAttributes.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/Digest" - }, - { - "$ref": "#/parameters/ManifestAttributeValue" - } - ], - "responses": { - "200": { - "description": "The attributes are updated", - "schema": { - "$ref": "#/definitions/ManifestAttributes" - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - } - }, - "/oauth2/exchange": { - "post": { - "tags": [ - "AcrToken", - "RefreshToken" - ], - "description": "Exchange AAD tokens for an ACR refresh Token", - "operationId": "Authentication_ExchangeAadAccessTokenForAcrRefreshToken", - "consumes": [ - "application/x-www-form-urlencoded" - ], - "parameters": [ - { - "$ref": "#/parameters/Grant_type" - }, - { - "$ref": "#/parameters/Service" - }, - { - "$ref": "#/parameters/AccessToken" - } - ], - "responses": { - "200": { - "description": "ACR refresh token acquired", - "schema": { - "$ref": "#/definitions/RefreshToken" - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - }, - "security": [], - "x-ms-examples": { - "Exchange AAD Token for ACR Refresh": { - "$ref": "./examples/PostRefreshToken.json" - } - } - } - }, - "/oauth2/token": { - "post": { - "tags": [ - "AcrToken", - "AccessToken" - ], - "description": "Exchange ACR Refresh token for an ACR Access Token", - "operationId": "Authentication_ExchangeAcrRefreshTokenForAcrAccessToken", - "consumes": [ - "application/x-www-form-urlencoded" - ], - "parameters": [ - { - "$ref": "#/parameters/Service" - }, - { - "name": "scope", - "in": "formData", - "required": true, - "description": "Which is expected to be a valid scope, and can be specified more than once for multiple scope requests. You obtained this from the Www-Authenticate response header from the challenge.", - "type": "string" - }, - { - "name": "refresh_token", - "x-ms-client-name": "acrRefreshToken", - "in": "formData", - "required": true, - "description": "Must be a valid ACR refresh token", - "type": "string" - }, - { - "name": "grant_type", - "in": "formData", - "description": "Grant type is expected to be refresh_token", - "required": true, - "type": "string", - "enum": [ - "refresh_token", - "password" - ], - "x-ms-enum": { - "name": "TokenGrantType" - }, - "x-accessibility" : "internal", - "x-ms-client-default": "refresh_token" - } - ], - "responses": { - "200": { - "description": "ACR access token acquired", - "schema": { - "$ref": "#/definitions/AccessToken" - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - }, - "security": [], - "x-ms-examples": { - "Get Access Token with Refresh Token": { - "$ref": "./examples/PostAccessToken.json" - } - } - } - } - }, - "x-ms-paths": { - "/v2/{name}/blobs/uploads/?mode=resumable": { - "post": { - "tags": [ - "ContainerRegistryBlob" - ], - "description": "Initiate a resumable blob upload with an empty request body.", - "operationId": "ContainerRegistryBlob_StartUpload", - "x-ms-examples": { - "Start a blob upload": { - "$ref": "./examples/StartBlobUpload.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ImageName" - } - ], - "responses": { - "202": { - "description": "The upload has been created. The Location header must be used to complete the upload. The response should be identical to a GET request on the contents of the returned Location header.", - "headers": { - "Location": { - "description": "Provided location for blob", - "type": "string" - }, - "Range": { - "description": "Range indicating the current progress of the upload.", - "type": "string" - }, - "Docker-Upload-UUID": { - "description": "Identifies the docker upload uuid for the current request.", - "type": "string" - } - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - } - }, - "/v2/{name}/blobs/{digest}?mode=chunk": { - "get": { - "produces": [ - "application/octet-stream" - ], - "tags": [ - "ContainerRegistryBlob" - ], - "description": "Retrieve the blob from the registry identified by `digest`. This endpoint may also support RFC7233 compliant range requests. Support can be detected by issuing a HEAD request. If the header `Accept-Range: bytes` is returned, range requests can be used to fetch partial content.", - "operationId": "ContainerRegistryBlob_GetChunk", - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/Digest" - }, - { - "$ref": "#/parameters/Range" - } - ], - "x-ms-examples": { - "Get a blob Chunk": { - "$ref": "./examples/GetBlobChunk.json" - } - }, - "responses": { - "206": { - "description": "The blob identified by digest is available. The specified chunk of blob content will be present in the body of the request.", - "schema": { - "description": "blob binary data", - "type": "file", - "format": "file" - }, - "headers": { - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The length of the requested blob content." - }, - "Content-Range": { - "type": "string", - "description": "Content range of blob chunk." - } - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - }, - "head": { - "tags": [ - "ContainerRegistryBlob" - ], - "parameters": [ - { - "$ref": "#/parameters/ImageName" - }, - { - "$ref": "#/parameters/Digest" - }, - { - "$ref": "#/parameters/Range" - } - ], - "description": "Same as GET, except only the headers are returned.", - "operationId": "ContainerRegistryBlob_CheckChunkExists", - "x-ms-examples": { - "Get headers without blob Chunk": { - "$ref": "./examples/CheckBlobChunk.json" - } - }, - "responses": { - "200": { - "description": "The blob identified by digest is available. The specified chunk of blob content will be present in the body of the request.", - "headers": { - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The length of the requested blob content." - }, - "Content-Range": { - "type": "string", - "description": "Content range of blob chunk." - } - } - }, - "default": { - "description": "ACR error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/AcrErrors" - } - } - } - } - } - }, - "definitions": { - "RepositoryAttributes": { - "required": [ - "registry", - "imageName", - "createdTime", - "lastUpdateTime", - "manifestCount", - "tagCount", - "changeableAttributes" - ], - "x-ms-client-name": "RepositoryProperties", - "type": "object", - "description": "Repository attributes", - "properties": { - "registry": { - "type": "string", - "readOnly": true, - "description": "Registry login server name. This is likely to be similar to {registry-name}.azurecr.io", - "x-ms-client-name": "registryLoginServer" - }, - "imageName": { - "type": "string", - "readOnly": true, - "description": "Image name", - "x-ms-client-name": "name" - }, - "createdTime": { - "type": "string", - "readOnly": true, - "format": "date-time", - "description": "Image created time", - "x-ms-client-name": "createdOn" - }, - "lastUpdateTime": { - "type": "string", - "readOnly": true, - "format": "date-time", - "description": "Image last update time", - "x-ms-client-name": "lastUpdatedOn" - }, - "manifestCount": { - "type": "integer", - "readOnly": true, - "description": "Number of the manifests" - }, - "tagCount": { - "type": "integer", - "readOnly": true, - "description": "Number of the tags" - }, - "changeableAttributes": { - "description": "Writeable properties of the resource", - "$ref": "#/definitions/RepositoryChangeableAttributes", - "x-ms-client-flatten": true - } - }, - "example": { - "registry": "registryname.azurecr.io", - "changeableAttributes": { - "readEnabled": true, - "listEnabled": true, - "deleteEnabled": true, - "writeEnabled": true - }, - "imageName": "imageName", - "createdTime": "2018-09-07T16:30:46.6583219Z", - "tagCount": 6, - "manifestCount": 2, - "lastUpdateTime": "2018-09-07T16:30:46.6583219Z" - } - }, - "TagList": { - "required": [ - "registry", - "imageName", - "tags" - ], - "description": "List of tag details", - "x-accessibility": "internal", - "properties": { - "registry": { - "type": "string", - "description": "Registry login server name. This is likely to be similar to {registry-name}.azurecr.io", - "x-ms-client-name": "RegistryLoginServer" - }, - "imageName": { - "type": "string", - "description": "Image name", - "x-ms-client-name": "repository" - }, - "tags": { - "type": "array", - "description": "List of tag attribute details", - "x-ms-client-name": "TagAttributeBases", - "x-accessibility": "internal", - "items": { - "$ref": "#/definitions/TagAttributesBase" - } - }, - "link": { - "type": "string" - } - }, - "example": { - "registry": "registry", - "imageName": "imageName", - "tags": [ - { - "changeableAttributes": { - "readEnabled": true, - "listEnabled": true, - "deleteEnabled": true, - "writeEnabled": true - }, - "name": "name", - "digest": "digest", - "createdTime": "createdTime", - "signed": true, - "lastUpdateTime": "lastUpdateTime" - }, - { - "changeableAttributes": { - "readEnabled": true, - "listEnabled": true, - "deleteEnabled": true, - "writeEnabled": true - }, - "name": "name", - "digest": "digest", - "createdTime": "createdTime", - "signed": true, - "lastUpdateTime": "lastUpdateTime" - } - ] - } - }, - "TagAttributes": { - "required": [ - "registry", - "imageName", - "tag" - ], - "x-ms-client-name": "ArtifactTagProperties", - "description": "Tag attributes", - "properties": { - "registry": { - "type": "string", - "readOnly": true, - "description": "Registry login server name. This is likely to be similar to {registry-name}.azurecr.io", - "x-ms-client-name": "registryLoginServer" - }, - "imageName": { - "type": "string", - "readOnly": true, - "description": "Image name", - "x-ms-client-name": "repositoryName" - }, - "tag": { - "x-ms-client-flatten": true, - "description": "List of tag attribute details", - "readOnly": true, - "$ref": "#/definitions/TagAttributesBase" - } - }, - "example": { - "registry": "registry", - "imageName": "imageName", - "tag": { - "changeableAttributes": { - "readEnabled": true, - "listEnabled": true, - "deleteEnabled": true, - "writeEnabled": true - }, - "name": "name", - "digest": "digest", - "createdTime": "createdTime", - "signed": true, - "lastUpdateTime": "lastUpdateTime" - } - } - }, - "TagAttributesBase": { - "required": [ - "name", - "digest", - "createdTime", - "lastUpdateTime", - "changeableAttributes" - ], - "description": "Tag attribute details", - "x-accessibility": "internal", - "properties": { - "name": { - "type": "string", - "readOnly": true, - "description": "Tag name" - }, - "digest": { - "type": "string", - "readOnly": true, - "description": "Tag digest" - }, - "createdTime": { - "type": "string", - "readOnly": true, - "format": "date-time", - "description": "Tag created time", - "x-ms-client-name": "createdOn" - }, - "lastUpdateTime": { - "type": "string", - "readOnly": true, - "format": "date-time", - "description": "Tag last update time", - "x-ms-client-name": "lastUpdatedOn" - }, - "changeableAttributes": { - "$ref": "#/definitions/TagChangeableAttributes", - "description": "Writeable properties of the resource", - "x-ms-client-flatten": true - } - }, - "example": { - "changeableAttributes": { - "readEnabled": true, - "listEnabled": true, - "deleteEnabled": true, - "writeEnabled": true - }, - "name": "tagname", - "digest": "sha256:0873c923e00e0fd2ba78041bfb64a105e1ecb7678916d1f7776311e45bf5634b", - "createdTime": "2018-08-10T17:28:44.1082945Z", - "signed": true, - "lastUpdateTime": "2018-08-10T17:28:44.1082945Z" - } - }, - "TagOrderBy": { - "type": "string", - "enum": [ - "none", - "timedesc", - "timeasc" - ], - "x-ms-enum": { - "name": "TagOrderBy", - "values": [ - { - "value": "none", - "name": "None", - "description": "Do not provide an orderby value in the request." - }, - { - "value": "timedesc", - "name": "LastUpdatedOnDescending", - "description": "Order tags by LastUpdatedOn field, from most recently updated to least recently updated." - }, - { - "value": "timeasc", - "name": "LastUpdatedOnAscending", - "description": "Order tags by LastUpdatedOn field, from least recently updated to most recently updated." - } - ] - }, - "x-accessibility": "public" -}, -"ArtifactArchitecture": { - "type": "string", - "enum": [ - "386", - "amd64", - "arm", - "arm64", - "mips", - "mipsle", - "mips64", - "mips64le", - "ppc64", - "ppc641e", - "riscv64", - "s390x", - "wasm" - ], - "x-ms-enum": { - "name": "ArtifactArchitecture", - "modelAsString": true, - "values": [ - { - "value": "386", - "name": "I386", - "description": "" - }, - { - "value": "amd64", - "name": "Amd64", - "description": "" - }, - { - "value": "arm", - "name": "Arm", - "description": "" - }, - { - "value": "arm64", - "name": "Arm64", - "description": "" - }, - { - "value": "mips", - "name": "Mips", - "description": "" - }, - { - "value": "mipsle", - "name": "MipsLe", - "description": "" - }, - { - "value": "mips64", - "name": "Mips64", - "description": "" - }, - { - "value": "mips64le", - "name": "Mips64Le", - "description": "" - }, - { - "value": "ppc64", - "name": "Ppc64", - "description": "" - }, - { - "value": "ppc64le", - "name": "Ppc64Le", - "description": "" - }, - { - "value": "riscv64", - "name": "RiscV64", - "description": "" - }, - { - "value": "s390x", - "name": "S390x", - "description": "" - }, - { - "value": "wasm", - "name": "Wasm", - "description": "" - } - ] - }, - "default": "none", - "x-accessibility": "public" -}, -"ArtifactOperatingSystem": { - "type": "string", - "enum": [ - "aix", - "android", - "darwin", - "dragonfly", - "freebsd", - "illumos", - "ios", - "js", - "linux", - "netbsd", - "openbsd", - "plan9", - "solaris", - "windows" - ], - "x-ms-enum": { - "name": "ArtifactOperatingSystem", - "modelAsString": true, - "values": [ - { - "value": "aix", - "name": "Aix", - "description": "" - }, - { - "value": "android", - "name": "Android", - "description": "" - }, - { - "value": "darwin", - "name": "Darwin", - "description": "" - }, - { - "value": "dragonfly", - "name": "Dragonfly", - "description": "" - }, - { - "value": "freebsd", - "name": "FreeBsd", - "description": "" - }, - { - "value": "illumos", - "name": "Illumos", - "description": "" - }, - { - "value": "ios", - "name": "iOS", - "description": "" - }, - { - "value": "js", - "name": "JS", - "description": "" - }, - { - "value": "linux", - "name": "Linux", - "description": "" - }, - { - "value": "netbsd", - "name": "NetBsd", - "description": "" - }, - { - "value": "openbsd", - "name": "OpenBsd", - "description": "" - }, - { - "value": "plan9", - "name": "Plan9", - "description": "" - }, - { - "value": "solaris", - "name": "Solaris", - "description": "" - }, - { - "value": "windows", - "name": "Windows", - "description": "" - } - ] - }, - "x-accessibility": "public" - }, - "AcrManifests": { - "description": "Manifest attributes", - "properties": { - "registry": { - "type": "string", - "description": "Registry login server name. This is likely to be similar to {registry-name}.azurecr.io", - "x-ms-client-name": "registryLoginServer" - }, - "imageName": { - "type": "string", - "description": "Image name", - "x-ms-client-name": "repository" - }, - "manifests": { - "type": "array", - "description": "List of manifests", - "items": { - "$ref": "#/definitions/ManifestAttributesBase", - "description": "Manifest details" - } - }, - "link": { - "type": "string" - } - }, - "x-accessibility": "internal", - "example": { - "registry": "registry", - "imageName": "imageName", - "manifests": [ - { - "changeableAttributes": { - "quarantineDetails": "quarantineDetails", - "readEnabled": true, - "quarantineState": "quarantineState", - "listEnabled": true, - "deleteEnabled": true, - "writeEnabled": true - }, - "os": "os", - "digest": "digest", - "imageSize": 2401606, - "createdTime": "createdTime", - "mediaType": "mediaType", - "configMediaType": "configMediaType", - "lastUpdateTime": "lastUpdateTime", - "architecture": "architecture", - "tags": [ - "tags", - "tags" - ] - }, - { - "changeableAttributes": { - "quarantineDetails": "quarantineDetails", - "readEnabled": true, - "quarantineState": "quarantineState", - "listEnabled": true, - "deleteEnabled": true, - "writeEnabled": true - }, - "os": "os", - "digest": "digest", - "imageSize": 2401606, - "createdTime": "createdTime", - "mediaType": "mediaType", - "configMediaType": "configMediaType", - "lastUpdateTime": "lastUpdateTime", - "architecture": "architecture", - "tags": [ - "tags", - "tags" - ] - } - ] - } - }, - "ManifestAttributes": { - "required": [ - "manifest" - ], - "x-ms-client-name": "ArtifactManifestProperties", - "description": "Manifest attributes details", - "properties": { - "registry": { - "description": "Registry login server name. This is likely to be similar to {registry-name}.azurecr.io", - "readOnly": true, - "type": "string", - "x-ms-client-name": "registryLoginServer" - }, - "imageName": { - "description": "Repository name", - "type": "string", - "readOnly": true, - "x-ms-client-name": "repositoryName" - }, - "manifest": { - "x-ms-client-flatten": true, - "readOnly": true, - "description": "Manifest attributes", - "$ref": "#/definitions/ManifestAttributesBase" - } - }, - "example": { - "registry": "acrapi.azurecr-test.io", - "imageName": "nanoserver", - "manifest": { - "digest": "sha256:110d2b6c84592561338aa040b1b14b7ab81c2f9edbd564c2285dd7d70d777086", - "imageSize": 2401606, - "createdTime": "2018-09-06T06:17:20.9983915Z", - "lastUpdateTime": "2018-09-06T06:17:20.9983915Z", - "architecture": "amd64", - "os": "windows", - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "configMediaType": "application/vnd.docker.container.image.v1+json", - "tags": [ - "4.7.2-20180905-nanoserver-1803" - ], - "changeableAttributes": { - "deleteEnabled": true, - "writeEnabled": true, - "readEnabled": true, - "listEnabled": true - } - } - } - }, - "ManifestAttributesBase": { - "required": [ - "digest", - "createdTime", - "lastUpdateTime" - ], - "type": "object", - "description": "Manifest details", - "x-accessibility": "internal", - "properties": { - "digest": { - "type": "string", - "readOnly": true, - "description": "Manifest" - }, - "imageSize": { - "type": "integer", - "readOnly": true, - "format": "int64", - "description": "Image size", - "x-ms-client-name": "size" - }, - "createdTime": { - "type": "string", - "readOnly": true, - "format": "date-time", - "description": "Created time", - "x-ms-client-name": "createdOn" - }, - "lastUpdateTime": { - "type": "string", - "readOnly": true, - "format": "date-time", - "description": "Last update time", - "x-ms-client-name": "lastUpdatedOn" - }, - "architecture": { - "$ref": "#/definitions/ArtifactArchitecture", - "description": "CPU architecture", - "readOnly": true, - "x-nullable": true - }, - "os": { - "$ref": "#/definitions/ArtifactOperatingSystem", - "description": "Operating system", - "x-ms-client-name": "operatingSystem", - "readOnly": true, - "x-nullable": true - }, - "references": { - "type": "array", - "readOnly": true, - "description": "List of manifests referenced by this manifest list. List will be empty if this manifest is not a manifest list.", - "x-ms-client-name": "manifestReferences", - "items": { - "$ref": "#/definitions/ManifestAttributes_manifest_references", - "description": "Manifest attributes details" - } - }, - "tags": { - "type": "array", - "readOnly": true, - "description": "List of tags", - "items": { - "type": "string", - "description": "Tag name" - } - }, - "changeableAttributes": { - "$ref": "#/definitions/ManifestChangeableAttributes", - "description": "Writeable properties of the resource", - "x-ms-client-flatten": true - } - }, - "example": { - "changeableAttributes": { - "readEnabled": true, - "listEnabled": true, - "deleteEnabled": true, - "writeEnabled": true - }, - "os": "os", - "digest": "digest", - "imageSize": 2401606, - "createdTime": "createdTime", - "mediaType": "mediaType", - "configMediaType": "configMediaType", - "lastUpdateTime": "lastUpdateTime", - "architecture": "architecture", - "tags": [ - "tags", - "tags" - ] - } - }, - "RefreshToken": { - "type": "object", - "properties": { - "refresh_token": { - "description": "The refresh token to be used for generating access tokens", - "type": "string" - } - }, - "x-accessibility": "internal", - "x-ms-client-name": "AcrRefreshToken" - }, - "ManifestOrderBy": { - "type": "string", - "enum": [ - "none", - "timedesc", - "timeasc" - ], - "x-ms-enum": { - "name": "ManifestOrderBy", - "values": [ - { - "value": "none", - "name": "None", - "description": "Do not provide an orderby value in the request." - }, - { - "value": "timedesc", - "name": "LastUpdatedOnDescending", - "description": "Order manifests by LastUpdatedOn field, from most recently updated to least recently updated." - }, - { - "value": "timeasc", - "name": "LastUpdatedOnAscending", - "description": "Order manifest by LastUpdatedOn field, from least recently updated to most recently updated." - } - ] - }, - "default": "none", - "description": "Sort options for ordering manifests in a collection.", - "x-accessibility": "public" - }, - "AccessToken": { - "type": "object", - "properties": { - "access_token": { - "description": "The access token for performing authenticated requests", - "type": "string" - } - }, - "x-accessibility": "internal", - "x-ms-client-name": "AcrAccessToken" - }, - "AcrErrors": { - "description": "Acr error response describing why the operation failed", - "properties": { - "errors": { - "type": "array", - "description": "Array of detailed error", - "items": { - "$ref": "#/definitions/AcrErrorInfo" - } - } - } - }, - "RepositoryTags": { - "description": "Result of the request to list tags of the image", - "x-accessibility": "internal", - "properties": { - "name": { - "type": "string", - "description": "Name of the image" - }, - "tags": { - "type": "array", - "description": "List of tags", - "items": { - "type": "string", - "description": "Tag name" - } - } - }, - "example": { - "name": "name", - "tags": [ - "tags", - "tags" - ] - } - }, - "ImageSignature": { - "description": "Signature of a signed manifest", - "x-accessibility": "internal", - "properties": { - "header": { - "description": "A JSON web signature", - "$ref": "#/definitions/JWK" - }, - "signature": { - "type": "string", - "description": "A signature for the image manifest, signed by a libtrust private key" - }, - "protected": { - "type": "string", - "description": "The signed protected header" - } - }, - "example": { - "header": { - "jwk": { - "crv": "P-256", - "kid": "WGXM:EYWQ:DA53:LQUP:BCWG:5RDG:S3ZM:ETH7:VMQS:WWKZ:EWDG:V74Q", - "kty": "EC", - "x": "OxZ9k5BVjPZ7jb3BmBD4X0d8MVPJqfF4NeSe8reoqnY", - "y": "EaCqTe4-vYwhk7qU6Bs2-AeLGOVtCe_-IY2MdE0Vfyc" - }, - "alg": "ES256" - }, - "signature": "p73LfotMGD8nNXz2g9YX2XtSllb4GI5-b3vjqP5N0nkv8QXg-r5z_omGiVbOZE2BYG1X_4TIN23l1KSEqsXxOg", - "protected": "eyJmb3JtYXRMZW5ndGgiOjI5ODYsImZvcm1hdFRhaWwiOiJDbjAiLCJ0aW1lIjoiMjAxOC0wOS0yMFQyMzo0MTo1MloifQ" - } - }, - "JWK": { - "description": "A JSON web signature", - "x-accessibility": "internal", - "properties": { - "jwk": { - "$ref": "#/definitions/JWKHeader" - }, - "alg": { - "type": "string", - "description": "The algorithm used to sign or encrypt the JWT" - } - } - }, - "JWKHeader": { - "description": "JSON web key parameter", - "x-accessibility": "internal", - "properties": { - "crv": { - "type": "string", - "description": "crv value" - }, - "kid": { - "type": "string", - "description": "kid value" - }, - "kty": { - "type": "string", - "description": "kty value" - }, - "x": { - "type": "string", - "description": "x value" - }, - "y": { - "type": "string", - "description": "y value" - } - } - }, - "History": { - "description": "A list of unstructured historical data for v1 compatibility", - "x-accessibility": "internal", - "properties": { - "v1Compatibility": { - "type": "string", - "description": "The raw v1 compatibility information" - } - }, - "example": { - "v1Compatibility": "v1 compatibility info" - } - }, - "Repositories": { - "description": "List of repositories", - "properties": { - "repositories": { - "type": "array", - "description": "Repository names", - "items": { - "type": "string" - } - }, - "link": { - "type": "string" - } - }, - "x-accessibility": "internal", - "example": { - "repositories": [ - "production/alpine", - "testing/alpine" - ] - } - }, - "DeletedRepository": { - "x-ms-client-name": "DeleteRepositoryResult", - "description": "Deleted repository", - "properties": { - "manifestsDeleted": { - "type": "array", - "readOnly": true, - "description": "SHA of the deleted image", - "items": { - "type": "string" - }, - "x-ms-client-name": "deletedManifests" - }, - "tagsDeleted": { - "type": "array", - "readOnly": true, - "description": "Tag of the deleted image", - "items": { - "type": "string" - }, - "x-ms-client-name": "deletedTags" - } - } - }, - "AcrErrorInfo": { - "description": "Error information", - "properties": { - "code": { - "description": "Error code", - "type": "string" - }, - "message": { - "type": "string", - "description": "Error message" - }, - "detail": { - "type": "object", - "description": "Error details" - } - } - }, - "FsLayer": { - "description": "Image layer information", - "x-accessibility": "internal", - "properties": { - "blobSum": { - "type": "string", - "description": "SHA of an image layer" - } - }, - "example": { - "blobSum": "sha256:1f7d468f830cb0ed4beb8edc9438f18096e8c682e56a35242f60e6c61b718b30" - } - }, - "Descriptor": { - "description": "Docker V2 image layer descriptor including config and layers", - "x-accessibility": "internal", - "properties": { - "mediaType": { - "type": "string", - "description": "Layer media type" - }, - "size": { - "type": "integer", - "format": "int64", - "description": "Layer size" - }, - "digest": { - "type": "string", - "description": "Layer digest" - }, - "urls": { - "type": "array", - "description": "Specifies a list of URIs from which this object may be downloaded.", - "items": { - "description": "Must conform to RFC 3986. Entries should use the http and https schemes, as defined in RFC 7230.", - "type": "string" - } - }, - "annotations": { - "$ref": "#/definitions/Annotations" - } - }, - "example": { - "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "size": 2107098, - "digest": "sha256:5d20c808ce198565ff70b3ed23a991dd49afac45dece63474b27ce6ed036adc6" - } - }, - "TagChangeableAttributes": { - "description": "Changeable attributes", - "x-ms-client-name": "TagWriteableProperties", - "x-accessibility": "internal", - "properties": { - "deleteEnabled": { - "type": "boolean", - "description": "Delete enabled", - "x-ms-client-name": "canDelete" - }, - "writeEnabled": { - "type": "boolean", - "description": "Write enabled", - "x-ms-client-name": "canWrite" - }, - "listEnabled": { - "type": "boolean", - "description": "List enabled", - "x-ms-client-name": "canList" - }, - "readEnabled": { - "type": "boolean", - "description": "Read enabled", - "x-ms-client-name": "canRead" - } - }, - "example": { - "readEnabled": true, - "listEnabled": true, - "deleteEnabled": true, - "writeEnabled": true - } - }, - "TagAttributes_tag": { - "description": "Tag", - "properties": { - "signatureRecord": { - "description": "SignatureRecord value", - "type": "string" - } - }, - "example": { - "signatureRecord": "signatureRecord" - } - }, - "ManifestAttributes_manifest_references": { - "required": [ - "digest", - "architecture", - "os" - ], - "x-ms-client-name": "ArtifactManifestReference", - "description": "Manifest attributes details", - "properties": { - "digest": { - "type": "string", - "readOnly": true, - "description": "Manifest digest" - }, - "architecture": { - "$ref": "#/definitions/ArtifactArchitecture", - "readOnly": true, - "description": "CPU architecture" - }, - "os": { - "$ref": "#/definitions/ArtifactOperatingSystem", - "readOnly": true, - "description": "Operating system", - "x-ms-client-name": "operatingSystem" - } - }, - "example": { - "os": "os", - "digest": "digest", - "architecture": "architecture" - } - }, - "ManifestAttributes_manifest": { - "description": "List of manifest attributes", - "properties": { - "references": { - "type": "array", - "description": "List of manifest attributes details", - "items": { - "$ref": "#/definitions/ManifestAttributes_manifest_references", - "description": "Manifest attributes details" - } - }, - "quarantineTag": { - "type": "string", - "description": "Quarantine tag name" - } - }, - "example": { - "quarantineTag": "quarantineTag", - "references": [ - { - "os": "os", - "digest": "digest", - "architecture": "architecture" - }, - { - "os": "os", - "digest": "digest", - "architecture": "architecture" - } - ] - } - }, - "ManifestChangeableAttributes": { - "description": "Changeable attributes", - "x-ms-client-name": "ManifestWriteableProperties", - "x-accessibility": "internal", - "properties": { - "deleteEnabled": { - "type": "boolean", - "description": "Delete enabled", - "x-ms-client-name": "canDelete" - }, - "writeEnabled": { - "type": "boolean", - "description": "Write enabled", - "x-ms-client-name": "canWrite" - }, - "listEnabled": { - "type": "boolean", - "description": "List enabled", - "x-ms-client-name": "canList" - }, - "readEnabled": { - "type": "boolean", - "description": "Read enabled", - "x-ms-client-name": "canRead" - }, - "quarantineState": { - "type": "string", - "description": "Quarantine state", - "x-accessibility": "internal" - }, - "quarantineDetails": { - "type": "string", - "description": "Quarantine details", - "x-accessibility": "internal" - } - }, - "example": { - "quarantineDetails": "quarantineDetails", - "readEnabled": true, - "quarantineState": "quarantineState", - "listEnabled": true, - "deleteEnabled": true, - "writeEnabled": true - } - }, - "RepositoryChangeableAttributes": { - "description": "Changeable attributes for Repository", - "x-ms-client-name": "RepositoryWriteableProperties", - "x-accessibility": "internal", - "properties": { - "deleteEnabled": { - "type": "boolean", - "description": "Delete enabled", - "x-ms-client-name": "canDelete" - }, - "writeEnabled": { - "type": "boolean", - "description": "Write enabled", - "x-ms-client-name": "canWrite" - }, - "listEnabled": { - "type": "boolean", - "description": "List enabled", - "x-ms-client-name": "canList" - }, - "readEnabled": { - "type": "boolean", - "description": "Read enabled", - "x-ms-client-name": "canRead" - }, - "teleportEnabled": { - "type": "boolean", - "description": "Enables Teleport functionality on new images in the repository improving Container startup performance" - } - }, - "example": { - "readEnabled": true, - "listEnabled": true, - "deleteEnabled": true, - "writeEnabled": true, - "teleportEnabled": true - } - }, - "Manifest": { - "description": "Returns the requested manifest file", - "x-accessibility": "internal", - "properties": { - "schemaVersion": { - "type": "integer", - "description": "Schema version" - } - } - }, - "ManifestWrapper": { - "description": "Returns the requested manifest file", - "x-accessibility": "internal", - "properties": { - "mediaType": { - "type": "string", - "description": "Media type for this Manifest" - }, - "manifests": { - "type": "array", - "description": "(ManifestList, OCIIndex) List of V2 image layer information", - "items": { - "$ref": "#/definitions/ManifestListAttributes" - } - }, - "config": { - "description": "(V2, OCI) Image config descriptor", - "$ref": "#/definitions/Descriptor" - }, - "layers": { - "type": "array", - "description": "(V2, OCI) List of V2 image layer information", - "items": { - "$ref": "#/definitions/Descriptor" - } - }, - "annotations": { - "description": "(OCI, OCIIndex) Additional metadata", - "$ref": "#/definitions/Annotations" - }, - "architecture": { - "type": "string", - "description": "(V1) CPU architecture" - }, - "name": { - "type": "string", - "description": "(V1) Image name" - }, - "tag": { - "type": "string", - "description": "(V1) Image tag" - }, - "fsLayers": { - "type": "array", - "description": "(V1) List of layer information", - "items": { - "$ref": "#/definitions/FsLayer" - } - }, - "history": { - "type": "array", - "description": "(V1) Image history", - "items": { - "$ref": "#/definitions/History" - } - }, - "signatures": { - "type": "array", - "description": "(V1) Image signature", - "items": { - "$ref": "#/definitions/ImageSignature" - } - } - }, - "allOf": [ - { - "$ref": "#/definitions/Manifest" - } - ] - }, - "ManifestList": { - "x-ms-discriminator-value": "application/vnd.docker.distribution.manifest.list.v2+json", - "description": "Returns the requested Docker multi-arch-manifest file", - "x-accessibility": "internal", - "properties": { - "mediaType": { - "type": "string", - "description": "Media type for this Manifest" - }, - "manifests": { - "type": "array", - "description": "List of V2 image layer information", - "items": { - "$ref": "#/definitions/ManifestListAttributes" - } - } - }, - "allOf": [ - { - "$ref": "#/definitions/Manifest" - } - ] - }, - "ManifestListAttributes": { - "x-accessibility": "internal", - "properties": { - "mediaType": { - "type": "string", - "description": "The MIME type of the referenced object. This will generally be application/vnd.docker.image.manifest.v2+json, but it could also be application/vnd.docker.image.manifest.v1+json" - }, - "size": { - "type": "integer", - "format": "int64", - "description": "The size in bytes of the object" - }, - "digest": { - "type": "string", - "description": "The digest of the content, as defined by the Registry V2 HTTP API Specification" - }, - "platform": { - "$ref": "#/definitions/Platform" - } - } - }, - "Platform": { - "description": "The platform object describes the platform which the image in the manifest runs on. A full list of valid operating system and architecture values are listed in the Go language documentation for $GOOS and $GOARCH", - "x-accessibility": "internal", - "properties": { - "architecture": { - "type": "string", - "description": "Specifies the CPU architecture, for example amd64 or ppc64le." - }, - "os": { - "type": "string", - "description": "The os field specifies the operating system, for example linux or windows." - }, - "os.version": { - "type": "string", - "description": "The optional os.version field specifies the operating system version, for example 10.0.10586." - }, - "os.features": { - "type": "array", - "description": "The optional os.features field specifies an array of strings, each listing a required OS feature (for example on Windows win32k", - "items": { - "type": "string" - } - }, - "variant": { - "type": "string", - "description": "The optional variant field specifies a variant of the CPU, for example armv6l to specify a particular CPU variant of the ARM CPU." - }, - "features": { - "type": "array", - "description": "The optional features field specifies an array of strings, each listing a required CPU feature (for example sse4 or aes", - "items": { - "type": "string" - } - } - } - }, - "V2Manifest": { - "x-ms-discriminator-value": "application/vnd.docker.distribution.manifest.v2+json", - "x-accessibility": "internal", - "description": "Returns the requested Docker V2 Manifest file", - "properties": { - "mediaType": { - "type": "string", - "description": "Media type for this Manifest" - }, - "config": { - "description": "V2 image config descriptor", - "$ref": "#/definitions/Descriptor" - }, - "layers": { - "type": "array", - "description": "List of V2 image layer information", - "items": { - "$ref": "#/definitions/Descriptor" - } - } - }, - "allOf": [ - { - "$ref": "#/definitions/Manifest" - } - ], - "example": { - "schemaVersion": 2, - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "config": { - "mediaType": "application/vnd.docker.container.image.v1+json", - "size": 1512, - "digest": "sha256:6d1ef012b5674ad8a127ecfa9b5e6f5178d171b90ee462846974177fd9bdd39f" - }, - "layers": [ - { - "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "size": 2107098, - "digest": "sha256:5d20c808ce198565ff70b3ed23a991dd49afac45dece63474b27ce6ed036adc6" - } - ] - } - }, - "OCIManifest": { - "x-ms-discriminator-value": "application/vnd.oci.image.manifest.v1+json", - "x-accessibility": "internal", - "description": "Returns the requested OCI Manifest file", - "properties": { - "config": { - "description": "V2 image config descriptor", - "$ref": "#/definitions/Descriptor" - }, - "layers": { - "type": "array", - "description": "List of V2 image layer information", - "items": { - "$ref": "#/definitions/Descriptor" - } - }, - "annotations": { - "$ref": "#/definitions/Annotations" - } - }, - "allOf": [ - { - "$ref": "#/definitions/Manifest" - } - ] - }, - "OCIIndex": { - "x-ms-discriminator-value": "application/vnd.oci.image.index.v1+json", - "x-accessibility": "internal", - "description": "Returns the requested OCI index file", - "properties": { - "manifests": { - "type": "array", - "description": "List of OCI image layer information", - "items": { - "$ref": "#/definitions/ManifestListAttributes" - } - }, - "annotations": { - "$ref": "#/definitions/Annotations" - } - }, - "allOf": [ - { - "$ref": "#/definitions/Manifest" - } - ] - }, - "V1Manifest": { - "description": "Returns the requested V1 manifest file", - "x-ms-discriminator-value": "application/vnd.oci.image.manifest.v1+json", - "x-accessibility": "internal", - "properties": { - "architecture": { - "type": "string", - "description": "CPU architecture" - }, - "name": { - "type": "string", - "description": "Image name" - }, - "tag": { - "type": "string", - "description": "Image tag" - }, - "fsLayers": { - "type": "array", - "description": "List of layer information", - "items": { - "$ref": "#/definitions/FsLayer" - } - }, - "history": { - "type": "array", - "description": "Image history", - "items": { - "$ref": "#/definitions/History" - } - }, - "signatures": { - "type": "array", - "description": "Image signature", - "items": { - "$ref": "#/definitions/ImageSignature" - } - } - }, - "allOf": [ - { - "$ref": "#/definitions/Manifest" - } - ] - }, - "Annotations": { - "description": "Additional information provided through arbitrary metadata.", - "x-accessibility": "internal", - "type": "object", - "x-nullable": true, - "additionalProperties": { - "type": "object" - }, - "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": "Created" - }, - "org.opencontainers.image.authors": { - "description": "Contact details of the people or organization responsible for the image.", - "type": "string", - "x-ms-client-name": "Authors" - }, - "org.opencontainers.image.url": { - "description": "URL to find more information on the image.", - "type": "string", - "x-ms-client-name": "Url" - }, - "org.opencontainers.image.documentation": { - "description": "URL to get documentation on the image.", - "type": "string", - "x-ms-client-name": "Documentation" - }, - "org.opencontainers.image.source": { - "description": "URL to get source code for building the image.", - "type": "string", - "x-ms-client-name": "Source" - }, - "org.opencontainers.image.version": { - "description": "Version of the packaged software. The version MAY match a label or tag in the source code repository, may also be Semantic versioning-compatible", - "type": "string", - "x-ms-client-name": "Version" - }, - "org.opencontainers.image.revision": { - "description": "Source control revision identifier for the packaged software.", - "type": "string", - "x-ms-client-name": "Revision" - }, - "org.opencontainers.image.vendor": { - "description": "Name of the distributing entity, organization or individual.", - "type": "string", - "x-ms-client-name": "Vendor" - }, - "org.opencontainers.image.licenses": { - "description": "License(s) under which contained software is distributed as an SPDX License Expression.", - "type": "string", - "x-ms-client-name": "Licenses" - }, - "org.opencontainers.image.ref.name": { - "description": "Name of the reference for a target.", - "type": "string", - "x-ms-client-name": "Name" - }, - "org.opencontainers.image.title": { - "description": "Human-readable title of the image", - "type": "string", - "x-ms-client-name": "Title" - }, - "org.opencontainers.image.description": { - "description": "Human-readable description of the software packaged in the image", - "type": "string", - "x-ms-client-name": "Description" - } - } - } - }, - "parameters": { - "Url": { - "name": "url", - "x-ms-client-name": "loginUri", - "description": "Registry login URL", - "required": true, - "type": "string", - "in": "path", - "x-ms-skip-url-encoding": true, - "x-ms-parameter-location": "client" - }, - "ImageReference": { - "name": "reference", - "in": "path", - "description": "A tag or a digest, pointing to a specific image", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - }, - "ManifestReference": { - "name": "reference", - "in": "path", - "description": "Tag or digest of the target manifest", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - }, - "TagReference": { - "name": "reference", - "in": "path", - "description": "Tag name", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - }, - "Digest": { - "name": "digest", - "in": "path", - "description": "Digest of a BLOB", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - }, - "DigestReference": { - "name": "reference", - "in": "path", - "description": "Digest of a BLOB", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - }, - "BlobQueryDigest": { - "name": "digest", - "in": "query", - "description": "Digest of a BLOB", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - }, - "RepositoryAttributeValue": { - "name": "value", - "in": "body", - "description": "Repository attribute value", - "required": false, - "schema": { - "$ref": "#/definitions/RepositoryChangeableAttributes" - }, - "x-ms-parameter-location": "method" - }, - "TagAttributeValue": { - "name": "value", - "in": "body", - "description": "Tag attribute value", - "required": false, - "schema": { - "$ref": "#/definitions/TagChangeableAttributes" - }, - "x-ms-parameter-location": "method" - }, - "ManifestAttributeValue": { - "name": "value", - "in": "body", - "description": "Manifest attribute value", - "required": false, - "schema": { - "$ref": "#/definitions/ManifestChangeableAttributes" - }, - "x-ms-parameter-location": "method" - }, - "QueryOrderBy": { - "name": "orderby", - "in": "query", - "description": "orderby query parameter", - "required": false, - "type": "string", - "x-ms-parameter-location": "method" - }, - "QueryNum": { - "name": "n", - "in": "query", - "description": "query parameter for max number of items", - "required": false, - "type": "integer", - "x-ms-parameter-location": "method" - }, - "QueryLast": { - "name": "last", - "in": "query", - "description": "Query parameter for the last item in previous query. Result set will include values lexically after last.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method" - }, - "QueryDigest": { - "name": "digest", - "in": "query", - "description": "filter by digest", - "required": false, - "type": "string", - "x-ms-parameter-location": "method" - }, - "Grant_type": { - "name": "grant_type", - "description": "Can take a value of access_token", - "type": "string", - "in": "formData", - "required": true, - "enum": [ - "access_token" - ], - "x-ms-parameter-location": "method", - "x-accessibility": "internal" - }, - "Service": { - "name": "service", - "in": "formData", - "required": true, - "description": "Indicates the name of your Azure container registry.", - "type": "string", - "x-ms-parameter-location": "method" - }, - "Tenant": { - "name": "tenant", - "in": "formData", - "required": false, - "description": "AAD tenant associated to the AAD credentials.", - "type": "string", - "x-ms-parameter-location": "method" - }, - "Scope": { - "name": "scope", - "in": "formData", - "required": true, - "description": "Which is 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.", - "type": "string", - "x-ms-parameter-location": "method" - }, - "RefreshToken": { - "name": "refresh_token", - "in": "formData", - "required": false, - "description": "AAD refresh token, mandatory when grant_type is access_token_refresh_token or refresh_token", - "type": "string", - "x-ms-parameter-location": "method" - }, - "AccessToken": { - "name": "access_token", - "x-ms-client-name": "aadAccessToken", - "in": "formData", - "required": true, - "description": "AAD access token, mandatory when grant_type is access_token_refresh_token or access_token.", - "type": "string", - "x-ms-parameter-location": "method" - }, - "ImageName": { - "name": "name", - "in": "path", - "description": "Name of the image (including the namespace)", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - }, - "ManifestBody": { - "description": "Manifest body, can take v1 or v2 values depending on accept header", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Manifest" - }, - "x-ms-parameter-location": "method" - }, - "RawData": { - "name": "value", - "description": "Raw data of blob", - "in": "body", - "schema": { - "type": "object", - "format": "file" - }, - "required": true, - "x-ms-parameter-location": "method" - }, - "RawDataOptional": { - "name": "value", - "description": "Optional raw data of blob", - "in": "body", - "schema": { - "type": "object", - "format": "file" - }, - "required": false, - "x-ms-parameter-location": "method" - }, - "From": { - "name": "from", - "type": "string", - "in": "query", - "description": "Name of the source repository.", - "required": true, - "x-ms-parameter-location": "method" - }, - "Mount": { - "name": "mount", - "description": "Digest of blob to mount from the source repository.", - "type": "string", - "in": "query", - "required": true, - "x-ms-parameter-location": "method" - }, - "Uuid": { - "name": "uuid", - "description": "A uuid identifying the upload.", - "type": "string", - "in": "path", - "required": true, - "x-ms-parameter-location": "method" - }, - "Content-Range": { - "name": "Content-Range", - "in": "header", - "description": "Range of bytes identifying the desired block of content represented by the body. Start must the end offset retrieved via status check plus one. Note that this is a non-standard use of the `Content-Range` header.", - "type": "string", - "required": true, - "x-ms-parameter-location": "method" - }, - "Range": { - "name": "Range", - "type": "string", - "description": "Format : bytes=-, HTTP Range header specifying blob chunk.", - "in": "header", - "required": true, - "x-ms-parameter-location": "method" - }, - "NoUploadCache": { - "description": "Acquired from NextLink", - "name": "_nouploadcache", - "in": "query", - "type": "boolean", - "required": false, - "x-ms-parameter-location": "method" - }, - "State": { - "description": "Acquired from NextLink", - "name": "_state", - "in": "query", - "type": "string", - "required": false, - "x-ms-parameter-location": "method" - }, - "NextLink": { - "name": "nextBlobUuidLink", - "x-ms-client-name": "location", - "type": "string", - "description": "Link acquired from upload start or previous chunk. Note, do not include initial / (must do substring(1) )", - "in": "path", - "required": true, - "x-ms-parameter-location": "method", - "x-ms-skip-url-encoding": true - } - } -} \ No newline at end of file From 01c2d1c66e722e4f3c04e2c9227856da42b209b1 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Tue, 1 Jun 2021 13:49:05 -0700 Subject: [PATCH 12/53] Set AMQP connection idle timeout to 60 seconds. (#21995) --- .../core/amqp/implementation/handler/ConnectionHandler.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/ConnectionHandler.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/ConnectionHandler.java index ffe6b56d7dee..3e529e475a7d 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/ConnectionHandler.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/ConnectionHandler.java @@ -42,6 +42,7 @@ public class ConnectionHandler extends Handler { static final Symbol USER_AGENT = Symbol.valueOf("user-agent"); static final int MAX_FRAME_SIZE = 65536; + static final int CONNECTION_IDLE_TIMEOUT = 60_000; // milliseconds private final Map connectionProperties; private final ConnectionOptions connectionOptions; @@ -113,6 +114,11 @@ public int getMaxFrameSize() { * @param transport Transport to add layers to. */ protected void addTransportLayers(Event event, TransportInternal transport) { + // default connection idle timeout is 0. + // Giving it a idle timeout will enable the client side to know broken connection faster. + // Refer to http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#doc-doc-idle-time-out + transport.setIdleTimeout(CONNECTION_IDLE_TIMEOUT); + final SslDomain sslDomain = Proton.sslDomain(); sslDomain.init(SslDomain.Mode.CLIENT); From 90e06aaddcff951079e98d297d55ce2790ee24a5 Mon Sep 17 00:00:00 2001 From: angiurgiu Date: Tue, 1 Jun 2021 14:07:01 -0700 Subject: [PATCH 13/53] Angiurgiu/add missing chat thread async client options methods (#21939) * Removed the item return check on listReadReceipts for Live/Record tests. Removed .sleep statements * Added missing Options methods in ChatThreadAsyncClient * Updated incorrect test name used for logging Co-authored-by: Andrei Giurgiu --- .../azure-communication-chat/CHANGELOG.md | 2 + .../chat/ChatThreadAsyncClient.java | 57 ++++++ .../chat/ChatThreadAsyncClientTest.java | 71 +++++++ ...stAndRemoveMembersWithOptionsAsync[1].json | 185 ++++++++++++++++++ ...endThenListReadReceiptsWithOptions[1].json | 99 ++++++++++ 5 files changed, 414 insertions(+) create mode 100644 sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canAddListAndRemoveMembersWithOptionsAsync[1].json create mode 100644 sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canSendThenListReadReceiptsWithOptions[1].json diff --git a/sdk/communication/azure-communication-chat/CHANGELOG.md b/sdk/communication/azure-communication-chat/CHANGELOG.md index 945ec8249985..cea00d286a69 100644 --- a/sdk/communication/azure-communication-chat/CHANGELOG.md +++ b/sdk/communication/azure-communication-chat/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History ## 1.1.0-beta.1 (Unreleased) +- Added method `ChatThreadAsyncClient.listParticipants(ListParticipantsOptions listParticipantsOptions)` +- Added method `ChatThreadAsyncClient.listReadReceipts(ListReadReceiptOptions listReadReceiptOptions)` ## 1.0.1 (2021-05-27) - Dependency versions updated. diff --git a/sdk/communication/azure-communication-chat/src/main/java/com/azure/communication/chat/ChatThreadAsyncClient.java b/sdk/communication/azure-communication-chat/src/main/java/com/azure/communication/chat/ChatThreadAsyncClient.java index c8f46652457c..bf8d335fa030 100644 --- a/sdk/communication/azure-communication-chat/src/main/java/com/azure/communication/chat/ChatThreadAsyncClient.java +++ b/sdk/communication/azure-communication-chat/src/main/java/com/azure/communication/chat/ChatThreadAsyncClient.java @@ -345,6 +345,35 @@ public PagedFlux listParticipants() { return listParticipants(listParticipantsOptions, Context.NONE); } + /** + * Gets the participants of a thread. + * + * @param listParticipantsOptions The request options. + * @return the participants of a thread. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listParticipants(ListParticipantsOptions listParticipantsOptions) { + final ListParticipantsOptions serviceListParticipantsOptions = + listParticipantsOptions == null ? new ListParticipantsOptions() : listParticipantsOptions; + + try { + return pagedFluxConvert(new PagedFlux<>( + () -> withContext(context -> + this.chatThreadClient.listChatParticipantsSinglePageAsync( + chatThreadId, + serviceListParticipantsOptions.getMaxPageSize(), + serviceListParticipantsOptions.getSkip(), + context) + .onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e))), + nextLink -> withContext(context -> + this.chatThreadClient.listChatParticipantsNextSinglePageAsync(nextLink, context) + .onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e)))), + f -> ChatParticipantConverter.convert(f)); + } catch (RuntimeException ex) { + return new PagedFlux<>(() -> monoError(logger, ex)); + } + } + /** * Gets the participants of a thread. * @@ -821,6 +850,34 @@ public PagedFlux listReadReceipts() { } } + /** + * Gets read receipts for a thread. + * + * @param listReadReceiptOptions The additional options for this operation. + * @return read receipts for a thread. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listReadReceipts(ListReadReceiptOptions listReadReceiptOptions) { + final ListReadReceiptOptions serviceListReadReceiptOptions = + listReadReceiptOptions == null ? new ListReadReceiptOptions() : listReadReceiptOptions; + + try { + return pagedFluxConvert(new PagedFlux<>( + () -> withContext(context -> this.chatThreadClient.listChatReadReceiptsSinglePageAsync( + chatThreadId, + serviceListReadReceiptOptions.getMaxPageSize(), + serviceListReadReceiptOptions.getSkip(), + context) + .onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e))), + nextLink -> withContext(context -> this.chatThreadClient.listChatReadReceiptsNextSinglePageAsync( + nextLink, context) + .onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e)))), + f -> ChatMessageReadReceiptConverter.convert(f)); + } catch (RuntimeException ex) { + return new PagedFlux<>(() -> monoError(logger, ex)); + } + } + /** * Gets read receipts for a thread. * diff --git a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java index e57f75afd1ac..9db4597d9ba8 100644 --- a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java +++ b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java @@ -188,6 +188,43 @@ public void canAddListAndRemoveMembersAsync(HttpClient httpClient) throws Interr } } + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void canAddListAndRemoveMembersWithOptionsAsync(HttpClient httpClient) throws InterruptedException { + // Arrange + setupTest(httpClient, "canAddListAndRemoveMembersWithOptionsAsync"); + firstAddedParticipant = communicationClient.createUser(); + secondAddedParticipant = communicationClient.createUser(); + + Iterable participants = ChatOptionsProvider.addParticipantsOptions( + firstAddedParticipant.getId(), secondAddedParticipant.getId()); + + // Act & Assert + StepVerifier.create(chatThreadClient.addParticipants(participants)) + .assertNext(noResp -> { + PagedIterable participantsResponse = + new PagedIterable<>(chatThreadClient.listParticipants(new ListParticipantsOptions().setMaxPageSize(2))); + + // process the iterableByPage + List returnedParticipants = new ArrayList(); + participantsResponse.iterableByPage().forEach(resp -> { + assertEquals(200, resp.getStatusCode()); + resp.getItems().forEach(item -> returnedParticipants.add(item)); + }); + + for (ChatParticipant participant : participants) { + assertTrue(checkParticipantsListContainsParticipantId(returnedParticipants, + ((CommunicationUserIdentifier) participant.getCommunicationIdentifier()).getId())); + } + assertTrue(returnedParticipants.size() == 4); + }); + + for (ChatParticipant participant : participants) { + StepVerifier.create(chatThreadClient.removeParticipant(participant.getCommunicationIdentifier())) + .verifyComplete(); + } + } + @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void canAddListWithContextAndRemoveMembersAsync(HttpClient httpClient) throws InterruptedException { @@ -747,6 +784,40 @@ public void canSendThenListReadReceipts(HttpClient httpClient) throws Interrupte }); } + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + @DisabledIfEnvironmentVariable( + named = "SKIP_LIVE_TEST", + matches = "(?i)(true)") + public void canSendThenListReadReceiptsWithOptions(HttpClient httpClient) throws InterruptedException { + // Arrange + setupTest(httpClient, "canSendThenListReadReceiptsWithOptions"); + SendChatMessageOptions messageRequest = ChatOptionsProvider.sendMessageOptions(); + AtomicReference messageResponseRef = new AtomicReference<>(); + + // Action & Assert + StepVerifier.create( + chatThreadClient.sendMessage(messageRequest) + .flatMap(response -> { + messageResponseRef.set(response.getId()); + return chatThreadClient.sendReadReceipt(response.getId()); + }) + ) + .assertNext(noResp -> { + PagedIterable readReceiptsResponse = new PagedIterable( + chatThreadClient.listReadReceipts(new ListReadReceiptOptions().setMaxPageSize(1))); + + // process the iterableByPage + List returnedReadReceipts = new ArrayList<>(); + readReceiptsResponse.iterableByPage().forEach(resp -> { + assertEquals(200, resp.getStatusCode()); + resp.getItems().forEach(item -> returnedReadReceipts.add(item)); + }); + assertTrue(returnedReadReceipts.size() > 0); + checkReadReceiptListContainsMessageId(returnedReadReceipts, messageResponseRef.get()); + }); + } + @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") @DisabledIfEnvironmentVariable( diff --git a/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canAddListAndRemoveMembersWithOptionsAsync[1].json b/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canAddListAndRemoveMembersWithOptionsAsync[1].json new file mode 100644 index 000000000000..af09770de899 --- /dev/null +++ b/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canAddListAndRemoveMembersWithOptionsAsync[1].json @@ -0,0 +1,185 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:51:46 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "65ms", + "MS-CV" : "hqKed1k7x0S/mm6LYGzcSw.0", + "X-Azure-Ref" : "0kzCwYAAAAAChuA8zcmkMQYT4vvdf/WISV1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"identity\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-6485-ceb1-a43a0d0027ee\"}}", + "x-ms-client-request-id" : "1fb6a2f3-9d13-44dd-9825-9aa4b6f8b89f", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:51:47 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "111ms", + "MS-CV" : "Je2DwMX8yk6PS/W8Qa0JtQ.0", + "X-Azure-Ref" : "0kzCwYAAAAABI9YzwMZsyQ7RZMB7krrLBV1NURURHRTA4MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"identity\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-6519-740a-113a0d0032ad\"}}", + "x-ms-client-request-id" : "fa3f8778-a7de-4f26-8c66-8437cd626f60", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities/8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-6485-ceb1-a43a0d0027ee/:issueAccessToken?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 23:51:47 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "125ms", + "MS-CV" : "YjGZ7mhh8E6Rucg6dPGMAA.0", + "X-Azure-Ref" : "0kzCwYAAAAABYIwc+TdlCSLiyjspz8M40V1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"token\":\"REDACTED\",\"expiresOn\":\"2021-05-28T23:51:46.9935327+00:00\"}", + "x-ms-client-request-id" : "c8500a20-706c-4282-ae3f-43b4cf963cf8", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/chat/threads?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-chat/1.0.1 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-09-21-preview2, 2020-11-01-preview3, 2021-01-27-preview4, 2021-03-01-preview5, 2021-03-07, 2021-04-05-preview6", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:51:48 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "831ms", + "MS-CV" : "iLFmwh1kIEihViH/5X/rxA.0", + "X-Azure-Ref" : "0lDCwYAAAAAAaoMb88uUqRL44OB6f0ZNCV1NURURHRTA4MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"chatThread\":{\"id\":\"19:eXCI9r5t4PcEHdHM4pZi4mjbmVpQsF5gATSJIxz_mL41@thread.v2\",\"topic\":\"Test\",\"createdOn\":\"2021-05-27T23:51:48Z\",\"createdByCommunicationIdentifier\":{\"rawId\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-6485-ceb1-a43a0d0027ee\",\"communicationUser\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-6485-ceb1-a43a0d0027ee\"}}}}", + "Content-Type" : "application/json; charset=utf-8", + "Location" : "https://chat-prod-e2e.communication.azure.com/chat/threads/19%3AeXCI9r5t4PcEHdHM4pZi4mjbmVpQsF5gATSJIxz_mL41@thread.v2" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:51:48 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "62ms", + "MS-CV" : "RXFlmlhlMUGIlISTXhYtpQ.0", + "X-Azure-Ref" : "0lDCwYAAAAAAd6CZA9n1KR6EvuE7we8DcV1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"identity\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-69c0-ceb1-a43a0d0027ef\"}}", + "x-ms-client-request-id" : "ec9d25d1-bc5e-4723-ab47-5a3aca20234b", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:51:48 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "86ms", + "MS-CV" : "KVZRWdzijkCUR9JK1DndPg.0", + "X-Azure-Ref" : "0lTCwYAAAAACiK5KHtP2BSoA+i+C3ZzNxV1NURURHRTA4MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"identity\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-6a40-740a-113a0d0032af\"}}", + "x-ms-client-request-id" : "f00f8a1f-f26c-4a6e-ad26-8fe31ad313e5", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/chat/threads/19:eXCI9r5t4PcEHdHM4pZi4mjbmVpQsF5gATSJIxz_mL41@thread.v2/participants/:remove?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-chat/1.0.1 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "Strict-Transport-Security" : "max-age=2592000", + "api-supported-versions" : "2020-11-01-preview3, 2021-01-27-preview4, 2021-03-01-preview5, 2021-03-07, 2021-04-05-preview6", + "X-Processing-Time" : "176ms", + "MS-CV" : "h6KGMwolGk6sV5PEJpf/jg.0", + "retry-after" : "0", + "X-Azure-Ref" : "0lTCwYAAAAAA3yWMV3OwYT6KImV3TNXrZV1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "StatusCode" : "204", + "Date" : "Thu, 27 May 2021 23:51:48 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/chat/threads/19:eXCI9r5t4PcEHdHM4pZi4mjbmVpQsF5gATSJIxz_mL41@thread.v2/participants/:remove?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-chat/1.0.1 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "Strict-Transport-Security" : "max-age=2592000", + "api-supported-versions" : "2020-11-01-preview3, 2021-01-27-preview4, 2021-03-01-preview5, 2021-03-07, 2021-04-05-preview6", + "X-Processing-Time" : "403ms", + "MS-CV" : "spA6zr1ZB0OHd9VnV0/K2g.0", + "retry-after" : "0", + "X-Azure-Ref" : "0lTCwYAAAAACNNOLqovnwRoHfm01ydwNXV1NURURHRTA4MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "StatusCode" : "204", + "Date" : "Thu, 27 May 2021 23:51:49 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canSendThenListReadReceiptsWithOptions[1].json b/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canSendThenListReadReceiptsWithOptions[1].json new file mode 100644 index 000000000000..f4d102ff0a1b --- /dev/null +++ b/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canSendThenListReadReceiptsWithOptions[1].json @@ -0,0 +1,99 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:52:12 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "61ms", + "MS-CV" : "TDyTtCHa6kqK44Rh3zuaJw.0", + "X-Azure-Ref" : "0rTCwYAAAAABLRDxBM+nLSayRS62sQnz1V1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"identity\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-c903-ceb1-a43a0d002804\"}}", + "x-ms-client-request-id" : "6fbc1025-c3ce-46f8-8a08-ea3588f27116", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:52:13 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "85ms", + "MS-CV" : "wBhusif1zUitP9JUJIaPVw.0", + "X-Azure-Ref" : "0rTCwYAAAAAAU2eFs/5clTb91qKAtXWhAV1NURURHRTA4MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"identity\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-c981-740a-113a0d0032ca\"}}", + "x-ms-client-request-id" : "3ba392d9-5b8e-4bb5-946e-92804058d812", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities/8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-c903-ceb1-a43a0d002804/:issueAccessToken?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 23:52:12 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "128ms", + "MS-CV" : "0kyf4J1soE+vLa6kr8qtEA.0", + "X-Azure-Ref" : "0rTCwYAAAAACjVRmvYejgS5oPr/ek1xuiV1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"token\":\"REDACTED\",\"expiresOn\":\"2021-05-28T23:52:12.7058272+00:00\"}", + "x-ms-client-request-id" : "ad929ad9-0bc4-41c5-ac6b-62f913ecc920", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/chat/threads?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-chat/1.0.1 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-09-21-preview2, 2020-11-01-preview3, 2021-01-27-preview4, 2021-03-01-preview5, 2021-03-07, 2021-04-05-preview6", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:52:14 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "1090ms", + "MS-CV" : "/1oul2Rdhki5+y7QmKlChw.0", + "X-Azure-Ref" : "0rTCwYAAAAADHT172YwkAS4ZpcZ60/6qBV1NURURHRTA4MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"chatThread\":{\"id\":\"19:7x968SeTYz5JaYALO9u9dXAHVpWcvdf2PWwhYjaKdxk1@thread.v2\",\"topic\":\"Test\",\"createdOn\":\"2021-05-27T23:52:13Z\",\"createdByCommunicationIdentifier\":{\"rawId\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-c903-ceb1-a43a0d002804\",\"communicationUser\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-c903-ceb1-a43a0d002804\"}}}}", + "Content-Type" : "application/json; charset=utf-8", + "Location" : "https://chat-prod-e2e.communication.azure.com/chat/threads/19%3A7x968SeTYz5JaYALO9u9dXAHVpWcvdf2PWwhYjaKdxk1@thread.v2" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file From 32ab07ee1bc5abeea86aea28b744ae9befc5fb49 Mon Sep 17 00:00:00 2001 From: michaelqi793 <78671298+michaelqi793@users.noreply.github.com> Date: Wed, 2 Jun 2021 07:11:00 +0800 Subject: [PATCH 14/53] add ut test for jre certificates (#21989) --- .../keyvault/jca/JreKeyStoreTest.java | 24 +++++++++++++++++++ .../keyvault/jca/JreKeyStoreTest.java | 3 +-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 sdk/keyvault/azure-security-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/JreKeyStoreTest.java diff --git a/sdk/keyvault/azure-security-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/JreKeyStoreTest.java b/sdk/keyvault/azure-security-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/JreKeyStoreTest.java new file mode 100644 index 000000000000..9b06a14e29e0 --- /dev/null +++ b/sdk/keyvault/azure-security-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/JreKeyStoreTest.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.jca; + +import org.junit.jupiter.api.Test; +import java.security.cert.Certificate; +import java.util.Map; +import static org.junit.jupiter.api.Assertions.*; + +public class JreKeyStoreTest { + + @Test + public void testJreKsEntries() { + JreCertificates jreCertificates = JreCertificates.getInstance(); + assertNotNull(jreCertificates); + assertNotNull(jreCertificates.getAliases()); + Map certs = jreCertificates.getCertificates(); + assertTrue(certs.size() > 0); + assertNotNull(jreCertificates.getCertificateKeys()); + } + + +} diff --git a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/JreKeyStoreTest.java b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/JreKeyStoreTest.java index 65dd4ae18fc5..11fb18b66285 100644 --- a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/JreKeyStoreTest.java +++ b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/JreKeyStoreTest.java @@ -54,8 +54,7 @@ public void testJreKsEntries() { assertNotNull(jreCertificates); assertNotNull(jreCertificates.getAliases()); Map certs = jreCertificates.getCertificates(); - assertTrue(certs.containsKey("globalsignr2ca [jdk]")); - assertNotNull(certs.get("globalsignr2ca [jdk]")); + assertTrue(certs.size() > 0); assertNotNull(jreCertificates.getCertificateKeys()); } From d39fda7e0759fc66a2322184d55ad3b36cb3243d Mon Sep 17 00:00:00 2001 From: Pallavi Taneja Date: Tue, 1 Jun 2021 17:02:37 -0700 Subject: [PATCH 15/53] Update the default authentication scope for the public cloud. (#22005) --- .../containerregistry/ContainerRegistryClientBuilder.java | 2 +- .../authentication/ContainerRegistryRefreshTokenCredential.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClientBuilder.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClientBuilder.java index 649fe3b6a29b..92d0f42d3e0e 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClientBuilder.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClientBuilder.java @@ -114,7 +114,7 @@ public ContainerRegistryClientBuilder endpoint(String endpoint) { * *

* Example:- For Azure public cloud this value is same as AzureEnvironment.Azure.managementEndpoint(). - * For more information - http://azure.github.io/ref-docs/java/com/microsoft/azure/AzureEnvironment.html + * For more information - https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-support-managed-identities#azure-resource-manager *

* * @param authenticationScope ARM management scope associated with the given registry. diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryRefreshTokenCredential.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryRefreshTokenCredential.java index 157abc1ae98c..74e811bcca10 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryRefreshTokenCredential.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/authentication/ContainerRegistryRefreshTokenCredential.java @@ -17,7 +17,7 @@ public class ContainerRegistryRefreshTokenCredential { private final TokenCredential aadTokenCredential; private final TokenServiceImpl tokenService; private final String authenticationScope; - public static final String AAD_DEFAULT_SCOPE = "https://management.core.windows.net/.default"; + public static final String AAD_DEFAULT_SCOPE = "https://management.azure.com/.default"; /** * Creates an instance of RefreshTokenCredential with default scheme "Bearer". From 301a92df8c91591845352705fa53a2814e4dcd91 Mon Sep 17 00:00:00 2001 From: Srikanta <51379715+srnagar@users.noreply.github.com> Date: Tue, 1 Jun 2021 18:03:09 -0700 Subject: [PATCH 16/53] Support getting rows as objects and map errors (#21997) * Update samples and map errors * Fix version tag --- sdk/monitor/azure-monitor-query/README.md | 124 ++++++++++++++++- sdk/monitor/azure-monitor-query/pom.xml | 6 + .../azure/monitor/query/LogsAsyncClient.java | 50 ++++++- .../monitor/query/models/LogsQueryError.java | 114 ++++++++++++++++ .../query/models/LogsQueryErrorDetails.java | 19 +-- .../query/models/LogsQueryException.java | 30 ++++ .../monitor/query/models/LogsTableRow.java | 71 +++++++++- .../monitor/query/LogsQueryWithModels.java | 128 ++++++++++++++++++ 8 files changed, 524 insertions(+), 18 deletions(-) create mode 100644 sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsQueryError.java create mode 100644 sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsQueryException.java create mode 100644 sdk/monitor/azure-monitor-query/src/samples/java/com/azure/monitor/query/LogsQueryWithModels.java diff --git a/sdk/monitor/azure-monitor-query/README.md b/sdk/monitor/azure-monitor-query/README.md index 42d0c7564c71..42edb93e036a 100644 --- a/sdk/monitor/azure-monitor-query/README.md +++ b/sdk/monitor/azure-monitor-query/README.md @@ -90,7 +90,127 @@ LogsAsyncClient logsAsyncClient = new LogsClientBuilder() + "; value = " + logsTableCell.getValueAsString())); } } -} + +``` +### Get logs for a query and read the response as a model type + +```java + + LogsQueryResult queryResults = logsClient + .queryLogs("d2d0e126-fa1e-4b0a-b647-250cdd471e68", "AppRequests", null); + + // Sample to use a model type to read the results + for (LogsTable table : queryResults.getLogsTables()) { + for (LogsTableRow row : table.getTableRows()) { + CustomModel model = row.getRowAsObject(CustomModel.class); + System.out.println("Time generated " + model.getTimeGenerated() + "; success = " + model.getSuccess() + + "; operation name = " + model.getOperationName()); + } + } + + + public class CustomModel { + private OffsetDateTime timeGenerated; + private String tenantId; + private String id; + private String source; + private Boolean success; + private Double durationMs; + private Object properties; + private Object measurements; + private String operationName; + private String operationId; + private Object operationLinks; + + + public OffsetDateTime getTimeGenerated() { + return timeGenerated; + } + + public void setTimeGenerated(OffsetDateTime timeGenerated) { + this.timeGenerated = timeGenerated; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public Boolean getSuccess() { + return success; + } + + public void setSuccess(Boolean success) { + this.success = success; + } + + public Double getDurationMs() { + return durationMs; + } + + public void setDurationMs(Double durationMs) { + this.durationMs = durationMs; + } + + public Object getProperties() { + return properties; + } + + public void setProperties(Object properties) { + this.properties = properties; + } + + public Object getMeasurements() { + return measurements; + } + + public void setMeasurements(Object measurements) { + this.measurements = measurements; + } + + public String getOperationName() { + return operationName; + } + + public void setOperationName(String operationName) { + this.operationName = operationName; + } + + public String getOperationId() { + return operationId; + } + + public void setOperationId(String operationId) { + this.operationId = operationId; + } + + public Object getOperationLinks() { + return operationLinks; + } + + public void setOperationLinks(Object operationLinks) { + this.operationLinks = operationLinks; + } + } ``` ### Get logs for a batch of queries @@ -272,7 +392,7 @@ client library to use the Netty HTTP client. Configuring or changing the HTTP cl All client libraries, by default, use the Tomcat-native Boring SSL library to enable native-level performance for SSL operations. The Boring SSL library is an uber jar containing native libraries for Linux / macOS / Windows, and provides -better performance compared to the default SSL implementation within the JDK. For more information, including how to +better performance compared to the default SSL com.azure.monitor.collect.metrics.implementation within the JDK. For more information, including how to reduce the dependency size, refer to the [performance tuning][performance_tuning] section of the wiki. ## Next steps diff --git a/sdk/monitor/azure-monitor-query/pom.xml b/sdk/monitor/azure-monitor-query/pom.xml index 2f4074c25aa8..9d0be9049e48 100644 --- a/sdk/monitor/azure-monitor-query/pom.xml +++ b/sdk/monitor/azure-monitor-query/pom.xml @@ -73,6 +73,12 @@ 1.6.2 test + + com.azure + azure-core-serializer-json-jackson + 1.2.3 + test + diff --git a/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/LogsAsyncClient.java b/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/LogsAsyncClient.java index 2024ba22a76e..a845e17a7e19 100644 --- a/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/LogsAsyncClient.java +++ b/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/LogsAsyncClient.java @@ -13,6 +13,7 @@ import com.azure.monitor.query.log.implementation.models.BatchRequest; import com.azure.monitor.query.log.implementation.models.BatchResponse; import com.azure.monitor.query.log.implementation.models.ErrorInfo; +import com.azure.monitor.query.log.implementation.models.ErrorResponseException; import com.azure.monitor.query.log.implementation.models.LogQueryRequest; import com.azure.monitor.query.log.implementation.models.LogQueryResponse; import com.azure.monitor.query.log.implementation.models.LogQueryResult; @@ -22,7 +23,9 @@ import com.azure.monitor.query.models.LogsQueryBatch; import com.azure.monitor.query.models.LogsQueryBatchResult; import com.azure.monitor.query.models.LogsQueryBatchResultCollection; +import com.azure.monitor.query.models.LogsQueryError; import com.azure.monitor.query.models.LogsQueryErrorDetails; +import com.azure.monitor.query.models.LogsQueryException; import com.azure.monitor.query.models.LogsQueryOptions; import com.azure.monitor.query.models.LogsQueryResult; import com.azure.monitor.query.models.LogsTable; @@ -33,6 +36,7 @@ import reactor.core.publisher.Mono; import java.util.ArrayList; +import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; @@ -128,6 +132,14 @@ Mono> queryLogsBatchWithResponse(LogsQu batchRequest.setRequests(requests); return innerClient.getQueries().batchWithResponseAsync(batchRequest, context) + .onErrorMap(ex -> { + if (ex instanceof ErrorResponseException) { + ErrorResponseException error = (ErrorResponseException) ex; + ErrorInfo errorInfo = error.getValue().getError(); + return new LogsQueryException(error.getResponse(), mapLogsQueryError(errorInfo)); + } + return ex; + }) .map(this::convertToLogQueryBatchResult); } @@ -139,17 +151,39 @@ private Response convertToLogQueryBatchResult(Re for (LogQueryResponse singleQueryResponse : batchResponse.getResponses()) { LogsQueryBatchResult logsQueryBatchResult = new LogsQueryBatchResult(singleQueryResponse.getId(), singleQueryResponse.getStatus(), getLogsQueryResult(singleQueryResponse.getBody()), - mapLogsQueryBatchError(singleQueryResponse.getBody().getError())); + mapLogsQueryError(singleQueryResponse.getBody().getError())); batchResults.add(logsQueryBatchResult); } batchResults.sort(Comparator.comparingInt(o -> Integer.parseInt(o.getId()))); return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), logsQueryBatchResultCollection); } - private LogsQueryErrorDetails mapLogsQueryBatchError(ErrorInfo errors) { + private LogsQueryErrorDetails mapLogsQueryError(ErrorInfo errors) { if (errors != null) { - return new LogsQueryErrorDetails(errors.getMessage(), errors.getCode(), - errors.getDetails().get(0).getTarget()); + List errorDetails = Collections.emptyList(); + if (errors.getDetails() != null) { + errorDetails = errors.getDetails() + .stream() + .map(errorDetail -> new LogsQueryError(errorDetail.getCode(), + errorDetail.getMessage(), + errorDetail.getTarget(), + errorDetail.getValue(), + errorDetail.getResources(), + errorDetail.getAdditionalProperties())) + .collect(Collectors.toList()); + } + + ErrorInfo innerError = errors.getInnererror(); + ErrorInfo currentError = errors.getInnererror(); + while (currentError != null) { + innerError = errors.getInnererror(); + currentError = errors.getInnererror(); + } + String code = errors.getCode(); + if (!errors.getCode().equals(innerError.getCode())) { + code = innerError.getCode(); + } + return new LogsQueryErrorDetails(errors.getMessage(), code, errorDetails); } return null; } @@ -186,6 +220,14 @@ Mono> queryLogsWithResponse(LogsQueryOptions options, queryBody, preferHeader, context) + .onErrorMap(ex -> { + if (ex instanceof ErrorResponseException) { + ErrorResponseException error = (ErrorResponseException) ex; + ErrorInfo errorInfo = error.getValue().getError(); + return new LogsQueryException(error.getResponse(), mapLogsQueryError(errorInfo)); + } + return ex; + }) .map(this::convertToLogQueryResult); } diff --git a/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsQueryError.java b/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsQueryError.java new file mode 100644 index 000000000000..61d65c40006f --- /dev/null +++ b/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsQueryError.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.monitor.query.models; + +import java.util.List; + +/** + * Error details of a failed log query. + */ + +public final class LogsQueryError { + /* + * The error's code. + */ + private final String code; + + /* + * A human readable error message. + */ + private final String message; + + /* + * Indicates which property in the request is responsible for the error. + */ + private final String target; + + /* + * Indicates which value in 'target' is responsible for the error. + */ + private final String value; + + /* + * Indicates resources which were responsible for the error. + */ + private final List resources; + + /* + * Additional properties that can be provided on the error details object + */ + private final Object additionalProperties; + + /** + * Creates an instance of ErrorDetail class. + * @param code the code value to set. + * @param message the message value to set. + * @param target indicates which property in the request is responsible for the error. + * @param value indicates which value in 'target' is responsible for the error. + * @param resources indicates resources which were responsible for the error. + * @param additionalProperties additional properties that can be provided on the error details object + */ + public LogsQueryError( + String code, + String message, + String target, + String value, + List resources, + Object additionalProperties) { + this.code = code; + this.message = message; + this.target = target; + this.value = value; + this.resources = resources; + this.additionalProperties = additionalProperties; + } + + /** + * Get the code property: The error's code. + * @return the code value. + */ + public String getCode() { + return this.code; + } + + /** + * Get the message property: A human readable error message. + * @return the message value. + */ + public String getMessage() { + return this.message; + } + + /** + * Get the target property: Indicates which property in the request is responsible for the error. + * @return the target value. + */ + public String getTarget() { + return this.target; + } + + /** + * Get the value property: Indicates which value in 'target' is responsible for the error. + * @return the value value. + */ + public String getValue() { + return this.value; + } + + /** + * Get the resources property: Indicates resources which were responsible for the error. + * @return the resources value. + */ + public List getResources() { + return this.resources; + } + + /** + * Get the additionalProperties property: Additional properties that can be provided on the error details object. + * @return the additionalProperties value. + */ + public Object getAdditionalProperties() { + return this.additionalProperties; + } +} diff --git a/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsQueryErrorDetails.java b/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsQueryErrorDetails.java index 90f3d434dd58..86da66d53490 100644 --- a/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsQueryErrorDetails.java +++ b/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsQueryErrorDetails.java @@ -5,6 +5,8 @@ import com.azure.core.annotation.Immutable; +import java.util.List; + /** * The error details of a failed log query. */ @@ -12,19 +14,18 @@ public final class LogsQueryErrorDetails { private final String message; private final String code; - private final String target; + private final List errors; /** * Creates an instance of {@link LogsQueryErrorDetails} with the failure code and target. * @param message The error message. * @param code The error code indicating the reason for the error. - * @param target Indicates which property in the request is responsible for the error. + * @param errors The list of additional error details. */ - public LogsQueryErrorDetails(String message, String code, String target) { - + public LogsQueryErrorDetails(String message, String code, List errors) { this.message = message; this.code = code; - this.target = target; + this.errors = errors; } /** @@ -44,10 +45,10 @@ public String getCode() { } /** - * Indicates which property in the request is responsible for the error. - * @return The property in the request that is responsible for the error. + * Returns the list of additional error details. + * @return the list of additional error details. */ - public String getTarget() { - return target; + public List getErrors() { + return errors; } } diff --git a/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsQueryException.java b/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsQueryException.java new file mode 100644 index 000000000000..9916ba59af88 --- /dev/null +++ b/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsQueryException.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.monitor.query.models; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpResponse; + +/** + * Exception thrown when a query to retrieve logs fails. + */ +public final class LogsQueryException extends HttpResponseException { + private final transient LogsQueryErrorDetails error; + + /** + * Creates a new instance of this exception with the {@link HttpResponse} and {@link LogsQueryError error} + * information. + * @param response The {@link HttpResponse}. + * @param error The {@link LogsQueryError error} details. + */ + public LogsQueryException(HttpResponse response, LogsQueryErrorDetails error) { + super("Failed to executed logs query", response, error); + this.error = error; + } + + @Override + public LogsQueryErrorDetails getValue() { + return this.error; + } +} diff --git a/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsTableRow.java b/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsTableRow.java index 600433356f17..f34b6ed09686 100644 --- a/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsTableRow.java +++ b/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsTableRow.java @@ -4,9 +4,16 @@ package com.azure.monitor.query.models; import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.TypeReference; +import java.lang.reflect.Field; +import java.util.Arrays; import java.util.List; +import java.util.Locale; +import java.util.Map; import java.util.Optional; +import java.util.stream.Collectors; /** * Represents a row in a {@link LogsTable} of a logs query. @@ -15,6 +22,7 @@ public final class LogsTableRow { private final int rowIndex; private final List tableRow; + private final ClientLogger logger = new ClientLogger(LogsTableRow.class); /** * Creates a row in a {@link LogsTable} of a logs query. @@ -46,12 +54,69 @@ public List getTableRow() { * Returns the value associated with the given column name. If the column name is not found * {@link Optional#isPresent()} evaluates to {@code false}. * @param columnName the column name for which the value is returned. - * * @return The value associated with the given column name. */ public Optional getColumnValue(String columnName) { return tableRow.stream() - .filter(cell -> cell.getColumnName().equals(columnName)) - .findFirst(); + .filter(cell -> cell.getColumnName().equals(columnName)) + .findFirst(); + } + + /** + * Returns the table row as an object of the given {@code type}. The field names on the type should be + * reflectively accessible and the names should match the column names. If the table row contains columns that + * are not available on the object, they are ignored and similarly if the fields in the object are not found in + * the table columns, they will be null. + * @param type The type of the object to be returned + * @param The class type. + * @return The object that this table row is mapped to. + * @throws IllegalArgumentException if an instance of the object cannot be created. + */ + public T getRowAsObject(Class type) { + try { + T t = type.newInstance(); + + Map declaredFieldMapping = Arrays.stream(type.getDeclaredFields()) + .collect(Collectors.toMap(field -> field.getName().toLowerCase(Locale.ROOT), field -> field)); + + tableRow.stream() + .forEach(tableCell -> { + String columnName = tableCell.getColumnName(); + try { + Field field = declaredFieldMapping.get(columnName.toLowerCase(Locale.ROOT)); + if (field == null) { + return; + } + field.setAccessible(true); + if (tableCell.getColumnType() == ColumnDataType.BOOL) { + field.set(t, tableCell.getValueAsBoolean()); + } else if (tableCell.getColumnType() == ColumnDataType.DATETIME) { + field.set(t, tableCell.getValueAsDateTime()); + } else if (tableCell.getColumnType() == ColumnDataType.DYNAMIC) { + if (tableCell.getValueAsDynamic() != null) { + field.set(t, + tableCell.getValueAsDynamic() + .toObject(TypeReference.createInstance(field.getType()))); + } + } else if (tableCell.getColumnType() == ColumnDataType.INT) { + field.set(t, tableCell.getValueAsInteger()); + } else if (tableCell.getColumnType() == ColumnDataType.LONG) { + field.set(t, tableCell.getValueAsLong()); + } else if (tableCell.getColumnType() == ColumnDataType.REAL) { + field.set(t, tableCell.getValueAsDouble()); + } else if (tableCell.getColumnType() == ColumnDataType.STRING) { + field.set(t, tableCell.getValueAsString()); + } + field.setAccessible(false); + } catch (IllegalAccessException ex) { + throw logger.logExceptionAsError( + new IllegalArgumentException("Failed to set column value for " + columnName, ex)); + } + }); + return t; + } catch (InstantiationException | IllegalAccessException ex) { + throw logger.logExceptionAsError( + new IllegalArgumentException("Cannot create an instance of class " + type.getName(), ex)); + } } } diff --git a/sdk/monitor/azure-monitor-query/src/samples/java/com/azure/monitor/query/LogsQueryWithModels.java b/sdk/monitor/azure-monitor-query/src/samples/java/com/azure/monitor/query/LogsQueryWithModels.java new file mode 100644 index 000000000000..9757dc91d2ac --- /dev/null +++ b/sdk/monitor/azure-monitor-query/src/samples/java/com/azure/monitor/query/LogsQueryWithModels.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.monitor.query; + +import com.azure.core.util.Configuration; +import com.azure.identity.ClientSecretCredential; +import com.azure.identity.ClientSecretCredentialBuilder; +import com.azure.monitor.query.models.LogsQueryResult; +import com.azure.monitor.query.models.LogsTable; +import com.azure.monitor.query.models.LogsTableRow; + +import java.time.OffsetDateTime; + +/** + * Sample to demonstrate using a custom model to read the results of a logs query. + */ +public class LogsQueryWithModels { + + /** + * The main method to run the sample. + * @param args ignored args + */ + public static void main(String[] args) { + ClientSecretCredential tokenCredential = new ClientSecretCredentialBuilder() + .clientId(Configuration.getGlobalConfiguration().get("AZURE_MONITOR_CLIENT_ID")) + .clientSecret(Configuration.getGlobalConfiguration().get("AZURE_MONITOR_CLIENT_SECRET")) + .tenantId(Configuration.getGlobalConfiguration().get("AZURE_TENANT_ID")) + .build(); + + LogsClient logsClient = new LogsClientBuilder() + .credential(tokenCredential) + .buildClient(); + + LogsQueryResult queryResults = logsClient + .queryLogs("{workspace-id}", "AppRequests", null); + + // Sample to use a model type to read the results + for (LogsTable table : queryResults.getLogsTables()) { + for (LogsTableRow row : table.getTableRows()) { + CustomModel model = row.getRowAsObject(CustomModel.class); + System.out.println("Time generated " + model.getTimeGenerated() + "; success = " + model.getSuccess() + + "; operation name = " + model.getOperationName()); + } + } + } + + /** + * A custom model to read the logs query result. + */ + private static class CustomModel { + private OffsetDateTime timeGenerated; + private String tenantId; + private String id; + private String source; + private Boolean success; + private Double durationMs; + private Object properties; + private String operationName; + private String operationId; + + + /** + * Returns the time the log event was generated. + * @return the time the log event was generated. + */ + public OffsetDateTime getTimeGenerated() { + return timeGenerated; + } + + /** + * Returns the tenant id of the resource for which this log was recorded. + * @return the tenant id of the resource for which this log was recorded. + */ + public String getTenantId() { + return tenantId; + } + + /** + * Returns the unique identifier of this log. + * @return the unique identifier of this log. + */ + public String getId() { + return id; + } + + /** + * Returns the source of this log. + * @return the source of this log. + */ + public String getSource() { + return source; + } + + /** + * Returns {@code true} if the logged request returned a successful response. + * @return {@code true} if the logged request returned a successful response. + */ + public Boolean getSuccess() { + return success; + } + + /** + * Returns the time duration the service took to process the request. + * @return the time duration the service took to process the request. + */ + public Double getDurationMs() { + return durationMs; + } + + /** + * Returns additional properties of the request. + * @return additional properties of the request. + */ + public Object getProperties() { + return properties; + } + + /** + * Returns the name of the operation. + * @return the name of the operation. + */ + public String getOperationName() { + return operationName; + } + } + +} From 6a9d9bcb62d8fcf27c8754644e1193cacd5c1bf5 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Wed, 2 Jun 2021 09:34:19 +0800 Subject: [PATCH 17/53] mgmt, support multiple source/destination ASG in NSG (#21980) * mgmt, support multiple source/destination ASG in NSG * checkstyle * changelog --- .../CHANGELOG.md | 1 + .../NetworkSecurityRuleImpl.java | 39 +- .../network/models/NetworkSecurityRule.java | 49 + .../network/NetworkSecurityGroupTests.java | 117 +++ ...roupTests.canCRUDNetworkSecurityGroup.json | 876 ++++++++++++++++++ 5 files changed, 1081 insertions(+), 1 deletion(-) create mode 100644 sdk/resourcemanager/azure-resourcemanager-network/src/test/java/com/azure/resourcemanager/network/NetworkSecurityGroupTests.java create mode 100644 sdk/resourcemanager/azure-resourcemanager-network/src/test/resources/session-records/NetworkSecurityGroupTests.canCRUDNetworkSecurityGroup.json diff --git a/sdk/resourcemanager/azure-resourcemanager-network/CHANGELOG.md b/sdk/resourcemanager/azure-resourcemanager-network/CHANGELOG.md index 1045006d6828..3ff4168562c3 100644 --- a/sdk/resourcemanager/azure-resourcemanager-network/CHANGELOG.md +++ b/sdk/resourcemanager/azure-resourcemanager-network/CHANGELOG.md @@ -3,6 +3,7 @@ ## 2.6.0-beta.1 (Unreleased) - Updated `api-version` to `2021-02-01` +- Supported multiple `ApplicationSecurityGroup` in rules of `NetworkSecurityGroup`. ## 2.5.0 (2021-05-28) - Updated `api-version` to `2020-11-01` diff --git a/sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/NetworkSecurityRuleImpl.java b/sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/NetworkSecurityRuleImpl.java index c9a8e791c51f..504ef2d462d8 100644 --- a/sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/NetworkSecurityRuleImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/NetworkSecurityRuleImpl.java @@ -19,6 +19,8 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; /** Implementation for {@link NetworkSecurityRule} and its create and update interfaces. */ class NetworkSecurityRuleImpl @@ -286,6 +288,21 @@ public NetworkSecurityRuleImpl withSourceApplicationSecurityGroup(String id) { return this; } + @Override + public NetworkSecurityRuleImpl withoutSourceApplicationSecurityGroup(String id) { + sourceAsgs.remove(id); + return this; + } + + @Override + public NetworkSecurityRuleImpl withSourceApplicationSecurityGroup(String... ids) { + sourceAsgs = Arrays.stream(ids) + .collect(Collectors.toMap(Function.identity(), id -> new ApplicationSecurityGroupInner().withId(id))); + innerModel().withSourceAddressPrefix(null); + innerModel().withSourceAddressPrefixes(null); + return this; + } + @Override public NetworkSecurityRuleImpl withDestinationApplicationSecurityGroup(String id) { destinationAsgs.put(id, new ApplicationSecurityGroupInner().withId(id)); @@ -294,6 +311,21 @@ public NetworkSecurityRuleImpl withDestinationApplicationSecurityGroup(String id return this; } + @Override + public NetworkSecurityRuleImpl withoutDestinationApplicationSecurityGroup(String id) { + destinationAsgs.remove(id); + return this; + } + + @Override + public NetworkSecurityRuleImpl withDestinationApplicationSecurityGroup(String... ids) { + destinationAsgs = Arrays.stream(ids) + .collect(Collectors.toMap(Function.identity(), id -> new ApplicationSecurityGroupInner().withId(id))); + innerModel().withDestinationAddressPrefix(null); + innerModel().withDestinationAddressPrefixes(null); + return this; + } + // Helpers private NetworkSecurityRuleImpl withDirection(SecurityRuleDirection direction) { @@ -310,9 +342,14 @@ private NetworkSecurityRuleImpl withAccess(SecurityRuleAccess permission) { @Override public NetworkSecurityGroupImpl attach() { + return this.parent().withRule(this); + } + + @Override + public NetworkSecurityGroupImpl parent() { innerModel().withSourceApplicationSecurityGroups(new ArrayList<>(sourceAsgs.values())); innerModel().withDestinationApplicationSecurityGroups(new ArrayList<>(destinationAsgs.values())); - return this.parent().withRule(this); + return super.parent(); } @Override diff --git a/sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/models/NetworkSecurityRule.java b/sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/models/NetworkSecurityRule.java index 4cc279da9f49..67da7b0688ea 100644 --- a/sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/models/NetworkSecurityRule.java +++ b/sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/models/NetworkSecurityRule.java @@ -8,6 +8,7 @@ import com.azure.resourcemanager.resources.fluentcore.model.Attachable; import com.azure.resourcemanager.resources.fluentcore.model.HasInnerModel; import com.azure.resourcemanager.resources.fluentcore.model.Settable; + import java.util.List; import java.util.Set; @@ -200,6 +201,14 @@ interface WithDestinationAddressOrSecurityGroup { * @return the next stage of the definition */ WithDestinationPort withDestinationApplicationSecurityGroup(String id); + + /** + * Sets the application security group specified as destination. + * + * @param ids the collection of application security group ID + * @return the next stage of the definition + */ + WithDestinationPort withDestinationApplicationSecurityGroup(String... ids); } /** @@ -279,6 +288,14 @@ interface WithSourceAddressOrSecurityGroup { * @return the next stage of the definition */ WithSourcePort withSourceApplicationSecurityGroup(String id); + + /** + * Sets the application security group specified as source. + * + * @param ids the collection of application security group ID + * @return the next stage of the definition + */ + WithSourcePort withSourceApplicationSecurityGroup(String... ids); } /** @@ -460,6 +477,14 @@ interface WithSourceAddressOrSecurityGroup { * @return the next stage of the update */ WithSourcePort withSourceApplicationSecurityGroup(String id); + + /** + * Sets the application security group specified as source. + * + * @param ids the collection of application security group ID + * @return the next stage of the definition + */ + WithSourcePort withSourceApplicationSecurityGroup(String... ids); } /** @@ -539,6 +564,14 @@ interface WithDestinationAddressOrSecurityGroup { * @return the next stage of the definition */ WithDestinationPort withDestinationApplicationSecurityGroup(String id); + + /** + * Sets the application security group specified as destination. + * + * @param ids the collection of application security group ID + * @return the next stage of the definition + */ + WithDestinationPort withDestinationApplicationSecurityGroup(String... ids); } /** @@ -730,6 +763,14 @@ interface WithSourceAddressOrSecurityGroup { * @return the next stage of the update */ Update withSourceApplicationSecurityGroup(String id); + + /** + * Removes the application security group specified as source. + * + * @param id application security group id + * @return the next stage of the update + */ + Update withoutSourceApplicationSecurityGroup(String id); } /** The stage of the network rule description allowing the source port(s) to be specified. */ @@ -803,6 +844,14 @@ interface WithDestinationAddressOrSecurityGroup { * @return the next stage of the update */ Update withDestinationApplicationSecurityGroup(String id); + + /** + * Removes the application security group specified as destination. + * + * @param id application security group id + * @return the next stage of the definition + */ + Update withoutDestinationApplicationSecurityGroup(String id); } /** The stage of the network rule description allowing the destination port(s) to be specified. */ diff --git a/sdk/resourcemanager/azure-resourcemanager-network/src/test/java/com/azure/resourcemanager/network/NetworkSecurityGroupTests.java b/sdk/resourcemanager/azure-resourcemanager-network/src/test/java/com/azure/resourcemanager/network/NetworkSecurityGroupTests.java new file mode 100644 index 000000000000..be0c30f7dca4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-network/src/test/java/com/azure/resourcemanager/network/NetworkSecurityGroupTests.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.network; + +import com.azure.core.management.Region; +import com.azure.resourcemanager.network.models.ApplicationSecurityGroup; +import com.azure.resourcemanager.network.models.NetworkSecurityGroup; +import com.azure.resourcemanager.network.models.SecurityRuleProtocol; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.HashSet; + +public class NetworkSecurityGroupTests extends NetworkManagementTest { + + @Test + public void canCRUDNetworkSecurityGroup() { + + final String asgName = generateRandomResourceName("asg", 8); + final String asgName2 = generateRandomResourceName("asg", 8); + final String asgName3 = generateRandomResourceName("asg", 8); + final String asgName4 = generateRandomResourceName("asg", 8); + final String asgName5 = generateRandomResourceName("asg", 8); + final String asgName6 = generateRandomResourceName("asg", 8); + final String nsgName = generateRandomResourceName("nsg", 8); + + final Region region = Region.US_SOUTH_CENTRAL; + + ApplicationSecurityGroup asg = networkManager.applicationSecurityGroups().define(asgName) + .withRegion(region) + .withNewResourceGroup(rgName) + .create(); + + ApplicationSecurityGroup asg2 = networkManager.applicationSecurityGroups().define(asgName2) + .withRegion(region) + .withExistingResourceGroup(rgName) + .create(); + + ApplicationSecurityGroup asg3 = networkManager.applicationSecurityGroups().define(asgName3) + .withRegion(region) + .withExistingResourceGroup(rgName) + .create(); + + ApplicationSecurityGroup asg4 = networkManager.applicationSecurityGroups().define(asgName4) + .withRegion(region) + .withExistingResourceGroup(rgName) + .create(); + + NetworkSecurityGroup nsg = networkManager.networkSecurityGroups().define(nsgName) + .withRegion(region) + .withExistingResourceGroup(rgName) + .defineRule("rule1") + .allowOutbound() + .fromAnyAddress() + .fromAnyPort() + .toAnyAddress() + .toPort(80) + .withProtocol(SecurityRuleProtocol.TCP) + .attach() + .defineRule("rule2") + .allowInbound() + .withSourceApplicationSecurityGroup(asg.id(), asg2.id()) + .fromAnyPort() + .toAnyAddress() + .toPortRange(22, 25) + .withAnyProtocol() + .withPriority(200) + .withDescription("foo!!") + .attach() + .defineRule("rule3") + .denyInbound() + .fromAnyAddress() + .fromAnyPort() + .withDestinationApplicationSecurityGroup(asg3.id(), asg4.id()) + .toPort(22) + .withAnyProtocol() + .withPriority(300) + .attach() + .create(); + + Assertions.assertEquals(2, nsg.securityRules().get("rule2").sourceApplicationSecurityGroupIds().size()); + Assertions.assertEquals(2, nsg.securityRules().get("rule3").destinationApplicationSecurityGroupIds().size()); + Assertions.assertEquals(new HashSet<>(Arrays.asList(asg.id(), asg2.id())), nsg.securityRules().get("rule2").sourceApplicationSecurityGroupIds()); + Assertions.assertEquals(new HashSet<>(Arrays.asList(asg3.id(), asg4.id())), nsg.securityRules().get("rule3").destinationApplicationSecurityGroupIds()); + + ApplicationSecurityGroup asg5 = networkManager.applicationSecurityGroups().define(asgName5) + .withRegion(region) + .withExistingResourceGroup(rgName) + .create(); + + ApplicationSecurityGroup asg6 = networkManager.applicationSecurityGroups().define(asgName6) + .withRegion(region) + .withExistingResourceGroup(rgName) + .create(); + + nsg.update() + .updateRule("rule2") + .withoutSourceApplicationSecurityGroup(asg2.id()) + .withSourceApplicationSecurityGroup(asg5.id()) + .parent() + .updateRule("rule3") + .withoutDestinationApplicationSecurityGroup(asg4.id()) + .withDestinationApplicationSecurityGroup(asg6.id()) + .parent() + .apply(); + + Assertions.assertEquals(2, nsg.securityRules().get("rule2").sourceApplicationSecurityGroupIds().size()); + Assertions.assertEquals(2, nsg.securityRules().get("rule3").destinationApplicationSecurityGroupIds().size()); + Assertions.assertEquals(new HashSet<>(Arrays.asList(asg.id(), asg5.id())), nsg.securityRules().get("rule2").sourceApplicationSecurityGroupIds()); + Assertions.assertEquals(new HashSet<>(Arrays.asList(asg3.id(), asg6.id())), nsg.securityRules().get("rule3").destinationApplicationSecurityGroupIds()); + + networkManager.networkSecurityGroups().deleteById(nsg.id()); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager-network/src/test/resources/session-records/NetworkSecurityGroupTests.canCRUDNetworkSecurityGroup.json b/sdk/resourcemanager/azure-resourcemanager-network/src/test/resources/session-records/NetworkSecurityGroupTests.canCRUDNetworkSecurityGroup.json new file mode 100644 index 000000000000..969168e8e45a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-network/src/test/resources/session-records/NetworkSecurityGroupTests.canCRUDNetworkSecurityGroup.json @@ -0,0 +1,876 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/javanwmrg43015?api-version=2021-01-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "2739a8e5-1b0f-4964-b8e7-da3499aeba94", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "233", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1199", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-correlation-request-id" : "faf27ad5-bc10-4481-bc55-cf59e027efa5", + "Date" : "Tue, 01 Jun 2021 06:13:49 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061350Z:faf27ad5-bc10-4481-bc55-cf59e027efa5", + "Expires" : "-1", + "x-ms-request-id" : "faf27ad5-bc10-4481-bc55-cf59e027efa5", + "Body" : "{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015\",\"name\":\"javanwmrg43015\",\"type\":\"Microsoft.Resources/resourceGroups\",\"location\":\"southcentralus\",\"properties\":{\"provisioningState\":\"Succeeded\"}}", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg55439?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.network/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "653ba9c3-88ca-48a5-9208-956a022a33df", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "408", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1198", + "Pragma" : "no-cache", + "Azure-AsyncNotification" : "Enabled", + "StatusCode" : "201", + "x-ms-correlation-request-id" : "8de49eba-d94a-4499-aab4-edb836376756", + "Date" : "Tue, 01 Jun 2021 06:13:57 GMT", + "x-ms-arm-service-request-id" : "45b0ae59-2902-4819-a1ca-6e0b88ea6402", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "Retry-After" : "0", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061357Z:8de49eba-d94a-4499-aab4-edb836376756", + "Expires" : "-1", + "Azure-AsyncOperation" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/01e2317f-d481-4549-9c6e-486e0e3c9c9a?api-version=2021-02-01", + "x-ms-request-id" : "01e2317f-d481-4549-9c6e-486e0e3c9c9a", + "Body" : "{\r\n \"name\": \"asg55439\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg55439\",\r\n \"etag\": \"W/\\\"dfe747cc-7c21-43a2-9943-2064776ddea7\\\"\",\r\n \"type\": \"Microsoft.Network/applicationSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\r\n }\r\n}", + "x-ms-client-request-id" : "653ba9c3-88ca-48a5-9208-956a022a33df", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/01e2317f-d481-4549-9c6e-486e0e3c9c9a?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "8144dd40-0e99-47b9-aa9b-784100c0d40b" + }, + "Response" : { + "content-length" : "29", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11999", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "aa9e9595-9bb4-4536-9e5c-f1102cdbc0ed", + "Date" : "Tue, 01 Jun 2021 06:14:07 GMT", + "x-ms-arm-service-request-id" : "2666e124-566c-4a25-9661-4d4f726ed236", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061407Z:aa9e9595-9bb4-4536-9e5c-f1102cdbc0ed", + "Expires" : "-1", + "x-ms-request-id" : "9603356c-b1de-4149-80b9-77d1a5f971e1", + "Body" : "{\r\n \"status\": \"Succeeded\"\r\n}", + "x-ms-client-request-id" : "8144dd40-0e99-47b9-aa9b-784100c0d40b", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg55439?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "3d522d2e-2af2-47dd-b87a-530a1b5f0749" + }, + "Response" : { + "content-length" : "409", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11998", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "a2ba2d63-8dda-4b46-9bea-ec9e2df89c2a", + "Date" : "Tue, 01 Jun 2021 06:14:07 GMT", + "x-ms-arm-service-request-id" : "7fd6bb8c-4f0a-4916-804c-8dd8343bc573", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "ETag" : "W/\"cf6f2ed9-9a95-4e87-8874-bea58272d43a\"", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061408Z:a2ba2d63-8dda-4b46-9bea-ec9e2df89c2a", + "Expires" : "-1", + "x-ms-request-id" : "bed21bb1-9002-4ab5-868e-5356db63d4ba", + "Body" : "{\r\n \"name\": \"asg55439\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg55439\",\r\n \"etag\": \"W/\\\"cf6f2ed9-9a95-4e87-8874-bea58272d43a\\\"\",\r\n \"type\": \"Microsoft.Network/applicationSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "x-ms-client-request-id" : "3d522d2e-2af2-47dd-b87a-530a1b5f0749", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg08975?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.network/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "d20cd178-188f-465a-a337-20ce4dc69e7b", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "408", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1197", + "Pragma" : "no-cache", + "Azure-AsyncNotification" : "Enabled", + "StatusCode" : "201", + "x-ms-correlation-request-id" : "55b68da2-ae95-4831-80fb-b206fc50190e", + "Date" : "Tue, 01 Jun 2021 06:14:11 GMT", + "x-ms-arm-service-request-id" : "c04d6ba4-8bfa-4efa-abb8-285faaec63d1", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "Retry-After" : "0", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061412Z:55b68da2-ae95-4831-80fb-b206fc50190e", + "Expires" : "-1", + "Azure-AsyncOperation" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/2b1c1b43-4722-4a99-bec6-a73a18ad5744?api-version=2021-02-01", + "x-ms-request-id" : "2b1c1b43-4722-4a99-bec6-a73a18ad5744", + "Body" : "{\r\n \"name\": \"asg08975\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg08975\",\r\n \"etag\": \"W/\\\"f3aee8de-d30d-484b-8142-bfabc02fb303\\\"\",\r\n \"type\": \"Microsoft.Network/applicationSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\r\n }\r\n}", + "x-ms-client-request-id" : "d20cd178-188f-465a-a337-20ce4dc69e7b", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/2b1c1b43-4722-4a99-bec6-a73a18ad5744?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "e43ff4cb-a34e-4276-9d95-e96254c2a9ec" + }, + "Response" : { + "content-length" : "29", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11997", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "6a28f4fe-f1ba-470c-b692-ea95e1cd1dc4", + "Date" : "Tue, 01 Jun 2021 06:14:22 GMT", + "x-ms-arm-service-request-id" : "62e197da-74b4-4f68-8907-b30599ca65f7", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061422Z:6a28f4fe-f1ba-470c-b692-ea95e1cd1dc4", + "Expires" : "-1", + "x-ms-request-id" : "a2307121-be56-447b-a197-6c68b5fe1176", + "Body" : "{\r\n \"status\": \"Succeeded\"\r\n}", + "x-ms-client-request-id" : "e43ff4cb-a34e-4276-9d95-e96254c2a9ec", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg08975?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "7d1e83f7-d10a-4f54-8337-75faf9e7aa3a" + }, + "Response" : { + "content-length" : "409", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11996", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "8ac7487d-8b65-46ad-96c8-a28219f17fcf", + "Date" : "Tue, 01 Jun 2021 06:14:22 GMT", + "x-ms-arm-service-request-id" : "04623989-1e43-4965-ad9b-38de5a0a9d01", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "ETag" : "W/\"c89b4961-6113-4a18-9b8f-8fa18466c304\"", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061423Z:8ac7487d-8b65-46ad-96c8-a28219f17fcf", + "Expires" : "-1", + "x-ms-request-id" : "3b92930b-6cdb-4e73-8f33-88bafc043ecb", + "Body" : "{\r\n \"name\": \"asg08975\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg08975\",\r\n \"etag\": \"W/\\\"c89b4961-6113-4a18-9b8f-8fa18466c304\\\"\",\r\n \"type\": \"Microsoft.Network/applicationSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "x-ms-client-request-id" : "7d1e83f7-d10a-4f54-8337-75faf9e7aa3a", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg37860?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.network/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "ca0f32ae-87af-4903-bbdb-aac23c117d50", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "408", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1196", + "Pragma" : "no-cache", + "Azure-AsyncNotification" : "Enabled", + "StatusCode" : "201", + "x-ms-correlation-request-id" : "707ad0cf-ef1c-4378-aa80-65a8547bad85", + "Date" : "Tue, 01 Jun 2021 06:14:26 GMT", + "x-ms-arm-service-request-id" : "9dcfe469-abb3-4fbc-8bbf-241c7e5861dc", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "Retry-After" : "0", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061427Z:707ad0cf-ef1c-4378-aa80-65a8547bad85", + "Expires" : "-1", + "Azure-AsyncOperation" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/b7dc70e2-c28f-4c66-9fcf-e368ffa3c07b?api-version=2021-02-01", + "x-ms-request-id" : "b7dc70e2-c28f-4c66-9fcf-e368ffa3c07b", + "Body" : "{\r\n \"name\": \"asg37860\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg37860\",\r\n \"etag\": \"W/\\\"4d44ccf9-35a6-42fc-a87a-87a246f1ef3e\\\"\",\r\n \"type\": \"Microsoft.Network/applicationSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\r\n }\r\n}", + "x-ms-client-request-id" : "ca0f32ae-87af-4903-bbdb-aac23c117d50", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/b7dc70e2-c28f-4c66-9fcf-e368ffa3c07b?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "539465cf-5e1c-4566-9737-f4c1f29dcce4" + }, + "Response" : { + "content-length" : "29", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11995", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "3d223856-69be-42b0-bdd6-a8c0b17fc051", + "Date" : "Tue, 01 Jun 2021 06:14:36 GMT", + "x-ms-arm-service-request-id" : "fb459978-10e6-4116-b4f2-d7554ce772e2", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061437Z:3d223856-69be-42b0-bdd6-a8c0b17fc051", + "Expires" : "-1", + "x-ms-request-id" : "b41424b0-9e68-4953-b29f-ae9bfc6b4bcb", + "Body" : "{\r\n \"status\": \"Succeeded\"\r\n}", + "x-ms-client-request-id" : "539465cf-5e1c-4566-9737-f4c1f29dcce4", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg37860?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "7e436a61-58e8-44ba-9c05-9201d0c60734" + }, + "Response" : { + "content-length" : "409", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11994", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "e069b40f-ef2f-4224-9ca1-ea9968a22967", + "Date" : "Tue, 01 Jun 2021 06:14:37 GMT", + "x-ms-arm-service-request-id" : "602924c9-ab2e-4125-b193-c32f7ca66cbc", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "ETag" : "W/\"4a918856-3ce8-4d24-82ca-0b2a082cb5a9\"", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061437Z:e069b40f-ef2f-4224-9ca1-ea9968a22967", + "Expires" : "-1", + "x-ms-request-id" : "b9811ac5-9891-47ee-a8c1-7858fe33e176", + "Body" : "{\r\n \"name\": \"asg37860\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg37860\",\r\n \"etag\": \"W/\\\"4a918856-3ce8-4d24-82ca-0b2a082cb5a9\\\"\",\r\n \"type\": \"Microsoft.Network/applicationSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "x-ms-client-request-id" : "7e436a61-58e8-44ba-9c05-9201d0c60734", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg80015?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.network/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "49d465d7-f54d-49e5-8376-d7d995d6160c", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "408", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1195", + "Pragma" : "no-cache", + "Azure-AsyncNotification" : "Enabled", + "StatusCode" : "201", + "x-ms-correlation-request-id" : "ca055f2c-9615-4f9f-9f0e-adbdb83cd5ad", + "Date" : "Tue, 01 Jun 2021 06:14:40 GMT", + "x-ms-arm-service-request-id" : "76320f76-b935-4669-a22f-4d3c6c6bbc65", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "Retry-After" : "0", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061441Z:ca055f2c-9615-4f9f-9f0e-adbdb83cd5ad", + "Expires" : "-1", + "Azure-AsyncOperation" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/7c200505-d6b9-4fa3-964e-bebbe1145229?api-version=2021-02-01", + "x-ms-request-id" : "7c200505-d6b9-4fa3-964e-bebbe1145229", + "Body" : "{\r\n \"name\": \"asg80015\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg80015\",\r\n \"etag\": \"W/\\\"53593c60-3c05-49e4-8ec6-a39e102f3690\\\"\",\r\n \"type\": \"Microsoft.Network/applicationSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\r\n }\r\n}", + "x-ms-client-request-id" : "49d465d7-f54d-49e5-8376-d7d995d6160c", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/7c200505-d6b9-4fa3-964e-bebbe1145229?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "fde7d381-50c8-4311-b699-1ba3d7b35ef9" + }, + "Response" : { + "content-length" : "29", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11993", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "47dcefae-4d6a-4583-92a3-2621cbf071f2", + "Date" : "Tue, 01 Jun 2021 06:14:50 GMT", + "x-ms-arm-service-request-id" : "232be147-0752-4de1-aea5-f42df4fb103b", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061451Z:47dcefae-4d6a-4583-92a3-2621cbf071f2", + "Expires" : "-1", + "x-ms-request-id" : "913e3766-142d-429a-bc13-704c101669ce", + "Body" : "{\r\n \"status\": \"Succeeded\"\r\n}", + "x-ms-client-request-id" : "fde7d381-50c8-4311-b699-1ba3d7b35ef9", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg80015?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "71a3cc28-c0e9-4387-ae98-b9a9a77cb90c" + }, + "Response" : { + "content-length" : "409", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11992", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "8187284d-9955-462f-b954-07829f3fd833", + "Date" : "Tue, 01 Jun 2021 06:14:51 GMT", + "x-ms-arm-service-request-id" : "c48c4253-12c6-4369-85e0-10f37e70e27e", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "ETag" : "W/\"70562504-985d-4887-91aa-9f37fb9ecc0b\"", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061451Z:8187284d-9955-462f-b954-07829f3fd833", + "Expires" : "-1", + "x-ms-request-id" : "8e9e69be-3e7d-4ced-846d-16ead29a349c", + "Body" : "{\r\n \"name\": \"asg80015\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg80015\",\r\n \"etag\": \"W/\\\"70562504-985d-4887-91aa-9f37fb9ecc0b\\\"\",\r\n \"type\": \"Microsoft.Network/applicationSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "x-ms-client-request-id" : "71a3cc28-c0e9-4387-ae98-b9a9a77cb90c", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.network/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "2cb3324b-b64a-4507-b7eb-8aba182c2aa4", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "10078", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1194", + "Pragma" : "no-cache", + "Azure-AsyncNotification" : "Enabled", + "StatusCode" : "201", + "x-ms-correlation-request-id" : "26b9aca4-a058-4467-b33b-9452c36bfbdc", + "Date" : "Tue, 01 Jun 2021 06:14:54 GMT", + "x-ms-arm-service-request-id" : "cc4d7716-ba7b-4db2-96d2-d330ab83b532", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "Retry-After" : "0", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061455Z:26b9aca4-a058-4467-b33b-9452c36bfbdc", + "Expires" : "-1", + "Azure-AsyncOperation" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/30833148-bada-4c50-9189-bdcfd6ab7e96?api-version=2021-02-01", + "x-ms-request-id" : "30833148-bada-4c50-9189-bdcfd6ab7e96", + "Body" : "{\r\n \"name\": \"nsg12117\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117\",\r\n \"etag\": \"W/\\\"811736e6-b4c3-4e9d-a7c6-50fe2bdd9dec\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": \"d3cd8803-20cc-4d63-85d7-e58c4215cbe9\",\r\n \"securityRules\": [\r\n {\r\n \"name\": \"rule1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule1\",\r\n \"etag\": \"W/\\\"811736e6-b4c3-4e9d-a7c6-50fe2bdd9dec\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"protocol\": \"Tcp\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"80\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 100,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"rule2\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule2\",\r\n \"etag\": \"W/\\\"811736e6-b4c3-4e9d-a7c6-50fe2bdd9dec\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"foo!!\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"22-25\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 200,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": [],\r\n \"sourceApplicationSecurityGroups\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg08975\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg55439\"\r\n }\r\n ]\r\n }\r\n },\r\n {\r\n \"name\": \"rule3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule3\",\r\n \"etag\": \"W/\\\"811736e6-b4c3-4e9d-a7c6-50fe2bdd9dec\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"22\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 300,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": [],\r\n \"destinationApplicationSecurityGroups\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg37860\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg80015\"\r\n }\r\n ]\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\": [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowVnetInBound\",\r\n \"etag\": \"W/\\\"811736e6-b4c3-4e9d-a7c6-50fe2bdd9dec\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowAzureLoadBalancerInBound\",\r\n \"etag\": \"W/\\\"811736e6-b4c3-4e9d-a7c6-50fe2bdd9dec\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"Allow inbound traffic from azure load balancer\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"AzureLoadBalancer\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/DenyAllInBound\",\r\n \"etag\": \"W/\\\"811736e6-b4c3-4e9d-a7c6-50fe2bdd9dec\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"Deny all inbound traffic\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowVnetOutBound\",\r\n \"etag\": \"W/\\\"811736e6-b4c3-4e9d-a7c6-50fe2bdd9dec\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"Allow outbound traffic from all VMs to all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowInternetOutBound\",\r\n \"etag\": \"W/\\\"811736e6-b4c3-4e9d-a7c6-50fe2bdd9dec\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"Internet\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/DenyAllOutBound\",\r\n \"etag\": \"W/\\\"811736e6-b4c3-4e9d-a7c6-50fe2bdd9dec\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"Deny all outbound traffic\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n }\r\n ]\r\n }\r\n}", + "x-ms-client-request-id" : "2cb3324b-b64a-4507-b7eb-8aba182c2aa4", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/30833148-bada-4c50-9189-bdcfd6ab7e96?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "69d28648-6e78-4f1a-9e52-18b38d937f37" + }, + "Response" : { + "content-length" : "29", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11991", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "6cd7d8f8-1e8c-45ff-97ed-401952d39ce8", + "Date" : "Tue, 01 Jun 2021 06:14:58 GMT", + "x-ms-arm-service-request-id" : "eaf8b2a4-3711-4378-8d4a-ed939db0e859", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061459Z:6cd7d8f8-1e8c-45ff-97ed-401952d39ce8", + "Expires" : "-1", + "x-ms-request-id" : "204ee6e7-f5ad-47c4-8dde-05d677601c66", + "Body" : "{\r\n \"status\": \"Succeeded\"\r\n}", + "x-ms-client-request-id" : "69d28648-6e78-4f1a-9e52-18b38d937f37", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "1cd6a9c3-42cc-4463-8773-9753a2282951" + }, + "Response" : { + "content-length" : "10088", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11990", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "d85a48b7-401e-4ec9-aa04-0d4f6ed18dfc", + "Date" : "Tue, 01 Jun 2021 06:14:58 GMT", + "x-ms-arm-service-request-id" : "dd4cffc5-12ca-4f99-ab95-8ddbc41f7a6b", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "ETag" : "W/\"006ac3de-d0f0-488a-a6bb-5eebc31fed91\"", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061459Z:d85a48b7-401e-4ec9-aa04-0d4f6ed18dfc", + "Expires" : "-1", + "x-ms-request-id" : "02d0128d-dab1-46e7-8b56-b5eb79611d54", + "Body" : "{\r\n \"name\": \"nsg12117\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117\",\r\n \"etag\": \"W/\\\"006ac3de-d0f0-488a-a6bb-5eebc31fed91\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"d3cd8803-20cc-4d63-85d7-e58c4215cbe9\",\r\n \"securityRules\": [\r\n {\r\n \"name\": \"rule1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule1\",\r\n \"etag\": \"W/\\\"006ac3de-d0f0-488a-a6bb-5eebc31fed91\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"protocol\": \"Tcp\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"80\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 100,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"rule2\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule2\",\r\n \"etag\": \"W/\\\"006ac3de-d0f0-488a-a6bb-5eebc31fed91\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"foo!!\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"22-25\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 200,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": [],\r\n \"sourceApplicationSecurityGroups\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg08975\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg55439\"\r\n }\r\n ]\r\n }\r\n },\r\n {\r\n \"name\": \"rule3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule3\",\r\n \"etag\": \"W/\\\"006ac3de-d0f0-488a-a6bb-5eebc31fed91\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"22\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 300,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": [],\r\n \"destinationApplicationSecurityGroups\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg37860\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg80015\"\r\n }\r\n ]\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\": [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowVnetInBound\",\r\n \"etag\": \"W/\\\"006ac3de-d0f0-488a-a6bb-5eebc31fed91\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowAzureLoadBalancerInBound\",\r\n \"etag\": \"W/\\\"006ac3de-d0f0-488a-a6bb-5eebc31fed91\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Allow inbound traffic from azure load balancer\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"AzureLoadBalancer\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/DenyAllInBound\",\r\n \"etag\": \"W/\\\"006ac3de-d0f0-488a-a6bb-5eebc31fed91\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Deny all inbound traffic\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowVnetOutBound\",\r\n \"etag\": \"W/\\\"006ac3de-d0f0-488a-a6bb-5eebc31fed91\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Allow outbound traffic from all VMs to all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowInternetOutBound\",\r\n \"etag\": \"W/\\\"006ac3de-d0f0-488a-a6bb-5eebc31fed91\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"Internet\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/DenyAllOutBound\",\r\n \"etag\": \"W/\\\"006ac3de-d0f0-488a-a6bb-5eebc31fed91\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Deny all outbound traffic\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n }\r\n ]\r\n }\r\n}", + "x-ms-client-request-id" : "1cd6a9c3-42cc-4463-8773-9753a2282951", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg00956?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.network/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "23e94706-bc1e-4f04-8394-7e7684e6e2ed", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "408", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1193", + "Pragma" : "no-cache", + "Azure-AsyncNotification" : "Enabled", + "StatusCode" : "201", + "x-ms-correlation-request-id" : "b6a1b0d7-2625-4bc9-bffa-ed08a0cd4b29", + "Date" : "Tue, 01 Jun 2021 06:15:02 GMT", + "x-ms-arm-service-request-id" : "f8ac6dc7-a7c7-44e2-82f1-1cd78f2cf905", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "Retry-After" : "0", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061502Z:b6a1b0d7-2625-4bc9-bffa-ed08a0cd4b29", + "Expires" : "-1", + "Azure-AsyncOperation" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/25fa875e-0a9d-414a-a7ac-83aaba0c5ce4?api-version=2021-02-01", + "x-ms-request-id" : "25fa875e-0a9d-414a-a7ac-83aaba0c5ce4", + "Body" : "{\r\n \"name\": \"asg00956\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg00956\",\r\n \"etag\": \"W/\\\"1f3344da-7ac8-41e6-990d-11eef0fd7641\\\"\",\r\n \"type\": \"Microsoft.Network/applicationSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\r\n }\r\n}", + "x-ms-client-request-id" : "23e94706-bc1e-4f04-8394-7e7684e6e2ed", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/25fa875e-0a9d-414a-a7ac-83aaba0c5ce4?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "b3ee67bd-3c08-48d6-a648-e79cfac9b0bf" + }, + "Response" : { + "content-length" : "29", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11989", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "11032d7d-545e-4049-a73f-ee8aed27f547", + "Date" : "Tue, 01 Jun 2021 06:15:12 GMT", + "x-ms-arm-service-request-id" : "b81e4169-2ad0-4b5f-946e-c0f534980738", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061513Z:11032d7d-545e-4049-a73f-ee8aed27f547", + "Expires" : "-1", + "x-ms-request-id" : "1f605e87-74a4-4b63-8b8d-fd4f69fdebc2", + "Body" : "{\r\n \"status\": \"Succeeded\"\r\n}", + "x-ms-client-request-id" : "b3ee67bd-3c08-48d6-a648-e79cfac9b0bf", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg00956?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "88e65226-933e-4a28-b450-c3c13ab6003f" + }, + "Response" : { + "content-length" : "409", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11988", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "a48404be-ec0d-403c-a29d-fa8bf592e5e5", + "Date" : "Tue, 01 Jun 2021 06:15:12 GMT", + "x-ms-arm-service-request-id" : "ce009ef8-79de-4dc2-affc-79af76a85db6", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "ETag" : "W/\"bafcb82a-bc4b-434f-9970-b7442129e5e3\"", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061513Z:a48404be-ec0d-403c-a29d-fa8bf592e5e5", + "Expires" : "-1", + "x-ms-request-id" : "42a1d047-8489-47c2-ae32-c1de4e6c384c", + "Body" : "{\r\n \"name\": \"asg00956\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg00956\",\r\n \"etag\": \"W/\\\"bafcb82a-bc4b-434f-9970-b7442129e5e3\\\"\",\r\n \"type\": \"Microsoft.Network/applicationSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "x-ms-client-request-id" : "88e65226-933e-4a28-b450-c3c13ab6003f", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg89182?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.network/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "fe0e0e0e-0f19-4906-bc4c-cd3368a44b57", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "408", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1192", + "Pragma" : "no-cache", + "Azure-AsyncNotification" : "Enabled", + "StatusCode" : "201", + "x-ms-correlation-request-id" : "51692c8a-3d9f-4ef5-9c6f-ae760315ed0a", + "Date" : "Tue, 01 Jun 2021 06:15:16 GMT", + "x-ms-arm-service-request-id" : "13a5261b-97b5-471e-bb8e-97016b4c65f8", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "Retry-After" : "0", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061517Z:51692c8a-3d9f-4ef5-9c6f-ae760315ed0a", + "Expires" : "-1", + "Azure-AsyncOperation" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/58379ded-7e39-4bd8-bd92-b7c3bed88717?api-version=2021-02-01", + "x-ms-request-id" : "58379ded-7e39-4bd8-bd92-b7c3bed88717", + "Body" : "{\r\n \"name\": \"asg89182\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg89182\",\r\n \"etag\": \"W/\\\"e5cec942-f162-46e1-954b-c06c15d1ea32\\\"\",\r\n \"type\": \"Microsoft.Network/applicationSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\r\n }\r\n}", + "x-ms-client-request-id" : "fe0e0e0e-0f19-4906-bc4c-cd3368a44b57", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/58379ded-7e39-4bd8-bd92-b7c3bed88717?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "6f4701e4-0b97-4dfb-9c35-5fe3a8cce4d8" + }, + "Response" : { + "content-length" : "29", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11987", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "0ac3acfd-895a-4c81-90f1-179fdb5e95aa", + "Date" : "Tue, 01 Jun 2021 06:15:26 GMT", + "x-ms-arm-service-request-id" : "1b8614a7-bc54-49b8-8e3c-d53cdaeb8e16", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061527Z:0ac3acfd-895a-4c81-90f1-179fdb5e95aa", + "Expires" : "-1", + "x-ms-request-id" : "caa3ab45-d9a3-401a-9edc-31626f3432c1", + "Body" : "{\r\n \"status\": \"Succeeded\"\r\n}", + "x-ms-client-request-id" : "6f4701e4-0b97-4dfb-9c35-5fe3a8cce4d8", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg89182?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "c98f8375-d128-4dc4-b4fe-7a8dd6b990c2" + }, + "Response" : { + "content-length" : "409", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11986", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "456c5495-ae99-4b88-a5a1-68fcf27652ca", + "Date" : "Tue, 01 Jun 2021 06:15:27 GMT", + "x-ms-arm-service-request-id" : "724fcce4-5e9a-45ed-a8dc-b1fc6db29363", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "ETag" : "W/\"f81b1e59-8525-4ca2-bfed-fd1918d7840f\"", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061528Z:456c5495-ae99-4b88-a5a1-68fcf27652ca", + "Expires" : "-1", + "x-ms-request-id" : "9044673c-9198-4717-a577-23c7ed090819", + "Body" : "{\r\n \"name\": \"asg89182\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg89182\",\r\n \"etag\": \"W/\\\"f81b1e59-8525-4ca2-bfed-fd1918d7840f\\\"\",\r\n \"type\": \"Microsoft.Network/applicationSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "x-ms-client-request-id" : "c98f8375-d128-4dc4-b4fe-7a8dd6b990c2", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.network/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "05cff3f7-e0b9-4ee2-a207-0e250a1b0a8e", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "10078", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1191", + "Pragma" : "no-cache", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "70a1438f-e800-46f0-92ea-b265c9449a43", + "Date" : "Tue, 01 Jun 2021 06:15:27 GMT", + "x-ms-arm-service-request-id" : "6533e952-aa8c-4984-93a9-57d574be2939", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "Retry-After" : "0", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061528Z:70a1438f-e800-46f0-92ea-b265c9449a43", + "Expires" : "-1", + "Azure-AsyncOperation" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/7dbe161d-ac93-4c63-bfe0-fdeee11b5141?api-version=2021-02-01", + "x-ms-request-id" : "7dbe161d-ac93-4c63-bfe0-fdeee11b5141", + "Body" : "{\r\n \"name\": \"nsg12117\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117\",\r\n \"etag\": \"W/\\\"ff522840-0462-4506-969a-dd69dbea162d\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": \"d3cd8803-20cc-4d63-85d7-e58c4215cbe9\",\r\n \"securityRules\": [\r\n {\r\n \"name\": \"rule1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule1\",\r\n \"etag\": \"W/\\\"ff522840-0462-4506-969a-dd69dbea162d\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"protocol\": \"Tcp\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"80\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 100,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"rule2\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule2\",\r\n \"etag\": \"W/\\\"ff522840-0462-4506-969a-dd69dbea162d\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"foo!!\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"22-25\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 200,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": [],\r\n \"sourceApplicationSecurityGroups\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg00956\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg55439\"\r\n }\r\n ]\r\n }\r\n },\r\n {\r\n \"name\": \"rule3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule3\",\r\n \"etag\": \"W/\\\"ff522840-0462-4506-969a-dd69dbea162d\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"22\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 300,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": [],\r\n \"destinationApplicationSecurityGroups\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg37860\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg89182\"\r\n }\r\n ]\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\": [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowVnetInBound\",\r\n \"etag\": \"W/\\\"ff522840-0462-4506-969a-dd69dbea162d\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowAzureLoadBalancerInBound\",\r\n \"etag\": \"W/\\\"ff522840-0462-4506-969a-dd69dbea162d\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"Allow inbound traffic from azure load balancer\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"AzureLoadBalancer\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/DenyAllInBound\",\r\n \"etag\": \"W/\\\"ff522840-0462-4506-969a-dd69dbea162d\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"Deny all inbound traffic\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowVnetOutBound\",\r\n \"etag\": \"W/\\\"ff522840-0462-4506-969a-dd69dbea162d\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"Allow outbound traffic from all VMs to all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowInternetOutBound\",\r\n \"etag\": \"W/\\\"ff522840-0462-4506-969a-dd69dbea162d\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"Internet\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/DenyAllOutBound\",\r\n \"etag\": \"W/\\\"ff522840-0462-4506-969a-dd69dbea162d\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"description\": \"Deny all outbound traffic\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n }\r\n ]\r\n }\r\n}", + "x-ms-client-request-id" : "05cff3f7-e0b9-4ee2-a207-0e250a1b0a8e", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/7dbe161d-ac93-4c63-bfe0-fdeee11b5141?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "3cf9f20f-0c9a-4ccc-a08c-c6ca7a9b7120" + }, + "Response" : { + "content-length" : "29", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11985", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "930f8bfa-b4c0-4711-b9a7-2d4db6400f6f", + "Date" : "Tue, 01 Jun 2021 06:15:31 GMT", + "x-ms-arm-service-request-id" : "f3c940bd-69ab-40cd-8d60-b97bc3913441", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061532Z:930f8bfa-b4c0-4711-b9a7-2d4db6400f6f", + "Expires" : "-1", + "x-ms-request-id" : "1d10918c-44fd-483e-951f-5f33f014e447", + "Body" : "{\r\n \"status\": \"Succeeded\"\r\n}", + "x-ms-client-request-id" : "3cf9f20f-0c9a-4ccc-a08c-c6ca7a9b7120", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "07f4c24b-ecff-4a11-91dd-cbadc8b7c94f" + }, + "Response" : { + "content-length" : "10088", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11984", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "35417062-714b-410d-a574-a1fb8f1722fe", + "Date" : "Tue, 01 Jun 2021 06:15:31 GMT", + "x-ms-arm-service-request-id" : "22868aba-1b64-47a3-9efc-f8a416b232e0", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "ETag" : "W/\"4e79af5f-8707-442b-963c-a901baf17e72\"", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061532Z:35417062-714b-410d-a574-a1fb8f1722fe", + "Expires" : "-1", + "x-ms-request-id" : "96f1bef1-8616-4d8c-ba20-2b7fafabcc3a", + "Body" : "{\r\n \"name\": \"nsg12117\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"d3cd8803-20cc-4d63-85d7-e58c4215cbe9\",\r\n \"securityRules\": [\r\n {\r\n \"name\": \"rule1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule1\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"protocol\": \"Tcp\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"80\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 100,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"rule2\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule2\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"foo!!\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"22-25\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 200,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": [],\r\n \"sourceApplicationSecurityGroups\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg00956\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg55439\"\r\n }\r\n ]\r\n }\r\n },\r\n {\r\n \"name\": \"rule3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule3\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"22\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 300,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": [],\r\n \"destinationApplicationSecurityGroups\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg37860\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg89182\"\r\n }\r\n ]\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\": [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowVnetInBound\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowAzureLoadBalancerInBound\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Allow inbound traffic from azure load balancer\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"AzureLoadBalancer\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/DenyAllInBound\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Deny all inbound traffic\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowVnetOutBound\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Allow outbound traffic from all VMs to all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowInternetOutBound\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"Internet\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/DenyAllOutBound\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Deny all outbound traffic\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n }\r\n ]\r\n }\r\n}", + "x-ms-client-request-id" : "07f4c24b-ecff-4a11-91dd-cbadc8b7c94f", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.network/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "9036488e-bd60-4f8e-934a-ff12d6918781", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "10088", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11983", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "36d5a261-0534-481c-90ef-57e2783b359a", + "Date" : "Tue, 01 Jun 2021 06:15:31 GMT", + "x-ms-arm-service-request-id" : "810e0d0c-d8d9-492e-8918-ce3976747eb3", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "ETag" : "W/\"4e79af5f-8707-442b-963c-a901baf17e72\"", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061532Z:36d5a261-0534-481c-90ef-57e2783b359a", + "Expires" : "-1", + "x-ms-request-id" : "d73d76a8-704e-4587-8c43-89e617b333d0", + "Body" : "{\r\n \"name\": \"nsg12117\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"d3cd8803-20cc-4d63-85d7-e58c4215cbe9\",\r\n \"securityRules\": [\r\n {\r\n \"name\": \"rule1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule1\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"protocol\": \"Tcp\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"80\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 100,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"rule2\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule2\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"foo!!\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"22-25\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 200,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": [],\r\n \"sourceApplicationSecurityGroups\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg00956\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg55439\"\r\n }\r\n ]\r\n }\r\n },\r\n {\r\n \"name\": \"rule3\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/securityRules/rule3\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/securityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"22\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 300,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": [],\r\n \"destinationApplicationSecurityGroups\": [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg37860\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/applicationSecurityGroups/asg89182\"\r\n }\r\n ]\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\": [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowVnetInBound\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowAzureLoadBalancerInBound\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Allow inbound traffic from azure load balancer\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"AzureLoadBalancer\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/DenyAllInBound\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Deny all inbound traffic\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\": \"Inbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowVnetOutBound\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Allow outbound traffic from all VMs to all VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/AllowInternetOutBound\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"Internet\",\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117/defaultSecurityRules/DenyAllOutBound\",\r\n \"etag\": \"W/\\\"4e79af5f-8707-442b-963c-a901baf17e72\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"description\": \"Deny all outbound traffic\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\": \"Outbound\",\r\n \"sourcePortRanges\": [],\r\n \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n }\r\n ]\r\n }\r\n}", + "x-ms-client-request-id" : "9036488e-bd60-4f8e-934a-ff12d6918781", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javanwmrg43015/providers/Microsoft.Network/networkSecurityGroups/nsg12117?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.network/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "bf75bd40-577c-4cda-9ce2-16580fde66d5", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "0", + "x-ms-ratelimit-remaining-subscription-deletes" : "14999", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "Azure-AsyncNotification" : "Enabled", + "StatusCode" : "202", + "x-ms-correlation-request-id" : "b119d8e1-f229-4150-afcc-d449047ceb5e", + "Date" : "Tue, 01 Jun 2021 06:15:32 GMT", + "x-ms-arm-service-request-id" : "d5a967af-d4b6-45d1-9047-5d1e7c07f20e", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "Retry-After" : "0", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061533Z:b119d8e1-f229-4150-afcc-d449047ceb5e", + "Expires" : "-1", + "Azure-AsyncOperation" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/b86d3c1f-7e78-418b-9708-96d7049f4f4d?api-version=2021-02-01", + "x-ms-request-id" : "b86d3c1f-7e78-418b-9708-96d7049f4f4d", + "x-ms-client-request-id" : "bf75bd40-577c-4cda-9ce2-16580fde66d5", + "Location" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operationResults/b86d3c1f-7e78-418b-9708-96d7049f4f4d?api-version=2021-02-01" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/b86d3c1f-7e78-418b-9708-96d7049f4f4d?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "bb31ade7-b8c0-4639-9a77-43969ef03e0d" + }, + "Response" : { + "content-length" : "29", + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11982", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "a64c8890-1d85-4d2d-8734-24e88f061cc9", + "Date" : "Tue, 01 Jun 2021 06:15:44 GMT", + "x-ms-arm-service-request-id" : "cf7313c6-02d6-4d6a-926a-f51d2d644e13", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061544Z:a64c8890-1d85-4d2d-8734-24e88f061cc9", + "Expires" : "-1", + "x-ms-request-id" : "ab2c8eb0-facf-415b-b1e5-3c7f99882596", + "Body" : "{\r\n \"status\": \"Succeeded\"\r\n}", + "x-ms-client-request-id" : "bb31ade7-b8c0-4639-9a77-43969ef03e0d", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operationResults/b86d3c1f-7e78-418b-9708-96d7049f4f4d?api-version=2021-02-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "97d72b3f-4498-4fc6-8342-bfebe14735a6" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "Azure-AsyncNotification" : "Enabled", + "x-ms-ratelimit-remaining-subscription-reads" : "11981", + "StatusCode" : "204", + "x-ms-correlation-request-id" : "b119d8e1-f229-4150-afcc-d449047ceb5e", + "Date" : "Tue, 01 Jun 2021 06:15:44 GMT", + "x-ms-arm-service-request-id" : "d5a967af-d4b6-45d1-9047-5d1e7c07f20e", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061544Z:a85049f9-0659-4974-afc2-3404adf70fc9", + "Expires" : "-1", + "Azure-AsyncOperation" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/b86d3c1f-7e78-418b-9708-96d7049f4f4d?api-version=2021-02-01", + "x-ms-request-id" : "b86d3c1f-7e78-418b-9708-96d7049f4f4d", + "Body" : "", + "x-ms-client-request-id" : "bf75bd40-577c-4cda-9ce2-16580fde66d5", + "Content-Type" : "application/json; charset=utf-8", + "Location" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operationResults/b86d3c1f-7e78-418b-9708-96d7049f4f4d?api-version=2021-02-01" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/javanwmrg43015?api-version=2021-01-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "fea5fc67-1f16-49e1-9c4e-9abf50bc6831", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "0", + "x-ms-ratelimit-remaining-subscription-deletes" : "14998", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "StatusCode" : "202", + "x-ms-correlation-request-id" : "765b92d3-dccb-4ea2-96ff-92ed003442cb", + "Date" : "Tue, 01 Jun 2021 06:15:47 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "Retry-After" : "0", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210601T061547Z:765b92d3-dccb-4ea2-96ff-92ed003442cb", + "Expires" : "-1", + "x-ms-request-id" : "765b92d3-dccb-4ea2-96ff-92ed003442cb", + "Location" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1KQVZBTldNUkc0MzAxNS1TT1VUSENFTlRSQUxVUyIsImpvYkxvY2F0aW9uIjoic291dGhjZW50cmFsdXMifQ?api-version=2021-01-01" + }, + "Exception" : null + } ], + "variables" : [ "javanwmrg43015", "asg55439", "asg08975", "asg37860", "asg80015", "asg00956", "asg89182", "nsg12117" ] +} \ No newline at end of file From 4091ec4c3dfe890cd96d7c6d866e030d8cd157c6 Mon Sep 17 00:00:00 2001 From: lzc-1997-abel <70368631+lzc-1997-abel@users.noreply.github.com> Date: Wed, 2 Jun 2021 10:33:37 +0800 Subject: [PATCH 18/53] Add integration test for keyvault certificate (#21573) --- .../CHANGELOG.md | 5 + .../README.md | 8 + .../pom.xml | 41 +++ .../test/keyvault/KeyVaultCertificateIT.java | 148 ++++++++ .../test/keyvault/PropertyConvertorUtils.java | 29 ++ .../spring/test/keyvault/app/DummyApp.java | 19 ++ .../test-resources.json | 316 ++++++++++++++++++ sdk/spring/pom.xml | 41 +-- sdk/spring/spring-test-template.yml | 4 + 9 files changed, 591 insertions(+), 20 deletions(-) create mode 100644 sdk/spring/azure-spring-boot-test-keyvault-certificate/CHANGELOG.md create mode 100644 sdk/spring/azure-spring-boot-test-keyvault-certificate/README.md create mode 100644 sdk/spring/azure-spring-boot-test-keyvault-certificate/pom.xml create mode 100644 sdk/spring/azure-spring-boot-test-keyvault-certificate/src/test/java/com/azure/spring/test/keyvault/KeyVaultCertificateIT.java create mode 100644 sdk/spring/azure-spring-boot-test-keyvault-certificate/src/test/java/com/azure/spring/test/keyvault/PropertyConvertorUtils.java create mode 100644 sdk/spring/azure-spring-boot-test-keyvault-certificate/src/test/java/com/azure/spring/test/keyvault/app/DummyApp.java create mode 100644 sdk/spring/azure-spring-boot-test-keyvault-certificate/test-resources.json diff --git a/sdk/spring/azure-spring-boot-test-keyvault-certificate/CHANGELOG.md b/sdk/spring/azure-spring-boot-test-keyvault-certificate/CHANGELOG.md new file mode 100644 index 000000000000..46314a46d180 --- /dev/null +++ b/sdk/spring/azure-spring-boot-test-keyvault-certificate/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0 (Unreleased) + + diff --git a/sdk/spring/azure-spring-boot-test-keyvault-certificate/README.md b/sdk/spring/azure-spring-boot-test-keyvault-certificate/README.md new file mode 100644 index 000000000000..bc18d9e9c993 --- /dev/null +++ b/sdk/spring/azure-spring-boot-test-keyvault-certificate/README.md @@ -0,0 +1,8 @@ +# Azure Spring Boot Integration tests client library for Java + +## Key concepts +## Getting started +## Examples +## Troubleshooting +## Next steps +## Contributing diff --git a/sdk/spring/azure-spring-boot-test-keyvault-certificate/pom.xml b/sdk/spring/azure-spring-boot-test-keyvault-certificate/pom.xml new file mode 100644 index 000000000000..01896f9ca854 --- /dev/null +++ b/sdk/spring/azure-spring-boot-test-keyvault-certificate/pom.xml @@ -0,0 +1,41 @@ + + + + 4.0.0 + + + com.azure.spring + azure-spring-boot-test-parent + 1.0.0 + ../azure-spring-boot-test-parent + + + com.azure.spring + azure-spring-boot-test-keyvault-certificate + 1.0.0 + + + + com.azure.spring + azure-spring-boot-starter-keyvault-certificates + 3.0.0-beta.8 + + + com.azure.spring + azure-spring-boot-test-core + 1.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + diff --git a/sdk/spring/azure-spring-boot-test-keyvault-certificate/src/test/java/com/azure/spring/test/keyvault/KeyVaultCertificateIT.java b/sdk/spring/azure-spring-boot-test-keyvault-certificate/src/test/java/com/azure/spring/test/keyvault/KeyVaultCertificateIT.java new file mode 100644 index 000000000000..5395f3cbcf1b --- /dev/null +++ b/sdk/spring/azure-spring-boot-test-keyvault-certificate/src/test/java/com/azure/spring/test/keyvault/KeyVaultCertificateIT.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.spring.test.keyvault; + +import com.azure.security.keyvault.jca.KeyVaultLoadStoreParameter; +import com.azure.spring.test.AppRunner; +import com.azure.spring.test.keyvault.app.DummyApp; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.ssl.PrivateKeyDetails; +import org.apache.http.ssl.PrivateKeyStrategy; +import org.apache.http.ssl.SSLContexts; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +import javax.net.ssl.SSLContext; +import java.net.Socket; +import java.security.KeyStore; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import static com.azure.spring.test.keyvault.PropertyConvertorUtils.*; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class KeyVaultCertificateIT { + + private RestTemplate restTemplate; + + private static AppRunner app; + + @BeforeAll + public static void setEnvironmentProperty() { + PropertyConvertorUtils.putEnvironmentPropertyToSystemProperty( + Arrays.asList("CERTIFICATE_AZURE_KEYVAULT_URI", + "CERTIFICATE_AZURE_KEYVAULT_TENANT_ID", + "CERTIFICATE_AZURE_KEYVAULT_CLIENT_ID", + "CERTIFICATE_AZURE_KEYVAULT_CLIENT_SECRET") + ); + } + + public static KeyStore getAzureKeyVaultKeyStore() throws Exception { + KeyStore trustStore = KeyStore.getInstance("AzureKeyVault"); + KeyVaultLoadStoreParameter parameter = new KeyVaultLoadStoreParameter( + System.getProperty("azure.keyvault.uri"), + System.getProperty("azure.keyvault.tenant-id"), + System.getProperty("azure.keyvault.client-id"), + System.getProperty("azure.keyvault.client-secret")); + trustStore.load(parameter); + return trustStore; + } + + private void setRestTemplate(SSLContext sslContext) { + SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext, + (hostname, session) -> true); + CloseableHttpClient httpClient = HttpClients.custom() + .setSSLSocketFactory(socketFactory) + .build(); + HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); + + restTemplate = new RestTemplate(requestFactory); + } + + public void setRestTemplate() throws Exception { + KeyStore keyStore = getAzureKeyVaultKeyStore(); + SSLContext sslContext = SSLContexts.custom() + .loadTrustMaterial(keyStore, null) + .build(); + setRestTemplate(sslContext); + } + + public void setMTLSRestTemplate() throws Exception { + KeyStore keyStore = getAzureKeyVaultKeyStore(); + SSLContext sslContext = SSLContexts.custom() + .loadTrustMaterial(keyStore, null) + .loadKeyMaterial(keyStore, "".toCharArray(), new ClientPrivateKeyStrategy()) + .build(); + setRestTemplate(sslContext); + } + + public void startAppRunner(Map properties) { + app = new AppRunner(DummyApp.class); + properties.forEach(app::property); + app.start(); + } + + public Map getDefaultMap() { + Map properties = new HashMap<>(); + properties.put("azure.keyvault.uri", AZURE_KEYVAULT_URI); + properties.put("azure.keyvault.client-id", SPRING_CLIENT_ID); + properties.put("azure.keyvault.client-secret", SPRING_CLIENT_SECRET); + properties.put("azure.keyvault.tenant-id", SPRING_TENANT_ID); + properties.put("server.ssl.key-alias", "myalias"); + properties.put("server.ssl.key-store-type", "AzureKeyVault"); + return properties; + } + + /** + * Test the Spring Boot Health indicator integration. + */ + @Test + public void testSpringBootWebApplication() throws Exception { + Map properties = getDefaultMap(); + startAppRunner(properties); + + setRestTemplate(); + sendRequest(); + } + + @AfterAll + public static void destroy() { + app.close(); + } + + /** + * Test the Spring Boot Health indicator integration. + */ + @Test + public void testSpringBootMTLSWebApplication() throws Exception { + + Map properties = getDefaultMap(); + properties.put("server.ssl.client-auth", "need"); + properties.put("server.ssl.trust-store-type", "AzureKeyVault"); + + startAppRunner(properties); + + setMTLSRestTemplate(); + sendRequest(); + } + + public void sendRequest() { + final String response = restTemplate.getForObject( + "https://localhost:" + app.port() + "", String.class); + assertEquals(response, "Hello World"); + } + + private static class ClientPrivateKeyStrategy implements PrivateKeyStrategy { + @Override + public String chooseAlias(Map map, Socket socket) { + return "myalias"; // It should be your certificate alias used in client-side + } + } + +} diff --git a/sdk/spring/azure-spring-boot-test-keyvault-certificate/src/test/java/com/azure/spring/test/keyvault/PropertyConvertorUtils.java b/sdk/spring/azure-spring-boot-test-keyvault-certificate/src/test/java/com/azure/spring/test/keyvault/PropertyConvertorUtils.java new file mode 100644 index 000000000000..45a33687476e --- /dev/null +++ b/sdk/spring/azure-spring-boot-test-keyvault-certificate/src/test/java/com/azure/spring/test/keyvault/PropertyConvertorUtils.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.spring.test.keyvault; + +import java.util.List; + +public class PropertyConvertorUtils { + + public static final String CERTIFICATE_PREFIX = "certificate_"; + + public static final String AZURE_KEYVAULT_URI = System.getenv("CERTIFICATE_AZURE_KEYVAULT_URI"); + public static final String SPRING_CLIENT_ID = System.getenv("CERTIFICATE_AZURE_KEYVAULT_CLIENT_ID"); + public static final String SPRING_CLIENT_SECRET = System.getenv("CERTIFICATE_AZURE_KEYVAULT_CLIENT_SECRET"); + public static final String SPRING_TENANT_ID = System.getenv("CERTIFICATE_AZURE_KEYVAULT_TENANT_ID"); + public static void putEnvironmentPropertyToSystemProperty(List key) { + key.forEach( + environmentPropertyKey -> { + String value = System.getenv(environmentPropertyKey); + String systemPropertyKey = environmentPropertyKey + .toLowerCase() + .replaceFirst(CERTIFICATE_PREFIX, "") + .replaceFirst("azure_keyvault_", "azure.keyvault.") + .replaceAll("_", "-"); + System.getProperties().put(systemPropertyKey, value); + } + ); + } +} diff --git a/sdk/spring/azure-spring-boot-test-keyvault-certificate/src/test/java/com/azure/spring/test/keyvault/app/DummyApp.java b/sdk/spring/azure-spring-boot-test-keyvault-certificate/src/test/java/com/azure/spring/test/keyvault/app/DummyApp.java new file mode 100644 index 000000000000..f6bd21361970 --- /dev/null +++ b/sdk/spring/azure-spring-boot-test-keyvault-certificate/src/test/java/com/azure/spring/test/keyvault/app/DummyApp.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.spring.test.keyvault.app; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@SpringBootApplication +public class DummyApp { + + @GetMapping("/") + public String helloWorld() { + return "Hello World"; + } + +} diff --git a/sdk/spring/azure-spring-boot-test-keyvault-certificate/test-resources.json b/sdk/spring/azure-spring-boot-test-keyvault-certificate/test-resources.json new file mode 100644 index 000000000000..ed27053c2867 --- /dev/null +++ b/sdk/spring/azure-spring-boot-test-keyvault-certificate/test-resources.json @@ -0,0 +1,316 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "baseName": { + "type": "String" + }, + "tenantId": { + "type": "String", + "defaultValue": "[subscription().tenantId]" + }, + "testApplicationOid": { + "type": "String" + }, + "endpointSuffix": { + "type": "String", + "defaultValue": "vault.azure.net" + }, + "testApplicationId": { + "type": "String" + }, + "testApplicationSecret": { + "type": "String" + }, + "enabledForDeployment": { + "type": "bool", + "defaultValue": false, + "allowedValues": [ + true, + false + ] + }, + "enabledForDiskEncryption": { + "type": "bool", + "defaultValue": false, + "allowedValues": [ + true, + false + ] + }, + "enabledForTemplateDeployment": { + "type": "bool", + "defaultValue": false, + "allowedValues": [ + true, + false + ] + }, + "skuName": { + "type": "string", + "defaultValue": "Standard", + "allowedValues": [ + "Standard", + "Premium" + ] + }, + "identityName": { + "type": "string", + "defaultValue": "identityForKeyVault" + }, + "certificateName": { + "type": "string", + "defaultValue": "myalias" + }, + "subjectName": { + "type": "string", + "defaultValue": "CN=contoso.com" + }, + "utcValue": { + "type": "string", + "defaultValue": "[utcNow()]" + } + }, + "variables": { + "keyVaultName": "[parameters('baseName')]", + "azureKeyVaultUrl": "[format('https://{0}.{1}/', parameters('baseName'), parameters('endpointSuffix'))]", + "bootstrapRoleAssignmentId": "[guid(concat(resourceGroup().id, 'contributor'))]", + "contributorRoleDefinitionId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'b24988ac-6180-42a0-ab88-20f7382dd24c')]" + }, + "resources": [ + { + "type": "Microsoft.ManagedIdentity/userAssignedIdentities", + "apiVersion": "2018-11-30", + "name": "[parameters('identityName')]", + "location": "[resourceGroup().location]" + }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "2018-09-01-preview", + "name": "[variables('bootstrapRoleAssignmentId')]", + "dependsOn": [ + "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('identityName'))]" + ], + "properties": { + "roleDefinitionId": "[variables('contributorRoleDefinitionId')]", + "principalId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('identityName')), '2018-11-30').principalId]", + "scope": "[resourceGroup().id]", + "principalType": "ServicePrincipal" + } + }, + { + "type": "Microsoft.KeyVault/vaults", + "apiVersion": "2018-02-14", + "name": "[parameters('baseName')]", + "location": "[resourceGroup().location]", + "properties": { + "sku": { + "family": "A", + "name": "standard" + }, + "tenantId": "[parameters('tenantId')]", + "accessPolicies": [ + { + "tenantId": "[parameters('tenantId')]", + "objectId": "[parameters('testApplicationOid')]", + "permissions": { + "keys": [ + "backup", + "create", + "decrypt", + "delete", + "encrypt", + "get", + "import", + "list", + "purge", + "recover", + "restore", + "sign", + "unwrapKey", + "update", + "verify", + "wrapKey" + ], + "secrets": [ + "backup", + "delete", + "get", + "list", + "purge", + "recover", + "restore", + "set" + ], + "certificates": [ + "backup", + "create", + "delete", + "deleteissuers", + "get", + "getissuers", + "import", + "list", + "listissuers", + "managecontacts", + "manageissuers", + "purge", + "recover", + "restore", + "setissuers", + "update" + ] + } + }, + { + "objectId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('identityName')), '2018-11-30').principalId]", + "tenantId": "[parameters('tenantId')]", + "permissions": { + "keys": [ + "backup", + "create", + "decrypt", + "delete", + "encrypt", + "get", + "import", + "list", + "purge", + "recover", + "restore", + "sign", + "unwrapKey", + "update", + "verify", + "wrapKey" + ], + "secrets": [ + "backup", + "delete", + "get", + "list", + "purge", + "recover", + "restore", + "set" + ], + "certificates": [ + "backup", + "create", + "delete", + "deleteissuers", + "get", + "getissuers", + "import", + "list", + "listissuers", + "managecontacts", + "manageissuers", + "purge", + "recover", + "restore", + "setissuers", + "update" + ] + } + } + ], + "enabledForDeployment": "[parameters('enabledForDeployment')]", + "enabledForDiskEncryption": "[parameters('enabledForDiskEncryption')]", + "enabledForTemplateDeployment": "[parameters('enabledForTemplateDeployment')]", + "enableSoftDelete": true, + "networkAcls": { + "defaultAction": "Allow", + "bypass": "AzureServices" + } + } + }, + { + "type": "Microsoft.Resources/deploymentScripts", + "apiVersion": "2020-10-01", + "name": "createAddCertificate", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults', variables('keyVaultName'))]", + "[resourceId('Microsoft.Authorization/roleAssignments', variables('bootstrapRoleAssignmentId'))]" + ], + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('identityName'))]": { + } + } + }, + "kind": "AzurePowerShell", + "properties": { + "forceUpdateTag": "[parameters('utcValue')]", + "azPowerShellVersion": "5.0", + "timeout": "PT30M", + "arguments": "[format(' -vaultName {0} -certificateName {1} -subjectName {2}', variables('keyVaultName'), parameters('certificateName'), parameters('subjectName'))]", + "scriptContent": " + param( + [string] [Parameter(Mandatory=$true)] $vaultName, + [string] [Parameter(Mandatory=$true)] $certificateName, + [string] [Parameter(Mandatory=$true)] $subjectName + ) + + $ErrorActionPreference = 'Stop' + $DeploymentScriptOutputs = @{} + + $policy = New-AzKeyVaultCertificatePolicy -SubjectName $subjectName -IssuerName Self -ValidityInMonths 12 -Verbose + + Add-AzKeyVaultCertificate -VaultName $vaultName -Name $certificateName -CertificatePolicy $policy -Verbose + + $newCert = Get-AzKeyVaultCertificate -VaultName $vaultName -Name $certificateName + + $tries = 0 + do { + Write-Host 'Waiting for certificate creation completion...' + Start-Sleep -Seconds 10 + $operation = Get-AzKeyVaultCertificateOperation -VaultName $vaultName -Name $certificateName + $tries++ + + if ($operation.Status -eq 'failed') { + throw 'Creating certificate $certificateName in vault $vaultName failed with error $($operation.ErrorMessage)' + } + + if ($tries -gt 120) { + throw 'Timed out waiting for creation of certificate $certificateName in vault $vaultName' + } + } while ($operation.Status -ne 'completed') + + $DeploymentScriptOutputs['certThumbprint'] = $newCert.Thumbprint + $newCert | Out-String + ", + "cleanupPreference": "OnSuccess", + "retentionInterval": "P1D" + } + } + ], + "outputs": { + "CERTIFICATE_AZURE_KEYVAULT_ENDPOINT": { + "type": "string", + "value": "[variables('azureKeyVaultUrl')]" + }, + "CERTIFICATE_AZURE_KEYVAULT_URI": { + "type": "string", + "value": "[variables('azureKeyVaultUrl')]" + }, + "CERTIFICATE_AZURE_KEYVAULT_TENANT_ID": { + "type": "string", + "value": "[parameters('tenantId')]" + }, + "CERTIFICATE_AZURE_KEYVAULT_CLIENT_ID": { + "type": "string", + "value": "[parameters('testApplicationId')]" + }, + "CERTIFICATE_AZURE_KEYVAULT_CLIENT_SECRET": { + "type": "string", + "value": "[parameters('testApplicationSecret')]" + }, + "CERTIFICATE_AZURE_KEYVAULT_CERTIFICATE_NAME": { + "type": "string", + "value": "[parameters('certificateName')]" + } + } +} diff --git a/sdk/spring/pom.xml b/sdk/spring/pom.xml index 8e0041090444..be28c0c71e36 100644 --- a/sdk/spring/pom.xml +++ b/sdk/spring/pom.xml @@ -136,33 +136,32 @@ azure-identity-spring + azure-spring-boot + azure-spring-boot-samples/azure-appconfiguration-conversion-sample-complete + azure-spring-boot-samples/azure-appconfiguration-conversion-sample-initial + azure-spring-boot-samples/azure-appconfiguration-sample azure-spring-boot-samples/azure-cloud-foundry-service-sample azure-spring-boot-samples/azure-spring-boot-sample-active-directory-b2c-oidc - azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless + azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter + azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo - azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp azure-spring-boot-samples/azure-spring-boot-sample-cosmos - azure-spring-boot-samples/azure-spring-boot-sample-keyvault-certificates-server-side + azure-spring-boot-samples/azure-spring-boot-sample-cosmos-multi-database-multi-account + azure-spring-boot-samples/azure-spring-boot-sample-cosmos-multi-database-single-account azure-spring-boot-samples/azure-spring-boot-sample-keyvault-certificates-client-side + azure-spring-boot-samples/azure-spring-boot-sample-keyvault-certificates-server-side azure-spring-boot-samples/azure-spring-boot-sample-keyvault-secrets azure-spring-boot-samples/azure-spring-boot-sample-mediaservices + azure-spring-boot-samples/azure-spring-boot-sample-servicebus azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-topic - azure-spring-boot-samples/azure-spring-boot-sample-servicebus azure-spring-boot-samples/azure-spring-boot-sample-storage-resource azure-spring-boot-samples/azure-spring-cloud-sample-cache - azure-spring-boot-samples/azure-appconfiguration-conversion-sample-complete - azure-spring-boot-samples/azure-appconfiguration-conversion-sample-initial - azure-spring-boot-samples/azure-appconfiguration-sample azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-binder - azure-spring-boot-samples/azure-spring-boot-sample-cosmos-multi-database-multi-account - azure-spring-boot-samples/azure-spring-boot-sample-cosmos-multi-database-single-account azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-kafka azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-multibinders - azure-spring-boot-samples/feature-management-web-sample - azure-spring-boot-samples/feature-management-sample azure-spring-boot-samples/azure-spring-cloud-sample-eventhubs-operation azure-spring-boot-samples/azure-spring-cloud-sample-messaging-eventhubs azure-spring-boot-samples/azure-spring-cloud-sample-messaging-servicebus @@ -174,35 +173,37 @@ azure-spring-boot-samples/azure-spring-integration-sample-eventhubs azure-spring-boot-samples/azure-spring-integration-sample-servicebus azure-spring-boot-samples/azure-spring-integration-sample-storage-queue - azure-spring-boot-starter-active-directory-b2c + azure-spring-boot-samples/feature-management-sample + azure-spring-boot-samples/feature-management-web-sample + azure-spring-boot-starter azure-spring-boot-starter-active-directory + azure-spring-boot-starter-active-directory-b2c azure-spring-boot-starter-cosmos azure-spring-boot-starter-keyvault-certificates azure-spring-boot-starter-keyvault-secrets azure-spring-boot-starter-servicebus-jms azure-spring-boot-starter-storage - azure-spring-boot-starter + azure-spring-boot-test-aad + azure-spring-boot-test-aad-b2c azure-spring-boot-test-aad-obo - azure-spring-boot-test-aad-resource-server-by-filter azure-spring-boot-test-aad-resource-server - azure-spring-boot-test-aad + azure-spring-boot-test-aad-resource-server-by-filter azure-spring-boot-test-application - azure-spring-boot-test-aad-b2c - azure-spring-boot-test-selenium-common azure-spring-boot-test-core azure-spring-boot-test-cosmos - azure-spring-boot-test-keyvault/pom.xml + azure-spring-boot-test-keyvault-certificate azure-spring-boot-test-keyvault/pom-reactive.xml + azure-spring-boot-test-keyvault/pom.xml azure-spring-boot-test-parent + azure-spring-boot-test-selenium-common azure-spring-boot-test-servicebus-jms azure-spring-boot-test-storage - azure-spring-boot azure-spring-cloud-autoconfigure azure-spring-cloud-context azure-spring-cloud-messaging azure-spring-cloud-starter-cache - azure-spring-cloud-starter-eventhubs-kafka azure-spring-cloud-starter-eventhubs + azure-spring-cloud-starter-eventhubs-kafka azure-spring-cloud-starter-servicebus azure-spring-cloud-starter-storage-queue azure-spring-cloud-storage diff --git a/sdk/spring/spring-test-template.yml b/sdk/spring/spring-test-template.yml index 486ea71bef35..2a2889a226e1 100644 --- a/sdk/spring/spring-test-template.yml +++ b/sdk/spring/spring-test-template.yml @@ -5,6 +5,7 @@ parameters: TestResourceDirectories: - spring/azure-spring-boot-test-cosmos - spring/azure-spring-boot-test-keyvault + - spring/azure-spring-boot-test-keyvault-certificate - spring/azure-spring-boot-test-servicebus-jms - spring/azure-spring-boot-test-storage - spring/azure-spring-cloud-test-eventhubs @@ -39,6 +40,9 @@ parameters: - name: azure-spring-boot-test-keyvault groupId: com.azure.spring safeName: azurespringboottestkeyvault + - name: azure-spring-boot-test-keyvault-certificate + groupId: com.azure.spring + safeName: azurespringboottestkeyvaultcertificate - name: azure-spring-boot-test-keyvault-reactive groupId: com.azure.spring safeName: azurespringboottestkeyvaultreactive From 665efa5abaddac6ac14c97657b70a0a2599c2609 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Wed, 2 Jun 2021 13:53:28 +0800 Subject: [PATCH 19/53] mgmt, fix sample as previous ARM template get deleted (#22011) --- .../java/com/azure/resourcemanager/DesignPreviewSamples.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/DesignPreviewSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/DesignPreviewSamples.java index dfc816425381..796fdffc38f9 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/DesignPreviewSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/DesignPreviewSamples.java @@ -23,8 +23,8 @@ public class DesignPreviewSamples { private final String rgName = "rg-test"; private final String contentVersion = "1.0.0.0"; - private final String templateUri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-vnet-two-subnets/azuredeploy.json"; - private final String parametersUri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-vnet-two-subnets/azuredeploy.parameters.json"; + private final String templateUri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-cognitive-services-translate/azuredeploy.json"; + private final String parametersUri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-cognitive-services-translate/azuredeploy.parameters.json"; // extra empty lines to compensate import lines From d4836d4682a2adacfb3dfbd83862e874a202c969 Mon Sep 17 00:00:00 2001 From: gaohan <1135494872@qq.com> Date: Wed, 2 Jun 2021 17:25:02 +0800 Subject: [PATCH 20/53] Add more test for jca integration test. (#21523) --- .../azure-security-keyvault-jca/pom.xml | 6 ++++ .../azure-security-test-keyvault-jca/pom.xml | 6 ++++ .../security/keyvault/jca/AuthClientTest.java | 2 +- .../jca/KeyVaultCertificatesTest.java | 13 ++++---- .../keyvault/jca/KeyVaultClientTest.java | 3 +- .../keyvault/jca/KeyVaultJcaProviderTest.java | 9 ++---- .../keyvault/jca/KeyVaultKeyManagerTest.java | 9 ++---- .../keyvault/jca/KeyVaultKeyStoreTest.java | 16 +++++----- .../jca/KeyVaultLoadStoreParameterTest.java | 30 ------------------- .../keyvault/jca/ServerSocketTest.java | 16 +++++----- sdk/keyvault/test-resources.json | 4 +-- 11 files changed, 41 insertions(+), 73 deletions(-) delete mode 100644 sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultLoadStoreParameterTest.java diff --git a/sdk/keyvault/azure-security-keyvault-jca/pom.xml b/sdk/keyvault/azure-security-keyvault-jca/pom.xml index 12584db23bbf..cc2aaefd87e8 100644 --- a/sdk/keyvault/azure-security-keyvault-jca/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-jca/pom.xml @@ -203,6 +203,12 @@ 3.9.0 test + + com.azure + azure-core-test + 1.6.2 + test + UTF-8 diff --git a/sdk/keyvault/azure-security-test-keyvault-jca/pom.xml b/sdk/keyvault/azure-security-test-keyvault-jca/pom.xml index 893fc6675ff2..7e0640d9f98e 100644 --- a/sdk/keyvault/azure-security-test-keyvault-jca/pom.xml +++ b/sdk/keyvault/azure-security-test-keyvault-jca/pom.xml @@ -75,5 +75,11 @@ 5.3.7 test + + com.azure + azure-core-test + 1.6.2 + test + \ No newline at end of file diff --git a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/AuthClientTest.java b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/AuthClientTest.java index 88a76a445e5d..2e9de840fb1f 100644 --- a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/AuthClientTest.java +++ b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/AuthClientTest.java @@ -29,7 +29,7 @@ public void testGetAuthorizationToken() throws Exception { AuthClient authClient = new AuthClient(); String result = authClient.getAccessToken( "https://management.azure.com/", - System.getProperty("azure.keyvault.aad-authentication-url"), + null, tenantId, clientId, URLEncoder.encode(clientSecret, "UTF-8") diff --git a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultCertificatesTest.java b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultCertificatesTest.java index acb53e383397..571067245f4a 100644 --- a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultCertificatesTest.java +++ b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultCertificatesTest.java @@ -14,10 +14,12 @@ import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; -import java.util.Arrays; import java.util.Base64; -import static org.junit.jupiter.api.Assertions.*; +import static com.azure.security.keyvault.jca.PropertyConvertorUtils.SYSTEM_PROPERTIES; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * The JUnit test for the KeyVaultCertificates. @@ -53,12 +55,7 @@ public class KeyVaultCertificatesTest { @BeforeAll public static void setEnvironmentProperty() { - PropertyConvertorUtils.putEnvironmentPropertyToSystemProperty( - Arrays.asList("AZURE_KEYVAULT_URI", - "AZURE_KEYVAULT_TENANT_ID", - "AZURE_KEYVAULT_CLIENT_ID", - "AZURE_KEYVAULT_CLIENT_SECRET") - ); + PropertyConvertorUtils.putEnvironmentPropertyToSystemProperty(SYSTEM_PROPERTIES); KeyVaultJcaProvider provider = new KeyVaultJcaProvider(); Security.addProvider(provider); certificateName = System.getenv("AZURE_KEYVAULT_CERTIFICATE_NAME"); diff --git a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultClientTest.java b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultClientTest.java index 39649a305975..767aeb615eae 100644 --- a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultClientTest.java +++ b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultClientTest.java @@ -8,6 +8,7 @@ import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; @EnabledIfEnvironmentVariable(named = "AZURE_KEYVAULT_CERTIFICATE_NAME", matches = "myalias") public class KeyVaultClientTest { @@ -26,7 +27,7 @@ public static void setEnvironmentProperty() { @Test public void testGetAliases() { - assertNotNull(keyVaultClient.getAliases()); + assertTrue(keyVaultClient.getAliases().contains(certificateName)); } @Test diff --git a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultJcaProviderTest.java b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultJcaProviderTest.java index 2d52b338574f..77dffcecdb99 100644 --- a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultJcaProviderTest.java +++ b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultJcaProviderTest.java @@ -8,8 +8,8 @@ import java.security.KeyStore; import java.security.Security; -import java.util.Arrays; +import static com.azure.security.keyvault.jca.PropertyConvertorUtils.SYSTEM_PROPERTIES; import static org.junit.jupiter.api.Assertions.assertNotNull; /** @@ -26,12 +26,7 @@ public class KeyVaultJcaProviderTest { */ @Test public void testGetCertificate() throws Exception { - PropertyConvertorUtils.putEnvironmentPropertyToSystemProperty( - Arrays.asList("AZURE_KEYVAULT_URI", - "AZURE_KEYVAULT_TENANT_ID", - "AZURE_KEYVAULT_CLIENT_ID", - "AZURE_KEYVAULT_CLIENT_SECRET") - ); + PropertyConvertorUtils.putEnvironmentPropertyToSystemProperty(SYSTEM_PROPERTIES); Security.addProvider(new KeyVaultJcaProvider()); KeyStore keystore = PropertyConvertorUtils.getKeyVaultKeyStore(); assertNotNull(keystore.getCertificate(System.getenv("AZURE_KEYVAULT_CERTIFICATE_NAME"))); diff --git a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultKeyManagerTest.java b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultKeyManagerTest.java index 305e9e8af7ed..0190a24ee0a2 100644 --- a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultKeyManagerTest.java +++ b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultKeyManagerTest.java @@ -13,8 +13,8 @@ import java.security.NoSuchAlgorithmException; import java.security.Security; import java.security.cert.CertificateException; -import java.util.Arrays; +import static com.azure.security.keyvault.jca.PropertyConvertorUtils.SYSTEM_PROPERTIES; import static org.junit.jupiter.api.Assertions.assertNotNull; @EnabledIfEnvironmentVariable(named = "AZURE_KEYVAULT_CERTIFICATE_NAME", matches = "myalias") @@ -26,12 +26,7 @@ public class KeyVaultKeyManagerTest { @BeforeAll public static void setEnvironmentProperty() throws KeyStoreException, NoSuchAlgorithmException, IOException, CertificateException { - PropertyConvertorUtils.putEnvironmentPropertyToSystemProperty( - Arrays.asList("AZURE_KEYVAULT_URI", - "AZURE_KEYVAULT_TENANT_ID", - "AZURE_KEYVAULT_CLIENT_ID", - "AZURE_KEYVAULT_CLIENT_SECRET") - ); + PropertyConvertorUtils.putEnvironmentPropertyToSystemProperty(SYSTEM_PROPERTIES); KeyVaultJcaProvider provider = new KeyVaultJcaProvider(); Security.addProvider(provider); KeyStore keyStore = PropertyConvertorUtils.getKeyVaultKeyStore(); diff --git a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultKeyStoreTest.java b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultKeyStoreTest.java index f2a18a9dba6c..7acae0be4fc2 100644 --- a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultKeyStoreTest.java +++ b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultKeyStoreTest.java @@ -15,10 +15,14 @@ import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; -import java.util.Arrays; import java.util.Base64; -import static org.junit.jupiter.api.Assertions.*; +import static com.azure.security.keyvault.jca.PropertyConvertorUtils.SYSTEM_PROPERTIES; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * The JUnit tests for the KeyVaultKeyStore class. @@ -57,12 +61,7 @@ public class KeyVaultKeyStoreTest { @BeforeAll public static void setEnvironmentProperty() { - PropertyConvertorUtils.putEnvironmentPropertyToSystemProperty( - Arrays.asList("AZURE_KEYVAULT_URI", - "AZURE_KEYVAULT_TENANT_ID", - "AZURE_KEYVAULT_CLIENT_ID", - "AZURE_KEYVAULT_CLIENT_SECRET") - ); + PropertyConvertorUtils.putEnvironmentPropertyToSystemProperty(SYSTEM_PROPERTIES); keystore = new KeyVaultKeyStore(); KeyVaultLoadStoreParameter parameter = new KeyVaultLoadStoreParameter( System.getenv("AZURE_KEYVAULT_URI"), @@ -174,6 +173,7 @@ public void testRefreshEngineGetCertificate() throws Exception { @Test public void testNotRefreshEngineGetCertificate() throws Exception { + System.setProperty("azure.keyvault.jca.refresh-certificates-when-have-un-trust-certificate", "false"); KeyVaultJcaProvider provider = new KeyVaultJcaProvider(); Security.addProvider(provider); KeyStore ks = PropertyConvertorUtils.getKeyVaultKeyStore(); diff --git a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultLoadStoreParameterTest.java b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultLoadStoreParameterTest.java deleted file mode 100644 index eed52ea0dd37..000000000000 --- a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/KeyVaultLoadStoreParameterTest.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.security.keyvault.jca; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; - -import static org.junit.jupiter.api.Assertions.assertNull; - -/** - * The JUnit tests for the KeyVaultLoadStoreParameter class. - */ -@EnabledIfEnvironmentVariable(named = "AZURE_KEYVAULT_CERTIFICATE_NAME", matches = "myalias") -public class KeyVaultLoadStoreParameterTest { - - /** - * Test getProtectionParameter method. - */ - @Test - public void testGetProtectionParameter() { - KeyVaultLoadStoreParameter parameter = new KeyVaultLoadStoreParameter( - System.getenv("AZURE_KEYVAULT_URI"), - System.getenv("AZURE_KEYVAULT_TENANT_ID"), - System.getenv("AZURE_KEYVAULT_CLIENT_ID"), - System.getenv("AZURE_KEYVAULT_CLIENT_SECRET") - ); - assertNull(parameter.getProtectionParameter()); - } -} diff --git a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/ServerSocketTest.java b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/ServerSocketTest.java index 921d2f471ed9..7329d53360a0 100644 --- a/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/ServerSocketTest.java +++ b/sdk/keyvault/azure-security-test-keyvault-jca/src/test/java/com/azure/security/keyvault/jca/ServerSocketTest.java @@ -17,20 +17,23 @@ import org.apache.http.ssl.PrivateKeyStrategy; import org.apache.http.ssl.SSLContexts; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; -import javax.net.ssl.*; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLServerSocket; +import javax.net.ssl.SSLServerSocketFactory; +import javax.net.ssl.TrustManagerFactory; import java.io.IOException; import java.io.OutputStream; import java.net.Socket; import java.security.KeyStore; import java.security.Security; import java.security.cert.X509Certificate; -import java.util.Arrays; import java.util.Map; +import static com.azure.security.keyvault.jca.PropertyConvertorUtils.SYSTEM_PROPERTIES; import static org.junit.jupiter.api.Assertions.assertEquals; /** @@ -52,12 +55,7 @@ public static void beforeEach() throws Exception { */ KeyVaultJcaProvider provider = new KeyVaultJcaProvider(); Security.addProvider(provider); - PropertyConvertorUtils.putEnvironmentPropertyToSystemProperty( - Arrays.asList("AZURE_KEYVAULT_URI", - "AZURE_KEYVAULT_TENANT_ID", - "AZURE_KEYVAULT_CLIENT_ID", - "AZURE_KEYVAULT_CLIENT_SECRET") - ); + PropertyConvertorUtils.putEnvironmentPropertyToSystemProperty(SYSTEM_PROPERTIES); /** * - Create an Azure Key Vault specific instance of a KeyStore. diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index a7f73d4f2cf5..fd7b8b865b27 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -64,7 +64,7 @@ }, "subjectName": { "type": "string", - "defaultValue": "CN=contoso.com" + "defaultValue": "CN=mydomain.com" }, "utcValue": { "type": "string", @@ -259,7 +259,7 @@ $policy = New-AzKeyVaultCertificatePolicy -SubjectName $subjectName -IssuerName Self -ValidityInMonths 12 -Verbose - Add-AzKeyVaultCertificate -VaultName $vaultName -Name $certificateName -CertificatePolicy $policy -Verbose + Add-AzKeyVaultCertificate -VaultName $vaultName -Name $certificateName -CertificatePolicy $policy -Verbose $newCert = Get-AzKeyVaultCertificate -VaultName $vaultName -Name $certificateName From 30f1c85f2f176ca64e322a544c59b0494bb36b73 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Wed, 2 Jun 2021 10:20:10 -0700 Subject: [PATCH 21/53] azure-messaging-eventhubs-checkpointstore-blob Post Release Version Increment (#22010) --- common/smoke-tests/pom.xml | 2 +- eng/versioning/version_client.txt | 2 +- sdk/boms/azure-spring-cloud-dependencies/pom.xml | 2 +- .../CHANGELOG.md | 5 +++++ .../azure-messaging-eventhubs-checkpointstore-blob/README.md | 2 +- sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml | 2 +- .../azure-spring-cloud-stream-binder-eventhubs/pom.xml | 2 +- sdk/spring/azure-spring-integration-eventhubs/pom.xml | 2 +- 8 files changed, 12 insertions(+), 7 deletions(-) diff --git a/common/smoke-tests/pom.xml b/common/smoke-tests/pom.xml index c900d38dc034..792bff2aadce 100644 --- a/common/smoke-tests/pom.xml +++ b/common/smoke-tests/pom.xml @@ -142,7 +142,7 @@ com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.7.0 + 1.7.1 diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 7242e482492d..da00e4e7a9a7 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -90,7 +90,7 @@ com.azure:azure-iot-deviceupdate;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-iot-modelsrepository;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-messaging-eventgrid;4.3.0;4.4.0-beta.1 com.azure:azure-messaging-eventhubs;5.7.1;5.8.0-beta.1 -com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.7.0;1.8.0-beta.1 +com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.7.1;1.8.0-beta.1 com.azure:azure-messaging-eventhubs-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-eventhubs-track2-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-servicebus;7.2.1;7.3.0-beta.3 diff --git a/sdk/boms/azure-spring-cloud-dependencies/pom.xml b/sdk/boms/azure-spring-cloud-dependencies/pom.xml index f674b313f116..e63748da8b4f 100644 --- a/sdk/boms/azure-spring-cloud-dependencies/pom.xml +++ b/sdk/boms/azure-spring-cloud-dependencies/pom.xml @@ -48,7 +48,7 @@ 1.3.0 1.16.0 5.7.1 - 1.7.0 + 1.7.1 3.6.1 12.9.1 diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md index 48850287101e..c8ea18dada1b 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md @@ -2,6 +2,11 @@ ## 1.8.0-beta.1 (Unreleased) +## 1.7.1 (2021-06-01) + +### Dependency Updates + +- Update `azure-storage-blob` to `12.11.1`. ## 1.7.0 (2021-05-10) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md index d1483495d07f..6678697fc340 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md @@ -27,7 +27,7 @@ documentation][event_hubs_product_docs] | [Samples][sample_examples] com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.7.0 + 1.7.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml b/sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml index 0ef73e0f24bc..73b28051efbb 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml @@ -107,7 +107,7 @@ com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.7.0 + 1.7.1 test diff --git a/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/pom.xml b/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/pom.xml index 13980cd6fed7..7571f69b68c1 100644 --- a/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/pom.xml +++ b/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/pom.xml @@ -38,7 +38,7 @@ com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.7.0 + 1.7.1 diff --git a/sdk/spring/azure-spring-integration-eventhubs/pom.xml b/sdk/spring/azure-spring-integration-eventhubs/pom.xml index 7452ffdc17a2..e5e8b1018ae4 100644 --- a/sdk/spring/azure-spring-integration-eventhubs/pom.xml +++ b/sdk/spring/azure-spring-integration-eventhubs/pom.xml @@ -38,7 +38,7 @@ com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.7.0 + 1.7.1 com.azure.spring From 9359bc5fdde910cb1732c67cc52e49a912e81605 Mon Sep 17 00:00:00 2001 From: Craig Treasure Date: Wed, 2 Jun 2021 10:30:34 -0700 Subject: [PATCH 22/53] Update CODEOWNERs for Mixed Reality Authentication (#22004) This change adds me as a code owner of the Mixed Reality Authentication library. --- .github/CODEOWNERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5005c0b5d55c..895d85fe3f04 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -75,6 +75,9 @@ /sdk/monitor/azure-monitor-opentelemetry-exporter @trask @joshfree @srnagar +# PRLabel: %Mixed Reality Authentication +/sdk/mixedreality/azure-mixedreality-authentication @craigktreasure + # PRLabel: %Remote Rendering /sdk/remoterendering/ @MalcolmTyrrell From 349a8a88ceae34191fe285b4d0b0e62a08cb31c7 Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Wed, 2 Jun 2021 11:41:18 -0700 Subject: [PATCH 23/53] Bump versions of core amqp and servicebus (#22020) --- common/smoke-tests/pom.xml | 2 +- eng/versioning/version_client.txt | 4 ++-- sdk/core/azure-core-amqp/CHANGELOG.md | 6 ++++++ sdk/core/azure-core-amqp/README.md | 2 +- sdk/resourcemanager/azure-resourcemanager-samples/pom.xml | 2 +- sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md | 8 ++++++++ sdk/servicebus/azure-messaging-servicebus/README.md | 2 +- sdk/spring/azure-spring-cloud-starter-servicebus/pom.xml | 2 +- .../pom.xml | 2 +- sdk/spring/azure-spring-integration-servicebus/pom.xml | 2 +- 10 files changed, 23 insertions(+), 9 deletions(-) diff --git a/common/smoke-tests/pom.xml b/common/smoke-tests/pom.xml index 792bff2aadce..a1bc535cad2f 100644 --- a/common/smoke-tests/pom.xml +++ b/common/smoke-tests/pom.xml @@ -112,7 +112,7 @@ com.azure azure-core-amqp - 2.0.5 + 2.0.6 diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index da00e4e7a9a7..968c48175442 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -58,7 +58,7 @@ com.azure:azure-communication-identity;1.1.0;1.2.0-beta.1 com.azure:azure-communication-phonenumbers;1.0.1;1.1.0-beta.1 com.azure:azure-containers-containerregistry;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-core;1.16.0;1.17.0-beta.1 -com.azure:azure-core-amqp;2.0.5;2.1.0-beta.1 +com.azure:azure-core-amqp;2.0.6;2.1.0-beta.1 com.azure:azure-core-amqp-experimental;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core-experimental;1.0.0-beta.13;1.0.0-beta.14 com.azure:azure-core-http-jdk-httpclient;1.0.0-beta.1;1.0.0-beta.1 @@ -93,7 +93,7 @@ com.azure:azure-messaging-eventhubs;5.7.1;5.8.0-beta.1 com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.7.1;1.8.0-beta.1 com.azure:azure-messaging-eventhubs-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-eventhubs-track2-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-messaging-servicebus;7.2.1;7.3.0-beta.3 +com.azure:azure-messaging-servicebus;7.2.2;7.3.0-beta.3 com.azure:azure-messaging-servicebus-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-servicebus-track2-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-webpubsub;1.0.0-beta.2;1.0.0-beta.3 diff --git a/sdk/core/azure-core-amqp/CHANGELOG.md b/sdk/core/azure-core-amqp/CHANGELOG.md index e82bf2c94798..95f3244eaa11 100644 --- a/sdk/core/azure-core-amqp/CHANGELOG.md +++ b/sdk/core/azure-core-amqp/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 2.1.0-beta.1 (Unreleased) + +## 2.0.6 (2021-05-24) +### Bug Fixes +- Fixed a bug that caused amqp connection not to retry when network error happened. + ## 2.0.5 (2021-05-07) ### Dependency Updates diff --git a/sdk/core/azure-core-amqp/README.md b/sdk/core/azure-core-amqp/README.md index 605e6b3f3e3e..8551b3b020e4 100644 --- a/sdk/core/azure-core-amqp/README.md +++ b/sdk/core/azure-core-amqp/README.md @@ -16,7 +16,7 @@ own AMQP client library that abstracts from the underlying transport library's i com.azure azure-core-amqp - 2.0.5 + 2.0.6 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml b/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml index 96811ab6347e..10e5419d3793 100644 --- a/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml @@ -113,7 +113,7 @@ com.azure azure-messaging-servicebus - 7.2.1 + 7.2.2 io.fabric8 diff --git a/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md b/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md index a007894d1802..db94b1b6e726 100644 --- a/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md +++ b/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md @@ -2,6 +2,14 @@ ## 7.3.0-beta.3 (Unreleased) +## 7.2.2 (2021-05-26) +### Fixed +- Fixed some connection retry issues when network errors happen. +- Fixed an issue that caused `ServiceBusSenderClient` to keep running after it's already closed. + +### Dependency Updates +- Upgraded `azure-core-amqp` dependency to `2.0.6`. + ## 7.2.1 (2021-05-12) ### Fixed - Fixed an issue: When 'ServiceBusProcessorClient:maxConcurrentCalls' is set, this will result in SDK cache more diff --git a/sdk/servicebus/azure-messaging-servicebus/README.md b/sdk/servicebus/azure-messaging-servicebus/README.md index 614d8d37f3d1..b2c7e0878003 100644 --- a/sdk/servicebus/azure-messaging-servicebus/README.md +++ b/sdk/servicebus/azure-messaging-servicebus/README.md @@ -37,7 +37,7 @@ To quickly create the needed Service Bus resources in Azure and to receive a con com.azure azure-messaging-servicebus - 7.2.1 + 7.2.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/spring/azure-spring-cloud-starter-servicebus/pom.xml b/sdk/spring/azure-spring-cloud-starter-servicebus/pom.xml index 246a4806b47c..07928baca132 100644 --- a/sdk/spring/azure-spring-cloud-starter-servicebus/pom.xml +++ b/sdk/spring/azure-spring-cloud-starter-servicebus/pom.xml @@ -29,7 +29,7 @@ com.azure azure-messaging-servicebus - 7.2.1 + 7.2.2 diff --git a/sdk/spring/azure-spring-cloud-stream-binder-servicebus-core/pom.xml b/sdk/spring/azure-spring-cloud-stream-binder-servicebus-core/pom.xml index 0d4fc042aaa6..1b213244d7a9 100644 --- a/sdk/spring/azure-spring-cloud-stream-binder-servicebus-core/pom.xml +++ b/sdk/spring/azure-spring-cloud-stream-binder-servicebus-core/pom.xml @@ -40,7 +40,7 @@ com.azure azure-messaging-servicebus - 7.2.1 + 7.2.2 + 7.2.2 com.azure.spring From 07d96e8d2a80eb73c6dc6c23c2b657f53456c272 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Wed, 2 Jun 2021 18:09:16 -0400 Subject: [PATCH 24/53] Update azure-sdk-build-tools Repository Resource Refs in Yaml files (#22031) --- eng/pipelines/partner-release.yml | 2 +- eng/pipelines/templates/stages/archetype-sdk-client.yml | 2 +- eng/pipelines/templates/stages/archetype-sdk-pom-only.yml | 2 +- eng/pipelines/templates/stages/cosmos-sdk-client.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/partner-release.yml b/eng/pipelines/partner-release.yml index 48735edcb16e..c8e1a8246a1b 100644 --- a/eng/pipelines/partner-release.yml +++ b/eng/pipelines/partner-release.yml @@ -6,7 +6,7 @@ resources: - repository: azure-sdk-build-tools type: git name: internal/azure-sdk-build-tools - ref: refs/tags/azure-sdk-build-tools_20200916.1 + ref: refs/tags/azure-sdk-build-tools_20210602.1 variables: BuildToolScripts: $(Pipeline.Workspace)/azure-sdk-build-tools/scripts diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index fc3d02468b01..cb7e4dfead2f 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -3,7 +3,7 @@ resources: - repository: azure-sdk-build-tools type: git name: internal/azure-sdk-build-tools - ref: refs/tags/azure-sdk-build-tools_20200916.1 + ref: refs/tags/azure-sdk-build-tools_20210602.1 parameters: - name: Artifacts diff --git a/eng/pipelines/templates/stages/archetype-sdk-pom-only.yml b/eng/pipelines/templates/stages/archetype-sdk-pom-only.yml index 40600fbbab2d..f6d88c93dfaa 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-pom-only.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-pom-only.yml @@ -3,7 +3,7 @@ resources: - repository: azure-sdk-build-tools type: git name: internal/azure-sdk-build-tools - ref: refs/tags/azure-sdk-build-tools_20200916.1 + ref: refs/tags/azure-sdk-build-tools_20210602.1 parameters: - name: Artifacts diff --git a/eng/pipelines/templates/stages/cosmos-sdk-client.yml b/eng/pipelines/templates/stages/cosmos-sdk-client.yml index a24de9ab2101..fde9fccdf19a 100644 --- a/eng/pipelines/templates/stages/cosmos-sdk-client.yml +++ b/eng/pipelines/templates/stages/cosmos-sdk-client.yml @@ -3,7 +3,7 @@ resources: - repository: azure-sdk-build-tools type: git name: internal/azure-sdk-build-tools - ref: refs/tags/azure-sdk-build-tools_20200916.1 + ref: refs/tags/azure-sdk-build-tools_20210602.1 parameters: - name: Artifacts From c6f19558ddd54cf0952e60d17c62c95647ad2abe Mon Sep 17 00:00:00 2001 From: John Mannix Date: Wed, 2 Jun 2021 23:39:47 +0100 Subject: [PATCH 25/53] Add autoscale RU support for azure-spring-data-cosmos (#21851) * Add autoscale RU support for azure-spring-data-cosmos Resolves #12711 * Added sample to read me for auto scale throughput * Fixed readme link Co-authored-by: Kushagra Thapar --- .../data/cosmos/common/TestConstants.java | 1 + .../data/cosmos/core/CosmosTemplateIT.java | 21 ++++++++++++++- .../cosmos/core/ReactiveCosmosTemplateIT.java | 25 ++++++++++++++++- .../data/cosmos/domain/AutoScaleSample.java | 27 +++++++++++++++++++ sdk/cosmos/azure-spring-data-cosmos/README.md | 7 ++++- .../azure/spring/data/cosmos/Constants.java | 1 + .../data/cosmos/core/CosmosTemplate.java | 5 ++-- .../cosmos/core/ReactiveCosmosTemplate.java | 5 ++-- .../data/cosmos/core/mapping/Container.java | 6 +++++ .../support/CosmosEntityInformation.java | 22 +++++++++++++++ .../azure/spring/data/cosmos/UserSample.java | 2 +- 11 files changed, 114 insertions(+), 8 deletions(-) create mode 100644 sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/domain/AutoScaleSample.java diff --git a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/common/TestConstants.java b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/common/TestConstants.java index 6ac78bc1668d..8b79513499d8 100644 --- a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/common/TestConstants.java +++ b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/common/TestConstants.java @@ -10,6 +10,7 @@ public final class TestConstants { + public static final String AUTOSCALE_MAX_THROUGHPUT = "4000"; private static final Address ADDRESS_1 = new Address("201107", "Zixing Road", "Shanghai"); private static final Address ADDRESS_2 = new Address("200000", "Xuhui", "Shanghai"); public static final String HOBBY1 = "photography"; diff --git a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIT.java b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIT.java index 2921769b018f..8be7d42fe414 100644 --- a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIT.java @@ -6,8 +6,10 @@ import com.azure.cosmos.CosmosClientBuilder; import com.azure.cosmos.CosmosException; import com.azure.cosmos.implementation.ConflictException; +import com.azure.cosmos.models.CosmosContainerProperties; import com.azure.cosmos.models.PartitionKey; import com.azure.cosmos.models.SqlQuerySpec; +import com.azure.cosmos.models.ThroughputResponse; import com.azure.spring.data.cosmos.CosmosFactory; import com.azure.spring.data.cosmos.IntegrationTestCollectionManager; import com.azure.spring.data.cosmos.common.PageTestUtils; @@ -23,6 +25,7 @@ import com.azure.spring.data.cosmos.core.query.Criteria; import com.azure.spring.data.cosmos.core.query.CriteriaType; import com.azure.spring.data.cosmos.domain.AuditableEntity; +import com.azure.spring.data.cosmos.domain.AutoScaleSample; import com.azure.spring.data.cosmos.domain.GenIdEntity; import com.azure.spring.data.cosmos.domain.Person; import com.azure.spring.data.cosmos.exception.CosmosAccessException; @@ -93,6 +96,7 @@ public class CosmosTemplateIT { @ClassRule public static final IntegrationTestCollectionManager collectionManager = new IntegrationTestCollectionManager(); + private static CosmosAsyncClient client; private static CosmosTemplate cosmosTemplate; private static CosmosEntityInformation personInfo; private static String containerName; @@ -113,7 +117,7 @@ public class CosmosTemplateIT { @Before public void setUp() throws ClassNotFoundException { if (cosmosTemplate == null) { - CosmosAsyncClient client = CosmosFactory.createCosmosAsyncClient(cosmosClientBuilder); + client = CosmosFactory.createCosmosAsyncClient(cosmosClientBuilder); final CosmosFactory cosmosFactory = new CosmosFactory(client, TestConstants.DB_NAME); final CosmosMappingContext mappingContext = new CosmosMappingContext(); @@ -609,4 +613,19 @@ public void testSliceQuery() { assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics()).isNotNull(); assertThat(responseDiagnosticsTestUtils.getCosmosResponseStatistics().getRequestCharge()).isGreaterThan(0); } + + @Test + public void createWithAutoscale() throws ClassNotFoundException { + final CosmosEntityInformation autoScaleSampleInfo = + new CosmosEntityInformation<>(AutoScaleSample.class); + CosmosContainerProperties containerProperties = cosmosTemplate.createContainerIfNotExists(autoScaleSampleInfo); + assertNotNull(containerProperties); + ThroughputResponse throughput = client.getDatabase(TestConstants.DB_NAME) + .getContainer(autoScaleSampleInfo.getContainerName()) + .readThroughput() + .block(); + assertNotNull(throughput); + assertEquals(Integer.parseInt(TestConstants.AUTOSCALE_MAX_THROUGHPUT), + throughput.getProperties().getAutoscaleMaxThroughput()); + } } diff --git a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplateIT.java b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplateIT.java index ff7687daf643..cec0b680832a 100644 --- a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplateIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplateIT.java @@ -7,8 +7,11 @@ import com.azure.cosmos.CosmosClientBuilder; import com.azure.cosmos.CosmosException; import com.azure.cosmos.implementation.ConflictException; +import com.azure.cosmos.models.CosmosContainerProperties; +import com.azure.cosmos.models.CosmosContainerResponse; import com.azure.cosmos.models.PartitionKey; import com.azure.cosmos.models.SqlQuerySpec; +import com.azure.cosmos.models.ThroughputResponse; import com.azure.spring.data.cosmos.CosmosFactory; import com.azure.spring.data.cosmos.ReactiveIntegrationTestCollectionManager; import com.azure.spring.data.cosmos.common.ResponseDiagnosticsTestUtils; @@ -21,6 +24,7 @@ import com.azure.spring.data.cosmos.core.query.Criteria; import com.azure.spring.data.cosmos.core.query.CriteriaType; import com.azure.spring.data.cosmos.domain.AuditableEntity; +import com.azure.spring.data.cosmos.domain.AutoScaleSample; import com.azure.spring.data.cosmos.domain.GenIdEntity; import com.azure.spring.data.cosmos.domain.Person; import com.azure.spring.data.cosmos.exception.CosmosAccessException; @@ -59,6 +63,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @RunWith(SpringJUnit4ClassRunner.class) @@ -92,6 +98,7 @@ public class ReactiveCosmosTemplateIT { @Value("${cosmos.key}") private String cosmosDbKey; + private static CosmosAsyncClient client; private static ReactiveCosmosTemplate cosmosTemplate; private static String containerName; private static CosmosEntityInformation personInfo; @@ -115,7 +122,7 @@ public void setUp() throws ClassNotFoundException { if (cosmosTemplate == null) { azureKeyCredential = new AzureKeyCredential(cosmosDbKey); cosmosClientBuilder.credential(azureKeyCredential); - CosmosAsyncClient client = CosmosFactory.createCosmosAsyncClient(cosmosClientBuilder); + client = CosmosFactory.createCosmosAsyncClient(cosmosClientBuilder); final CosmosFactory dbFactory = new CosmosFactory(client, TestConstants.DB_NAME); final CosmosMappingContext mappingContext = new CosmosMappingContext(); @@ -501,4 +508,20 @@ public void testRunQueryWithReturnTypeContainingLocalDateTime() { StepVerifier.create(flux).expectNextCount(1).verifyComplete(); } + @Test + public void createWithAutoscale() { + final CosmosEntityInformation autoScaleSampleInfo = + new CosmosEntityInformation<>(AutoScaleSample.class); + CosmosContainerResponse containerResponse = cosmosTemplate + .createContainerIfNotExists(autoScaleSampleInfo) + .block(); + assertNotNull(containerResponse); + ThroughputResponse throughput = client.getDatabase(TestConstants.DB_NAME) + .getContainer(autoScaleSampleInfo.getContainerName()) + .readThroughput() + .block(); + assertNotNull(throughput); + assertEquals(Integer.parseInt(TestConstants.AUTOSCALE_MAX_THROUGHPUT), + throughput.getProperties().getAutoscaleMaxThroughput()); + } } diff --git a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/domain/AutoScaleSample.java b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/domain/AutoScaleSample.java new file mode 100644 index 000000000000..67936ab567f9 --- /dev/null +++ b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/domain/AutoScaleSample.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.spring.data.cosmos.domain; + +import com.azure.spring.data.cosmos.common.TestConstants; +import com.azure.spring.data.cosmos.core.mapping.Container; + +@Container(ru = TestConstants.AUTOSCALE_MAX_THROUGHPUT, autoScale = true) +public class AutoScaleSample { + private String id; + + public AutoScaleSample() { + } + + public AutoScaleSample(String id) { + this.id = id; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + +} diff --git a/sdk/cosmos/azure-spring-data-cosmos/README.md b/sdk/cosmos/azure-spring-data-cosmos/README.md index 15e4277b374d..2bb7677dbc3f 100644 --- a/sdk/cosmos/azure-spring-data-cosmos/README.md +++ b/sdk/cosmos/azure-spring-data-cosmos/README.md @@ -244,9 +244,13 @@ public class User { - Annotation `@Container(containerName="myContainer")` specifies container name in Azure Cosmos DB. - Annotation `@PartitionKey` on `lastName` field specifies this field as partition key in Azure Cosmos DB. + +#### Creating Containers with autoscale throughput +- Annotation `autoScale` field specifies container to be created with autoscale throughput if set to true. Default is false, which means containers are created with manual throughput. +- Read more about autoscale throughput [here][autoscale-throughput] ```java -@Container(containerName = "myContainer") +@Container(containerName = "myContainer", autoScale = true, ru = "4000") public class UserSample { @Id private String emailAddress; @@ -935,5 +939,6 @@ or contact [opencode@microsoft.com][coc_contact] with any additional questions o [spring_data_custom_query]: https://docs.spring.io/spring-data/commons/docs/current/reference/html/#repositories.query-methods.details [sql_queries_in_cosmos]: https://docs.microsoft.com/azure/cosmos-db/tutorial-query-sql-api [sql_queries_getting_started]: https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started +[autoscale-throughput]: https://docs.microsoft.com/azure/cosmos-db/provision-throughput-autoscale ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fcosmos%2F%2Fazure-spring-data-cosmos%2FREADME.png) diff --git a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/Constants.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/Constants.java index 8b03ad2f938b..2fb853f948db 100644 --- a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/Constants.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/Constants.java @@ -15,6 +15,7 @@ public final class Constants { public static final String DEFAULT_REPOSITORY_IMPLEMENT_POSTFIX = "Impl"; public static final int DEFAULT_TIME_TO_LIVE = -1; // Indicates never expire public static final boolean DEFAULT_AUTO_CREATE_CONTAINER = true; + public static final boolean DEFAULT_AUTO_SCALE = false; public static final String ID_PROPERTY_NAME = "id"; public static final String ETAG_PROPERTY_DEFAULT_NAME = "_etag"; diff --git a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/CosmosTemplate.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/CosmosTemplate.java index 1df1bd7ee32b..5889ec1ef145 100644 --- a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/CosmosTemplate.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/CosmosTemplate.java @@ -474,8 +474,9 @@ public CosmosContainerProperties createContainerIfNotExists(CosmosEntityInformat cosmosContainerResponseMono = cosmosAsyncDatabase.createContainerIfNotExists(cosmosContainerProperties); } else { - ThroughputProperties throughputProperties = - ThroughputProperties.createManualThroughput(information.getRequestUnit()); + ThroughputProperties throughputProperties = information.isAutoScale() + ? ThroughputProperties.createAutoscaledThroughput(information.getRequestUnit()) + : ThroughputProperties.createManualThroughput(information.getRequestUnit()); cosmosContainerResponseMono = cosmosAsyncDatabase.createContainerIfNotExists(cosmosContainerProperties, throughputProperties); diff --git a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplate.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplate.java index 256020e327a4..2bcd7727dd9e 100644 --- a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplate.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/ReactiveCosmosTemplate.java @@ -158,8 +158,9 @@ public Mono createContainerIfNotExists(CosmosEntityInfo cosmosContainerResponseMono = database.createContainerIfNotExists(cosmosContainerProperties); } else { - ThroughputProperties throughputProperties = - ThroughputProperties.createManualThroughput(information.getRequestUnit()); + ThroughputProperties throughputProperties = information.isAutoScale() + ? ThroughputProperties.createAutoscaledThroughput(information.getRequestUnit()) + : ThroughputProperties.createManualThroughput(information.getRequestUnit()); cosmosContainerResponseMono = database.createContainerIfNotExists(cosmosContainerProperties, throughputProperties); diff --git a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/Container.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/Container.java index 23b30ee871ef..fd1187d1dcc8 100644 --- a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/Container.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/mapping/Container.java @@ -53,4 +53,10 @@ * @return partition key path */ String partitionKeyPath() default ""; + + /** + * To enable auto scale for container RU limit + * @return default as false + */ + boolean autoScale() default Constants.DEFAULT_AUTO_SCALE; } diff --git a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/CosmosEntityInformation.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/CosmosEntityInformation.java index aa685fa173f3..947e8e36f2ac 100644 --- a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/CosmosEntityInformation.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/repository/support/CosmosEntityInformation.java @@ -65,6 +65,7 @@ public class CosmosEntityInformation extends AbstractEntityInformation domainType) { this.indexingPolicy = getIndexingPolicy(domainType); this.autoCreateContainer = getIsAutoCreateContainer(domainType); this.persitable = Persistable.class.isAssignableFrom(domainType); + this.autoScale = getIsAutoScale(domainType); } @Override @@ -257,6 +259,15 @@ public boolean isAutoCreateContainer() { return autoCreateContainer; } + /** + * Check if container should use autoscale for resource units + * + * @return boolean + */ + public boolean isAutoScale() { + return autoScale; + } + private IndexingPolicy getIndexingPolicy(Class domainType) { final IndexingPolicy policy = new IndexingPolicy(); @@ -469,5 +480,16 @@ private boolean getIsAutoCreateContainer(Class domainType) { return autoCreateContainer; } + + private boolean getIsAutoScale(Class domainType) { + final Container annotation = domainType.getAnnotation(Container.class); + + boolean autoScale = Constants.DEFAULT_AUTO_SCALE; + if (annotation != null) { + autoScale = annotation.autoScale(); + } + + return autoScale; + } } diff --git a/sdk/cosmos/azure-spring-data-cosmos/src/samples/java/com/azure/spring/data/cosmos/UserSample.java b/sdk/cosmos/azure-spring-data-cosmos/src/samples/java/com/azure/spring/data/cosmos/UserSample.java index 9cc3c17d503f..dc80a1b6c942 100644 --- a/sdk/cosmos/azure-spring-data-cosmos/src/samples/java/com/azure/spring/data/cosmos/UserSample.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/samples/java/com/azure/spring/data/cosmos/UserSample.java @@ -11,7 +11,7 @@ import com.azure.spring.data.cosmos.core.mapping.Container; import org.springframework.data.annotation.Id; -@Container(containerName = "myContainer") +@Container(containerName = "myContainer", autoScale = true, ru = "4000") public class UserSample { @Id private String emailAddress; From 248355ab0262082493625f3b1de4592988622841 Mon Sep 17 00:00:00 2001 From: angiurgiu Date: Wed, 2 Jun 2021 17:13:36 -0700 Subject: [PATCH 26/53] Adding a No Op version of the List RR with Options test, for code coverage (#22035) Co-authored-by: Andrei Giurgiu --- .../chat/ChatThreadAsyncClientTest.java | 25 +++++++++++++++++++ ...est.canListReadReceiptsWithOptions[1].json | 17 +++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canListReadReceiptsWithOptions[1].json diff --git a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java index 9db4597d9ba8..37c9f7df11ed 100644 --- a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java +++ b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java @@ -878,6 +878,31 @@ public Mono send(HttpRequest request) { assertNotNull(readReceiptList.get(0).getSender()); } + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void canListReadReceiptsWithOptions(HttpClient httpClient) { + HttpClient mockHttpClient = new NoOpHttpClient() { + @Override + public Mono send(HttpRequest request) { + return Mono.just(ChatResponseMocker.createReadReceiptsResponse(request)); + } + }; + setupUnitTest(mockHttpClient); + PagedFlux readReceipts = chatThreadClient.listReadReceipts( + new ListReadReceiptOptions().setMaxPageSize(1)); + + // // process the iterableByPage + List readReceiptList = new ArrayList(); + readReceipts.toIterable().forEach(receipt -> { + readReceiptList.add(receipt); + }); + + assertEquals(readReceiptList.size(), 2); + assertNotNull(readReceiptList.get(0).getChatMessageId()); + assertNotNull(readReceiptList.get(0).getReadOn()); + assertNotNull(readReceiptList.get(0).getSender()); + } + @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void canListReadReceiptsWithContext(HttpClient httpClient) { diff --git a/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canListReadReceiptsWithOptions[1].json b/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canListReadReceiptsWithOptions[1].json new file mode 100644 index 000000000000..8bd9ef5dcae2 --- /dev/null +++ b/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canListReadReceiptsWithOptions[1].json @@ -0,0 +1,17 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.communication.azure.com/chat/threads/19:4b72178530934b7790135dd9359205e0@thread.v2/readReceipts?maxPageSize=1&api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-chat/1.1.0-beta.1 (1.8.0_262; Windows 10; 10.0)" + }, + "Response" : { + "retry-after" : "0", + "Content-Length" : "433", + "StatusCode" : "200", + "Body" : "{\"value\":[{\"senderCommunicationIdentifier\":{\"communicationUser\":{ \"id\":\"8:acs:9b665d53-8164-4923-ad5d-5e983b07d2e7_00000005-334f-e4af-b274-5a3a0d0002f9\"} },\"chatMessageId\":\"1600201311647\",\"readOn\":\"2020-09-15T20:21:51Z\"},{\"senderCommunicationIdentifier\":{\"communicationUser\":{ \"id\":\"8:acs:9b665d53-8164-4923-ad5d-5e983b07d2e7_00000005-334f-e4af-b274-5a3a0d0002f9\"} },\"chatMessageId\":\"1600201311648\",\"readOn\":\"2020-09-15T20:21:53Z\"}]}" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file From e333943a29eb1f6f6599cec164118e5e61006927 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Wed, 2 Jun 2021 18:36:17 -0700 Subject: [PATCH 27/53] Prepare azure-sdk-bom for Release (#22001) Prepare azure-sdk-bom for Release --- eng/versioning/external_dependencies.txt | 2 +- pom.xml | 2 +- sdk/boms/azure-sdk-bom/CHANGELOG.md | 2 +- sdk/boms/azure-sdk-bom/pom.xml | 6 +++--- sdk/parents/azure-client-sdk-parent/pom.xml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index ef6c2fd70038..6645b08a9371 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -226,7 +226,7 @@ io.dropwizard.metrics:metrics-graphite;4.1.21 io.dropwizard.metrics:metrics-jvm;4.1.21 io.reactivex.rxjava2:rxjava;2.2.21 net.java.dev.jna:jna-platform;5.6.0 -net.jonathangiles.tools:dependencyChecker-maven-plugin;1.0.5 +net.jonathangiles.tools:dependencyChecker-maven-plugin;1.0.6 net.jonathangiles.tools:whitelistgenerator-maven-plugin;1.0.2 org.apache.commons:commons-collections4;4.2 org.apache.commons:commons-text;1.6 diff --git a/pom.xml b/pom.xml index d3353927eb83..61ba25acd2c5 100644 --- a/pom.xml +++ b/pom.xml @@ -472,7 +472,7 @@ - + diff --git a/sdk/boms/azure-sdk-bom/CHANGELOG.md b/sdk/boms/azure-sdk-bom/CHANGELOG.md index bf6db63cfa7c..75981f6827d8 100644 --- a/sdk/boms/azure-sdk-bom/CHANGELOG.md +++ b/sdk/boms/azure-sdk-bom/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.3-beta.1 (Unreleased) +## 1.0.3 (2021-06-02) ### Dependency Updates diff --git a/sdk/boms/azure-sdk-bom/pom.xml b/sdk/boms/azure-sdk-bom/pom.xml index 303cb040bafd..4cca7a44218a 100644 --- a/sdk/boms/azure-sdk-bom/pom.xml +++ b/sdk/boms/azure-sdk-bom/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.azure azure-sdk-bom - 1.0.3-beta.1 + 1.0.3 pom Azure Java SDK BOM (Bill of Materials) Azure Java SDK BOM (Bill of Materials) @@ -179,7 +179,7 @@ com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.7.0 + 1.7.1 @@ -385,7 +385,7 @@ net.jonathangiles.tools dependencyChecker-maven-plugin - 1.0.5 + 1.0.6 package diff --git a/sdk/parents/azure-client-sdk-parent/pom.xml b/sdk/parents/azure-client-sdk-parent/pom.xml index 71f4c2b094db..4cc99452d6f6 100644 --- a/sdk/parents/azure-client-sdk-parent/pom.xml +++ b/sdk/parents/azure-client-sdk-parent/pom.xml @@ -1073,7 +1073,7 @@ net.jonathangiles.tools dependencyChecker-maven-plugin - 1.0.5 + 1.0.6 false From 03b1a179f2a8430a5ee774bab78d0014c714e0dd Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Thu, 3 Jun 2021 09:41:15 +0800 Subject: [PATCH 28/53] mgmt core, move ArmChallengeAuthenticationPolicy from experimental (#21961) * mgmt core, move ArmChallengeAuthenticationPolicy from experimental * reuse ArmChallengeAuthenticationPolicy in azure-resourcemanager-resources --- eng/versioning/version_client.txt | 1 + sdk/core/azure-core-management/CHANGELOG.md | 1 + .../ArmChallengeAuthenticationPolicy.java | 124 ++++++++++++++++++ .../management/http/policy/package-info.java | 7 + .../http/AuthenticationChallenge.java | 44 +++++++ .../src/main/java/module-info.java | 1 + .../policy/AuthenticationChallengeTest.java | 92 +++++++++++++ .../CHANGELOG.md | 2 + .../azure-resourcemanager-resources/pom.xml | 2 +- .../policy/AuthenticationPolicy.java | 45 ++----- .../azure-resourcemanager-test/pom.xml | 2 +- .../resourcemanager/test/utils/AuthFile.java | 20 +++ .../azure-resourcemanager/CHANGELOG.md | 2 + 13 files changed, 305 insertions(+), 38 deletions(-) create mode 100644 sdk/core/azure-core-management/src/main/java/com/azure/core/management/http/policy/ArmChallengeAuthenticationPolicy.java create mode 100644 sdk/core/azure-core-management/src/main/java/com/azure/core/management/http/policy/package-info.java create mode 100644 sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/http/AuthenticationChallenge.java create mode 100644 sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/policy/AuthenticationChallengeTest.java diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 968c48175442..02927e62a7db 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -308,6 +308,7 @@ com.azure.resourcemanager:azure-resourcemanager-deviceprovisioningservices;1.0.0 # unreleased_com.azure:azure-core;1.17.0-beta.1 unreleased_com.azure:azure-core-amqp;2.1.0-beta.1 +unreleased_com.azure:azure-core-management;1.3.0-beta.1 # Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current # version and set the version to the released beta. Released beta dependencies are only valid diff --git a/sdk/core/azure-core-management/CHANGELOG.md b/sdk/core/azure-core-management/CHANGELOG.md index e82eb1258d28..39d373f04efc 100644 --- a/sdk/core/azure-core-management/CHANGELOG.md +++ b/sdk/core/azure-core-management/CHANGELOG.md @@ -2,6 +2,7 @@ ## 1.3.0-beta.1 (Unreleased) +- Added Support for Challenge Based Authentication in `ArmChallengeAuthenticationPolicy`. - Fixed bug in `ManagementErrorDeserializer`. ## 1.2.2 (2021-05-07) diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/http/policy/ArmChallengeAuthenticationPolicy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/http/policy/ArmChallengeAuthenticationPolicy.java new file mode 100644 index 000000000000..3b74abbcd487 --- /dev/null +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/http/policy/ArmChallengeAuthenticationPolicy.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.management.http.policy; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.credential.TokenRequestContext; +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.management.implementation.http.AuthenticationChallenge; +import reactor.core.publisher.Mono; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Base64; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * The pipeline policy that applies a token credential to an HTTP request + * with "Bearer" scheme in ARM challenge based authentication scenarios. + */ +public class ArmChallengeAuthenticationPolicy extends BearerTokenAuthenticationPolicy { + private static final Pattern AUTHENTICATION_CHALLENGE_PATTERN = + Pattern.compile("(\\w+) ((?:\\w+=\".*?\"(?:, )?)+)(?:, )?"); + private static final Pattern AUTHENTICATION_CHALLENGE_PARAMS_PATTERN = + Pattern.compile("(?:(\\w+)=\"([^\"\"]*)\")+"); + private static final String CLAIMS_PARAMETER = "claims"; + private static final String WWW_AUTHENTICATE = "WWW-Authenticate"; + private static final String ARM_SCOPES_KEY = "ARMScopes"; + + private final String[] scopes; + + /** + * Creates ArmChallengeAuthenticationPolicy. + * + * @param credential the token credential to authenticate the request + * @param scopes the scopes used in credential, using default scopes when empty + */ + public ArmChallengeAuthenticationPolicy(TokenCredential credential, String... scopes) { + super(credential, scopes); + this.scopes = scopes; + } + + @Override + public Mono authorizeRequest(HttpPipelineCallContext context) { + return Mono.defer(() -> { + String[] scopes = this.scopes; + scopes = getScopes(context, scopes); + if (scopes == null) { + return Mono.empty(); + } else { + context.setData(ARM_SCOPES_KEY, scopes); + return setAuthorizationHeader(context, new TokenRequestContext().addScopes(scopes)); + } + }); + } + + @Override + public Mono authorizeRequestOnChallenge(HttpPipelineCallContext context, HttpResponse response) { + return Mono.defer(() -> { + String authHeader = response.getHeaderValue(WWW_AUTHENTICATE); + if (!(response.getStatusCode() == 401 && authHeader != null)) { + return Mono.just(false); + } else { + List challenges = parseChallenges(authHeader); + for (AuthenticationChallenge authenticationChallenge : challenges) { + Map extractedChallengeParams = + parseChallengeParams(authenticationChallenge.getChallengeParameters()); + if (extractedChallengeParams.containsKey(CLAIMS_PARAMETER)) { + String claims = new String(Base64.getUrlDecoder() + .decode(extractedChallengeParams.get(CLAIMS_PARAMETER)), StandardCharsets.UTF_8); + + String[] scopes; + // We should've retrieved and configured the scopes in on Before logic, + // re-use it here as an optimization. + try { + scopes = (String[]) context.getData(ARM_SCOPES_KEY).get(); + } catch (NoSuchElementException e) { + scopes = this.scopes; + } + + // If scopes wasn't configured in On Before logic or at constructor level, + // then this method will retrieve it again. + scopes = getScopes(context, scopes); + return setAuthorizationHeader(context, new TokenRequestContext() + .addScopes(scopes).setClaims(claims)) + .flatMap(b -> Mono.just(true)); + } + } + return Mono.just(false); + } + }); + } + + protected String[] getScopes(HttpPipelineCallContext context, String[] scopes) { + return scopes; + } + + List parseChallenges(String header) { + Matcher matcher = AUTHENTICATION_CHALLENGE_PATTERN.matcher(header); + + List challenges = new ArrayList<>(); + while (matcher.find()) { + challenges.add(new AuthenticationChallenge(matcher.group(1), matcher.group(2))); + } + return challenges; + } + + Map parseChallengeParams(String challengeParams) { + Matcher matcher = AUTHENTICATION_CHALLENGE_PARAMS_PATTERN.matcher(challengeParams); + + Map challengeParameters = new HashMap<>(); + while (matcher.find()) { + challengeParameters.put(matcher.group(1), matcher.group(2)); + } + return challengeParameters; + } +} diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/http/policy/package-info.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/http/policy/package-info.java new file mode 100644 index 000000000000..629116a35264 --- /dev/null +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/http/policy/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing the implementations of HttpPipelinePolicy interface. + */ +package com.azure.core.management.http.policy; diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/http/AuthenticationChallenge.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/http/AuthenticationChallenge.java new file mode 100644 index 000000000000..692ae5e66f80 --- /dev/null +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/http/AuthenticationChallenge.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.management.implementation.http; + +import com.azure.core.annotation.Immutable; + +/** + * Represents an Authentication Challenge received in a 401 HTTP response. + */ +@Immutable +public class AuthenticationChallenge { + private final String scheme; + private final String challengeParameters; + + /** + * Constructs an instance of the {@link AuthenticationChallenge} + * @param scheme the scheme of the challenge response + * @param challengeParameters the parameters requested in the challenge. + */ + public AuthenticationChallenge(String scheme, String challengeParameters) { + this.scheme = scheme; + this.challengeParameters = challengeParameters; + } + + /** + * Get the challenge parameters. + * + * @return the challenge parameters. + */ + public String getChallengeParameters() { + return challengeParameters; + } + + /** + * Get the scheme of the challenge. + * + * @return the scheme of the challenge. + */ + public String getScheme() { + return scheme; + } +} + diff --git a/sdk/core/azure-core-management/src/main/java/module-info.java b/sdk/core/azure-core-management/src/main/java/module-info.java index 2c199cb543f2..b741d5a30401 100644 --- a/sdk/core/azure-core-management/src/main/java/module-info.java +++ b/sdk/core/azure-core-management/src/main/java/module-info.java @@ -10,6 +10,7 @@ exports com.azure.core.management.exception; exports com.azure.core.management.profile; exports com.azure.core.management.provider; + exports com.azure.core.management.http.policy; opens com.azure.core.management to com.fasterxml.jackson.databind, diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/policy/AuthenticationChallengeTest.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/policy/AuthenticationChallengeTest.java new file mode 100644 index 000000000000..1f1256edf36a --- /dev/null +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/policy/AuthenticationChallengeTest.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.management.http.policy; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.management.implementation.http.AuthenticationChallenge; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AuthenticationChallengeTest { + private static final String DUMMY_SCOPE = "DUMMY_SCOPE"; + private static final String CAE_INSUFFICIENT_CLAIMS_CHALLENGE = "Bearer realm=\"\"" + + ", authorization_uri=\"https://login.microsoftonline.com/common/oauth2/authorize\"," + + " client_id=\"00000003-0000-0000-c000-000000000000\", error=\"insufficient_claims\"," + + " claims=\"eyJhY2Nlc3NfdG9rZW4iOiB7ImZvbyI6ICJiYXIifX0=\""; + + private static final String CAE_SESSIONS_REVOKED_CLAIMS_CHALLENGE = "Bearer authorization_uri=" + + "\"https://login.windows-ppe.net/\", error=\"invalid_token\"," + + " error_description=\"User session has been revoked\"," + + " claims=\"eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTYwMzc0MjgwMCJ9fX0=\""; + + private static final String KEY_VAULT_CHALLENGE = "Bearer authorization=" + + "\"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47\"," + + " resource=\"https://vault.azure.net\""; + + private static final String ARM_CHALLENGE = "Bearer authorization_uri=" + + "\"https://login.windows.net/\", error=\"invalid_token\"," + + " error_description=\"The authentication failed because of missing 'Authorization' header.\""; + + + private static final Map EXPECTED_CAE_INSUFFICIENT_CLAIMS_CHALLENGE = new HashMap<>(); + private static final Map EXPECTED_CAE_SESSIONS_REVOKED_CLAIMS_CHALLENGE = new HashMap<>(); + private static final Map EXPECTED_KEY_VAULT_CHALLENGE = new HashMap<>(); + private static final Map EXPECTED_ARM_CHALLENGE = new HashMap<>(); + private static final Map> AUTHENTICATION_CHALLENGE_MAP = new HashMap<>(); + static { + EXPECTED_CAE_INSUFFICIENT_CLAIMS_CHALLENGE.put("realm", ""); + EXPECTED_CAE_INSUFFICIENT_CLAIMS_CHALLENGE.put("authorization_uri", + "https://login.microsoftonline.com/common/oauth2/authorize"); + EXPECTED_CAE_INSUFFICIENT_CLAIMS_CHALLENGE.put("client_id", "00000003-0000-0000-c000-000000000000"); + EXPECTED_CAE_INSUFFICIENT_CLAIMS_CHALLENGE.put("error", "insufficient_claims"); + EXPECTED_CAE_INSUFFICIENT_CLAIMS_CHALLENGE.put("claims", "eyJhY2Nlc3NfdG9rZW4iOiB7ImZvbyI6ICJiYXIifX0="); + + + EXPECTED_CAE_SESSIONS_REVOKED_CLAIMS_CHALLENGE.put("authorization_uri", "https://login.windows-ppe.net/"); + EXPECTED_CAE_SESSIONS_REVOKED_CLAIMS_CHALLENGE.put("error", "invalid_token"); + EXPECTED_CAE_SESSIONS_REVOKED_CLAIMS_CHALLENGE.put("error_description", "User session has been revoked"); + EXPECTED_CAE_SESSIONS_REVOKED_CLAIMS_CHALLENGE.put("claims", + "eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTYwMzc0MjgwMCJ9fX0="); + + EXPECTED_KEY_VAULT_CHALLENGE.put("authorization", + "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47"); + EXPECTED_KEY_VAULT_CHALLENGE.put("resource", "https://vault.azure.net"); + + EXPECTED_ARM_CHALLENGE.put("authorization_uri", "https://login.windows.net/"); + EXPECTED_ARM_CHALLENGE.put("error", "invalid_token"); + EXPECTED_ARM_CHALLENGE.put("error_description", + "The authentication failed because of missing 'Authorization' header."); + + AUTHENTICATION_CHALLENGE_MAP.put(CAE_INSUFFICIENT_CLAIMS_CHALLENGE, + EXPECTED_CAE_INSUFFICIENT_CLAIMS_CHALLENGE); + AUTHENTICATION_CHALLENGE_MAP.put(CAE_SESSIONS_REVOKED_CLAIMS_CHALLENGE, + EXPECTED_CAE_SESSIONS_REVOKED_CLAIMS_CHALLENGE); + AUTHENTICATION_CHALLENGE_MAP.put(KEY_VAULT_CHALLENGE, EXPECTED_KEY_VAULT_CHALLENGE); + AUTHENTICATION_CHALLENGE_MAP.put(ARM_CHALLENGE, EXPECTED_ARM_CHALLENGE); + } + + private final TokenCredential mockCredential = request -> null; + + @Test + public void bearerTokenAuthenticationChallengeParsingTest() { + // Create custom Headers + ArmChallengeAuthenticationPolicy armChallengeAuthenticationPolicy = + new ArmChallengeAuthenticationPolicy(mockCredential, DUMMY_SCOPE); + + for (String authChallenge : AUTHENTICATION_CHALLENGE_MAP.keySet()) { + List authenticationChallenges = armChallengeAuthenticationPolicy + .parseChallenges(authChallenge); + Assertions.assertEquals(1, authenticationChallenges.size()); + + Map parsedChallengeParams = armChallengeAuthenticationPolicy + .parseChallengeParams(authenticationChallenges.get(0).getChallengeParameters()); + + Assertions.assertEquals(AUTHENTICATION_CHALLENGE_MAP.get(authChallenge), parsedChallengeParams); + } + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/CHANGELOG.md b/sdk/resourcemanager/azure-resourcemanager-resources/CHANGELOG.md index 1e76304587b3..06376d832f06 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/CHANGELOG.md +++ b/sdk/resourcemanager/azure-resourcemanager-resources/CHANGELOG.md @@ -2,6 +2,8 @@ ## 2.6.0-beta.1 (Unreleased) +- Added Support for Challenge Based Authentication in `AuthenticationPolicy`. + ## 2.5.0 (2021-05-28) - Updated `api-version` of resources to `2021-01-01` - Updated `api-version` of subscriptions to `2021-01-01` diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/pom.xml b/sdk/resourcemanager/azure-resourcemanager-resources/pom.xml index d8b997144e30..6efc6184c55e 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-resources/pom.xml @@ -57,7 +57,7 @@ com.azure azure-core-management - 1.2.2 + 1.3.0-beta.1 org.slf4j diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/policy/AuthenticationPolicy.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/policy/AuthenticationPolicy.java index a1e3587e60e1..ae8a4c06a37c 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/policy/AuthenticationPolicy.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/policy/AuthenticationPolicy.java @@ -3,29 +3,18 @@ package com.azure.resourcemanager.resources.fluentcore.policy; -import com.azure.core.credential.AccessToken; import com.azure.core.credential.TokenCredential; -import com.azure.core.credential.TokenRequestContext; import com.azure.core.http.HttpPipelineCallContext; -import com.azure.core.http.HttpPipelineNextPolicy; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.util.CoreUtils; import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils; -import reactor.core.publisher.Mono; - -import java.util.Locale; -import java.util.Objects; /** * Rewrite the BearerTokenAuthenticationPolicy, it will use default scope when scopes parameter is empty. */ -public class AuthenticationPolicy implements HttpPipelinePolicy { - private static final String AUTHORIZATION_HEADER_KEY = "Authorization"; - private static final String AUTHORIZATION_HEADER_VALUE_FORMAT = "Bearer %s"; +public class AuthenticationPolicy extends ArmChallengeAuthenticationPolicy { - private final TokenCredential credential; - private final String[] scopes; private final AzureEnvironment environment; /** @@ -36,32 +25,16 @@ public class AuthenticationPolicy implements HttpPipelinePolicy { * @param scopes the scopes used in credential, using default scopes when empty */ public AuthenticationPolicy(TokenCredential credential, AzureEnvironment environment, String... scopes) { - Objects.requireNonNull(credential); - this.credential = credential; + super(credential, scopes); this.environment = environment; - this.scopes = scopes; } @Override - public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - if ("http".equals(context.getHttpRequest().getUrl().getProtocol().toLowerCase(Locale.ROOT))) { - return Mono.error(new RuntimeException("token credentials require a URL using the HTTPS protocol scheme")); - } - - Mono tokenResult; - if (this.scopes == null || this.scopes.length == 0) { - String defaultScope = ResourceManagerUtils.getDefaultScopeFromRequest( - context.getHttpRequest(), environment); - tokenResult = this.credential.getToken(new TokenRequestContext().addScopes(defaultScope)); - } else { - tokenResult = this.credential.getToken(new TokenRequestContext().addScopes(scopes)); + protected String[] getScopes(HttpPipelineCallContext context, String[] scopes) { + if (CoreUtils.isNullOrEmpty(scopes)) { + scopes = new String[1]; + scopes[0] = ResourceManagerUtils.getDefaultScopeFromRequest(context.getHttpRequest(), environment); } - - return tokenResult - .flatMap(accessToken -> { - context.getHttpRequest().getHeaders().set(AUTHORIZATION_HEADER_KEY, - String.format(AUTHORIZATION_HEADER_VALUE_FORMAT, accessToken.getToken())); - return next.process(); - }); + return scopes; } } diff --git a/sdk/resourcemanager/azure-resourcemanager-test/pom.xml b/sdk/resourcemanager/azure-resourcemanager-test/pom.xml index b7e04a7f0058..72ebb2e7300e 100644 --- a/sdk/resourcemanager/azure-resourcemanager-test/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-test/pom.xml @@ -62,7 +62,7 @@ com.azure azure-core-management - 1.2.2 + 1.3.0-beta.1 com.azure diff --git a/sdk/resourcemanager/azure-resourcemanager-test/src/main/java/com/azure/resourcemanager/test/utils/AuthFile.java b/sdk/resourcemanager/azure-resourcemanager-test/src/main/java/com/azure/resourcemanager/test/utils/AuthFile.java index a8bb54095de2..f4f05545cbd5 100644 --- a/sdk/resourcemanager/azure-resourcemanager-test/src/main/java/com/azure/resourcemanager/test/utils/AuthFile.java +++ b/sdk/resourcemanager/azure-resourcemanager-test/src/main/java/com/azure/resourcemanager/test/utils/AuthFile.java @@ -1,8 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + package com.azure.resourcemanager.test.utils; import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; import com.azure.core.management.AzureEnvironment; import com.azure.core.management.serializer.SerializerFactory; import com.azure.core.util.logging.ClientLogger; @@ -10,6 +17,7 @@ import com.azure.core.util.serializer.SerializerEncoding; import com.azure.identity.ClientCertificateCredentialBuilder; import com.azure.identity.ClientSecretCredentialBuilder; +import com.azure.resourcemanager.test.policy.HttpDebugLoggingPolicy; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.File; @@ -20,7 +28,9 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Properties; @@ -138,8 +148,17 @@ private static boolean isJsonBased(String content) { * @return an ApplicationTokenCredentials object from the information in this class */ private TokenCredential generateCredential() { + List policies = new ArrayList<>(); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(new RetryPolicy()); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpDebugLoggingPolicy()); + HttpPipeline pipeline = new HttpPipelineBuilder().httpClient(HttpClient.createDefault()) + .policies(policies.toArray(new HttpPipelinePolicy[0])).build(); + if (clientSecret != null) { return new ClientSecretCredentialBuilder() + .httpPipeline(pipeline) .tenantId(tenantId) .clientId(clientId) .clientSecret(clientSecret) @@ -147,6 +166,7 @@ private TokenCredential generateCredential() { .build(); } else if (clientCertificate != null) { ClientCertificateCredentialBuilder builder = new ClientCertificateCredentialBuilder() + .httpPipeline(pipeline) .tenantId(tenantId) .clientId(clientId) .authorityHost(environment.getActiveDirectoryEndpoint()); diff --git a/sdk/resourcemanager/azure-resourcemanager/CHANGELOG.md b/sdk/resourcemanager/azure-resourcemanager/CHANGELOG.md index 5fa391733514..f6bdb2f6b0a1 100644 --- a/sdk/resourcemanager/azure-resourcemanager/CHANGELOG.md +++ b/sdk/resourcemanager/azure-resourcemanager/CHANGELOG.md @@ -2,6 +2,8 @@ ## 2.6.0-beta.1 (Unreleased) +- Added Support for Challenge Based Authentication in `AuthenticationPolicy`. + ## 2.5.0 (2021-05-28) - Updated core dependency from resources From f4e8ae863da0203592ea8bea71a34c464ea63f4d Mon Sep 17 00:00:00 2001 From: Francesco Scuccimarri Date: Thu, 3 Jun 2021 19:03:48 +0200 Subject: [PATCH 29/53] Check if a queue exists but the name is used for a topic and vice versa (#19513) * add check existing queue * return an empty simple response --- .../ServiceBusAdministrationAsyncClient.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClient.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClient.java index 17d493a5f63b..39976980d265 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClient.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClient.java @@ -2229,6 +2229,12 @@ private Response deserializeQueue(Response response) { } else if (entry.getContent() == null) { logger.info("entry.getContent() is null. The entity may not exist. {}", entry); return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null); + } else if (entry.getContent().getQueueDescription() == null) { + final TopicDescriptionEntry entryTopic = deserialize(response.getValue(), TopicDescriptionEntry.class); + if (entryTopic != null && entryTopic.getContent() != null && entryTopic.getContent().getTopicDescription() != null) { + logger.warning("'{}' is not a queue, it is a topic.", entryTopic.getTitle()); + return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null); + } } final QueueProperties result = EntityHelper.toModel(entry.getContent().getQueueDescription()); @@ -2308,6 +2314,12 @@ private Response deserializeTopic(Response response) { } else if (entry.getContent() == null) { logger.warning("entry.getContent() is null. There should have been content returned. Entry: {}", entry); return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null); + } else if (entry.getContent().getTopicDescription() == null) { + final QueueDescriptionEntry entryQueue = deserialize(response.getValue(), QueueDescriptionEntry.class); + if (entryQueue != null && entryQueue.getContent() != null && entryQueue.getContent().getQueueDescription() != null) { + logger.warning("'{}' is not a topic, it is a queue.", entryQueue.getTitle()); + return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null); + } } final TopicProperties result = EntityHelper.toModel(entry.getContent().getTopicDescription()); From f55cdff393709bbe372f8dee1aa3f06a9a764bfc Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 3 Jun 2021 10:27:20 -0700 Subject: [PATCH 30/53] Make Library/Libraries Used in Bug Report More Explicit (#22047) Make Library/Libraries Used in Bug and Query Issue Templates More Explicit --- .github/ISSUE_TEMPLATE/bug_report.md | 4 ++-- .github/ISSUE_TEMPLATE/question-query-template.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 28ed816e108a..6dbb12ce3acf 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -27,8 +27,8 @@ If applicable, add screenshots to help explain your problem. **Setup (please complete the following information):** - OS: [e.g. iOS] - - IDE : [e.g. IntelliJ] - - Version of the Library used + - IDE: [e.g. IntelliJ] + - Library/Libraries: [e.g. com.azure:azure-core:1.16.0 (groupId:artifactId:version)] **Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/question-query-template.md b/.github/ISSUE_TEMPLATE/question-query-template.md index ac1478681c1e..7cd72d183918 100644 --- a/.github/ISSUE_TEMPLATE/question-query-template.md +++ b/.github/ISSUE_TEMPLATE/question-query-template.md @@ -15,8 +15,8 @@ A clear explanation of why is this not a bug or a feature request? **Setup (please complete the following information if applicable):** - OS: [e.g. iOS] - - IDE : [e.g. IntelliJ] - - Version of the Library used + - IDE: [e.g. IntelliJ] + - Library/Libraries: [e.g. com.azure:azure-core:1.16.0 (groupId:artifactId:version)] **Information Checklist** Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report From 4714eb25e822797e86d77e3b3d90cbbf1a9c45ea Mon Sep 17 00:00:00 2001 From: Naveen Singh Date: Thu, 3 Jun 2021 18:10:46 -0400 Subject: [PATCH 31/53] Updaing AAP jar version for signed jar and moving it it azure devops feed from blob storage (#22046) --- eng/versioning/external_dependencies.txt | 4 ++-- sdk/cosmos/azure-cosmos-encryption/pom.xml | 15 ++++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index 6645b08a9371..e31e72b2a46e 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -285,8 +285,8 @@ test_jar_com.microsoft.azure:azure-mgmt-resources;1.3.1-SNAPSHOT # everything under sdk\cosmos cosmos_com.fasterxml.jackson.module:jackson-module-afterburner;2.12.2 cosmos_com.google.guava:guava;25.0-jre -cosmos_com.microsoft.data.encryption:cryptography;0.2.1.jre8-preview -cosmos_com.microsoft.data.encryption:azure-key-vault-keystoreprovider;0.2.1.jre8-preview +cosmos_com.microsoft.data.encryption:cryptography;0.2.2.jre8-preview +cosmos_com.microsoft.data.encryption:azure-key-vault-keystoreprovider;0.2.2.jre8-preview cosmos_io.dropwizard.metrics:metrics-core;4.1.0 cosmos_io.dropwizard.metrics:metrics-graphite;4.1.0 cosmos_io.dropwizard.metrics:metrics-jvm;4.1.0 diff --git a/sdk/cosmos/azure-cosmos-encryption/pom.xml b/sdk/cosmos/azure-cosmos-encryption/pom.xml index a41e316aa2e2..68d7a6ef754a 100644 --- a/sdk/cosmos/azure-cosmos-encryption/pom.xml +++ b/sdk/cosmos/azure-cosmos-encryption/pom.xml @@ -32,13 +32,6 @@ Licensed under the MIT License. HEAD - - - azuresdkmaven - https://azsdkartifacts.blob.core.windows.net/maven - - - UTF-8 @@ -185,12 +178,12 @@ Licensed under the MIT License. com.microsoft.data.encryption cryptography - 0.2.1.jre8-preview + 0.2.2.jre8-preview com.microsoft.data.encryption azure-key-vault-keystoreprovider - 0.2.1.jre8-preview + 0.2.2.jre8-preview com.microsoft.data.encryption @@ -252,8 +245,8 @@ Licensed under the MIT License. com.azure:* org.bouncycastle:bcprov-jdk15on:[1.68] - com.microsoft.data.encryption:cryptography:[0.2.1.jre8-preview] - com.microsoft.data.encryption:azure-key-vault-keystoreprovider:[0.2.1.jre8-preview] + com.microsoft.data.encryption:cryptography:[0.2.2.jre8-preview] + com.microsoft.data.encryption:azure-key-vault-keystoreprovider:[0.2.2.jre8-preview] From c755bf42ea75f4e810773c5319458dae6851dc40 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 3 Jun 2021 15:51:42 -0700 Subject: [PATCH 32/53] Add the ability to check for open pull request to a different repo. (#22059) Co-authored-by: Chidozie Ononiwu --- eng/common/scripts/Delete-RemoteBranches.ps1 | 35 ++++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/eng/common/scripts/Delete-RemoteBranches.ps1 b/eng/common/scripts/Delete-RemoteBranches.ps1 index f3a0e8729893..f5ad981bd7be 100644 --- a/eng/common/scripts/Delete-RemoteBranches.ps1 +++ b/eng/common/scripts/Delete-RemoteBranches.ps1 @@ -1,7 +1,14 @@ param( + [Parameter(Mandatory = $true)] $RepoOwner, + # Use this if a pull request might have been opened from one repo against another. + # E.g Pull request opened from azure-sdk/azure-sdk prBranch --> Azure/azure-sdk baseBranch + $ForkRepoOwner, + [Parameter(Mandatory = $true)] $RepoName, + [Parameter(Mandatory = $true)] $BranchPrefix, + [Parameter(Mandatory = $true)] $AuthToken ) @@ -23,6 +30,11 @@ foreach ($branch in $branches) $head = "${RepoOwner}/${RepoName}:${branchName}" LogDebug "Operating on branch [ $branchName ]" $pullRequests = Get-GitHubPullRequests -RepoOwner $RepoOwner -RepoName $RepoName -State "all" -Head $head -AuthToken $AuthToken + + if ($ForkRepoOwner) + { + $pullRequests += Get-GitHubPullRequests -RepoOwner $ForkRepoOwner -RepoName $RepoName -State "all" -Head $head -AuthToken $AuthToken + } } catch { @@ -31,16 +43,19 @@ foreach ($branch in $branches) } $openPullRequests = $pullRequests | ? { $_.State -eq "open" } - - if ($openPullRequests.Count -eq 0) + if ($openPullRequests.Count -gt 0) { - LogDebug "Branch [ $branchName ] in repo [ $RepoName ] has no associated open Pull Request. Deleting Branch" - try{ - Remove-GitHubSourceReferences -RepoOwner $RepoOwner -RepoName $RepoName -Ref ($branch.Remove(0,5)) -AuthToken $AuthToken - } - catch { - LogError "Remove-GitHubSourceReferences failed with exception:`n$_" - exit 1 - } + LogDebug "Branch [ $branchName ] in repo [ $RepoName ] has open pull Requests. Skipping" + LogDebug $openPullRequests.url + continue + } + + LogDebug "Branch [ $branchName ] in repo [ $RepoName ] has no associated open Pull Request. Deleting Branch" + try{ + Remove-GitHubSourceReferences -RepoOwner $RepoOwner -RepoName $RepoName -Ref ($branch.Remove(0,5)) -AuthToken $AuthToken + } + catch { + LogError "Remove-GitHubSourceReferences failed with exception:`n$_" + exit 1 } } \ No newline at end of file From 338ddab7764dba03d80d35c73868c64aa0432b68 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 3 Jun 2021 16:12:22 -0700 Subject: [PATCH 33/53] Use sparse-checkout When Performing a POM Only Release (#22037) Use sparse-checkout When Performing a POM Only Release --- eng/pipelines/templates/jobs/build-validate-pom.yml | 9 +++++++++ .../stages/archetype-java-release-pom-only.yml | 13 ++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/jobs/build-validate-pom.yml b/eng/pipelines/templates/jobs/build-validate-pom.yml index e39787073992..5868c863145f 100644 --- a/eng/pipelines/templates/jobs/build-validate-pom.yml +++ b/eng/pipelines/templates/jobs/build-validate-pom.yml @@ -20,6 +20,15 @@ jobs: ArtifactName: 'packages' steps: + - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml + parameters: + Paths: + - 'sdk/${{ parameters.ServiceDirectory }}' + - '**/*.xml' + - '**/*.md' + - '!sdk/**/test-recordings' + - '!sdk/**/session-records' + - script: | echo "##vso[build.addbuildtag]Scheduled" displayName: 'Tag scheduled builds' diff --git a/eng/pipelines/templates/stages/archetype-java-release-pom-only.yml b/eng/pipelines/templates/stages/archetype-java-release-pom-only.yml index f048862cf43d..3156a111cd15 100644 --- a/eng/pipelines/templates/stages/archetype-java-release-pom-only.yml +++ b/eng/pipelines/templates/stages/archetype-java-release-pom-only.yml @@ -60,12 +60,14 @@ stages: variables: - template: ../variables/globals.yml pool: + name: Azure Pipelines vmImage: vs2017-win2016 strategy: runOnce: deploy: steps: - - checkout: self + - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml + - template: /eng/common/pipelines/templates/steps/retain-run.yml - template: /eng/common/pipelines/templates/steps/create-tags-and-git-release.yml parameters: ArtifactLocation: $(Pipeline.Workspace)/${{parameters.ArtifactName}}-signed/${{artifact.groupId}}/${{artifact.name}} @@ -86,10 +88,15 @@ stages: runOnce: deploy: steps: - - checkout: self - path: azure-sdk-for-java - checkout: azure-sdk-build-tools path: azure-sdk-build-tools + - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml + parameters: + SkipDefaultCheckout: true + Repositories: + - Name: Azure/azure-sdk-for-java + Commitish: $(Build.SourceVersion) + WorkingDirectory: $(Pipeline.Workspace)/azure-sdk-for-java - template: tools/gpg/gpg.yml@azure-sdk-build-tools - template: /eng/pipelines/templates/steps/java-publishing.yml parameters: From c7b58c14c715c318878a3224705cc16e217618ae Mon Sep 17 00:00:00 2001 From: Yijun Xie <48257664+YijunXieMS@users.noreply.github.com> Date: Thu, 3 Jun 2021 16:21:29 -0700 Subject: [PATCH 34/53] Dispose link immediately if updateDisposition timeout. (#22036) --- .../ServiceBusReceiveLinkProcessor.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessor.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessor.java index 47aa31ebcd4b..4d7f18b4902d 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessor.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessor.java @@ -5,6 +5,8 @@ import com.azure.core.amqp.AmqpEndpointState; import com.azure.core.amqp.AmqpRetryPolicy; +import com.azure.core.amqp.exception.AmqpErrorCondition; +import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.implementation.AmqpReceiveLink; import com.azure.core.util.AsyncCloseable; import com.azure.core.util.logging.ClientLogger; @@ -115,7 +117,15 @@ public Mono updateDisposition(String lockToken, DeliveryState deliveryStat "lockToken[%s]. state[%s]. Cannot update disposition with no link.", lockToken, deliveryState))); } - return link.updateDisposition(lockToken, deliveryState); + return link.updateDisposition(lockToken, deliveryState).onErrorResume(error -> { + if (error instanceof AmqpException) { + AmqpException amqpException = (AmqpException) error; + if (AmqpErrorCondition.TIMEOUT_ERROR.equals(amqpException.getErrorCondition())) { + return link.closeAsync().then(Mono.error(error)); + } + } + return Mono.error(error); + }); } /** From 80298f51af0a988d4d7d32846d8e2fb24f841c50 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 3 Jun 2021 16:21:50 -0700 Subject: [PATCH 35/53] Set azure-sdk-bom to In-Dev (#22052) Set azure-sdk-bom to In-Dev --- .github/CODEOWNERS | 2 +- sdk/boms/azure-sdk-bom/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 895d85fe3f04..bdfbe439755f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -9,7 +9,7 @@ /sdk/ @joshfree @srnagar @hemanttanwar @anuchandy @conniey @jianghaolu # BOM -# PRLabel: %Azure.Core +# PRLabel: %bom /sdk/boms/azure-sdk-bom/ @alzimmermsft @jonathangiles @srnagar @hemanttanwar @anuchandy @pallavit # PRLabel: %azure-spring /sdk/boms/azure-spring-boot-bom/ @saragluna @yiliuTo @chenrujun @backwind1233 @stliu diff --git a/sdk/boms/azure-sdk-bom/pom.xml b/sdk/boms/azure-sdk-bom/pom.xml index 4cca7a44218a..461cec9f1280 100644 --- a/sdk/boms/azure-sdk-bom/pom.xml +++ b/sdk/boms/azure-sdk-bom/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.azure azure-sdk-bom - 1.0.3 + 1.0.4-beta.1 pom Azure Java SDK BOM (Bill of Materials) Azure Java SDK BOM (Bill of Materials) From 96c1cdfbd000384a7482ffd4d51892cb7a336e43 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 3 Jun 2021 17:12:02 -0700 Subject: [PATCH 36/53] Update azure-sdk-build-tools Repository Resource Refs in Yaml files (#22062) --- eng/pipelines/partner-release.yml | 2 +- eng/pipelines/templates/stages/archetype-sdk-client.yml | 2 +- eng/pipelines/templates/stages/archetype-sdk-pom-only.yml | 2 +- eng/pipelines/templates/stages/cosmos-sdk-client.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/partner-release.yml b/eng/pipelines/partner-release.yml index c8e1a8246a1b..8399c953d9e1 100644 --- a/eng/pipelines/partner-release.yml +++ b/eng/pipelines/partner-release.yml @@ -6,7 +6,7 @@ resources: - repository: azure-sdk-build-tools type: git name: internal/azure-sdk-build-tools - ref: refs/tags/azure-sdk-build-tools_20210602.1 + ref: refs/tags/azure-sdk-build-tools_20210603.1 variables: BuildToolScripts: $(Pipeline.Workspace)/azure-sdk-build-tools/scripts diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index cb7e4dfead2f..10a8169d7f6f 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -3,7 +3,7 @@ resources: - repository: azure-sdk-build-tools type: git name: internal/azure-sdk-build-tools - ref: refs/tags/azure-sdk-build-tools_20210602.1 + ref: refs/tags/azure-sdk-build-tools_20210603.1 parameters: - name: Artifacts diff --git a/eng/pipelines/templates/stages/archetype-sdk-pom-only.yml b/eng/pipelines/templates/stages/archetype-sdk-pom-only.yml index f6d88c93dfaa..db390d3151a2 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-pom-only.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-pom-only.yml @@ -3,7 +3,7 @@ resources: - repository: azure-sdk-build-tools type: git name: internal/azure-sdk-build-tools - ref: refs/tags/azure-sdk-build-tools_20210602.1 + ref: refs/tags/azure-sdk-build-tools_20210603.1 parameters: - name: Artifacts diff --git a/eng/pipelines/templates/stages/cosmos-sdk-client.yml b/eng/pipelines/templates/stages/cosmos-sdk-client.yml index fde9fccdf19a..078f17aef53f 100644 --- a/eng/pipelines/templates/stages/cosmos-sdk-client.yml +++ b/eng/pipelines/templates/stages/cosmos-sdk-client.yml @@ -3,7 +3,7 @@ resources: - repository: azure-sdk-build-tools type: git name: internal/azure-sdk-build-tools - ref: refs/tags/azure-sdk-build-tools_20210602.1 + ref: refs/tags/azure-sdk-build-tools_20210603.1 parameters: - name: Artifacts From bfa8dc821b8cd98cb606d9c1db0f7457cb5d2b99 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Fri, 4 Jun 2021 17:49:54 +0800 Subject: [PATCH 37/53] mgmt, aks support spot vm (#22016) * support spot vm in aks * changlog * rename method --- .../CHANGELOG.md | 2 + .../KubernetesClusterAgentPoolImpl.java | 42 ++ .../models/KubernetesClusterAgentPool.java | 59 ++ .../KubernetesClustersTests.java | 59 ++ ...stersTests.canCreateClusterWithSpotVM.json | 689 ++++++++++++++++++ 5 files changed, 851 insertions(+) create mode 100644 sdk/resourcemanager/azure-resourcemanager-containerservice/src/test/resources/session-records/KubernetesClustersTests.canCreateClusterWithSpotVM.json diff --git a/sdk/resourcemanager/azure-resourcemanager-containerservice/CHANGELOG.md b/sdk/resourcemanager/azure-resourcemanager-containerservice/CHANGELOG.md index 1a51b8fd8156..a4e3277decb1 100644 --- a/sdk/resourcemanager/azure-resourcemanager-containerservice/CHANGELOG.md +++ b/sdk/resourcemanager/azure-resourcemanager-containerservice/CHANGELOG.md @@ -2,6 +2,8 @@ ## 2.6.0-beta.1 (Unreleased) +- Supported spot virtual machine for agent pool of `KubernetesCluster`. + ## 2.5.0 (2021-05-28) - Supported system-assigned managed identity and auto-scaler profile for `KubernetesCluster`. - Supported auto-scaling, availability zones, node labels and taints for agent pool of `KubernetesCluster`. diff --git a/sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/implementation/KubernetesClusterAgentPoolImpl.java b/sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/implementation/KubernetesClusterAgentPoolImpl.java index 93b72f7f94d8..17d64112be5d 100644 --- a/sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/implementation/KubernetesClusterAgentPoolImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/implementation/KubernetesClusterAgentPoolImpl.java @@ -11,6 +11,8 @@ import com.azure.resourcemanager.containerservice.models.ManagedClusterAgentPoolProfile; import com.azure.resourcemanager.containerservice.models.OSType; import com.azure.resourcemanager.containerservice.models.PowerState; +import com.azure.resourcemanager.containerservice.models.ScaleSetEvictionPolicy; +import com.azure.resourcemanager.containerservice.models.ScaleSetPriority; import com.azure.resourcemanager.resources.fluentcore.arm.ResourceUtils; import com.azure.resourcemanager.resources.fluentcore.arm.models.implementation.ChildResourceImpl; import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils; @@ -132,6 +134,21 @@ public int maximumNodeSize() { return ResourceManagerUtils.toPrimitiveInt(innerModel().maxCount()); } + @Override + public ScaleSetPriority virtualMachinePriority() { + return innerModel().scaleSetPriority(); + } + + @Override + public ScaleSetEvictionPolicy virtualMachineEvictionPolicy() { + return innerModel().scaleSetEvictionPolicy(); + } + + @Override + public Double virtualMachineMaximumPrice() { + return innerModel().spotMaxPrice().doubleValue(); + } + @Override public KubernetesClusterAgentPoolImpl withVirtualMachineSize(ContainerServiceVMSizeTypes vmSize) { this.innerModel().withVmSize(vmSize.toString()); @@ -260,4 +277,29 @@ public KubernetesClusterAgentPoolImpl withNodeTaints(List nodeTaints) { innerModel().withNodeTaints(nodeTaints); return this; } + + @Override + public KubernetesClusterAgentPoolImpl withVirtualMachinePriority(ScaleSetPriority priority) { + innerModel().withScaleSetPriority(priority); + return this; + } + + @Override + public KubernetesClusterAgentPoolImpl withSpotPriorityVirtualMachine() { + innerModel().withScaleSetPriority(ScaleSetPriority.SPOT); + return this; + } + + @Override + public KubernetesClusterAgentPoolImpl withSpotPriorityVirtualMachine(ScaleSetEvictionPolicy policy) { + innerModel().withScaleSetPriority(ScaleSetPriority.SPOT); + innerModel().withScaleSetEvictionPolicy(policy); + return this; + } + + @Override + public KubernetesClusterAgentPoolImpl withVirtualMachineMaximumPrice(Double maxPriceInUsDollars) { + innerModel().withSpotMaxPrice(maxPriceInUsDollars.floatValue()); + return this; + } } diff --git a/sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/models/KubernetesClusterAgentPool.java b/sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/models/KubernetesClusterAgentPool.java index 62c54f925d1b..b50be77df975 100644 --- a/sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/models/KubernetesClusterAgentPool.java +++ b/sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/models/KubernetesClusterAgentPool.java @@ -67,6 +67,15 @@ public interface KubernetesClusterAgentPool /** @return the maximum number of nodes for auto-scaling */ int maximumNodeSize(); + /** @return the priority of each virtual machines in the agent pool */ + ScaleSetPriority virtualMachinePriority(); + + /** @return the eviction policy of each virtual machines in the agent pool */ + ScaleSetEvictionPolicy virtualMachineEvictionPolicy(); + + /** @return the maximum price of each spot virtual machines in the agent pool, -1 means pay-as-you-go prices */ + Double virtualMachineMaximumPrice(); + // Fluent interfaces /** @@ -282,6 +291,54 @@ interface WithAgentPoolMode { WithAttach withAgentPoolMode(AgentPoolMode agentPoolMode); } + /** + * The stage of a container service agent pool definition allowing to specify the priority of the virtual + * machine. + * + * @param the stage of the container service definition to return to after attaching this definition + */ + interface WithVMPriority { + /** + * Specifies the priority of the virtual machines. + * + * @param priority the priority + * @return the next stage of the definition + */ + WithAttach withVirtualMachinePriority(ScaleSetPriority priority); + + /** + * Specify that virtual machines should be spot priority VMs. + * + * @return the next stage of the definition + */ + WithAttach withSpotPriorityVirtualMachine(); + + /** + * Specify that virtual machines should be spot priority VMs with provided eviction policy. + * + * @param policy eviction policy for the virtual machines. + * @return the next stage of the definition + */ + WithAttach withSpotPriorityVirtualMachine(ScaleSetEvictionPolicy policy); + } + + /** + * The stage of a container service agent pool definition allowing to specify the agent pool mode. + * + * @param the stage of the container service definition to return to after attaching this definition + */ + interface WithBillingProfile { + /** + * Sets the maximum price for virtual machine in agent pool. This price is in US Dollars. + * + * Default is -1 if not specified, as up to pay-as-you-go prices. + * + * @param maxPriceInUsDollars the maximum price in US Dollars + * @return the next stage of the definition + */ + WithAttach withVirtualMachineMaximumPrice(Double maxPriceInUsDollars); + } + /** * The final stage of a container service agent pool definition. At this stage, any remaining optional settings * can be specified, or the container service agent pool can be attached to the parent container service @@ -300,6 +357,8 @@ interface WithAttach WithAutoScaling, WithAvailabilityZones, WithNodeLabelsTaints, + WithVMPriority, + WithBillingProfile, Attachable.InDefinition { } } diff --git a/sdk/resourcemanager/azure-resourcemanager-containerservice/src/test/java/com/azure/resourcemanager/containerservice/KubernetesClustersTests.java b/sdk/resourcemanager/azure-resourcemanager-containerservice/src/test/java/com/azure/resourcemanager/containerservice/KubernetesClustersTests.java index 3694d3b6ac8c..009b6b31b3a1 100644 --- a/sdk/resourcemanager/azure-resourcemanager-containerservice/src/test/java/com/azure/resourcemanager/containerservice/KubernetesClustersTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-containerservice/src/test/java/com/azure/resourcemanager/containerservice/KubernetesClustersTests.java @@ -13,6 +13,8 @@ import com.azure.resourcemanager.containerservice.models.KubernetesClusterAgentPool; import com.azure.core.management.Region; import com.azure.resourcemanager.containerservice.models.ManagedClusterPropertiesAutoScalerProfile; +import com.azure.resourcemanager.containerservice.models.ScaleSetEvictionPolicy; +import com.azure.resourcemanager.containerservice.models.ScaleSetPriority; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import org.junit.jupiter.api.Assertions; @@ -240,6 +242,63 @@ public void canAutoScaleKubernetesCluster() throws Exception { Assertions.assertEquals(0, agentPoolProfile3.nodeSize()); } + @Test + public void canCreateClusterWithSpotVM() throws Exception { + String aksName = generateRandomResourceName("aks", 15); + String dnsPrefix = generateRandomResourceName("dns", 10); + String agentPoolName = generateRandomResourceName("ap0", 10); + String agentPoolName1 = generateRandomResourceName("ap1", 10); + String agentPoolName2 = generateRandomResourceName("ap2", 10); + + // create cluster + KubernetesCluster kubernetesCluster = containerServiceManager.kubernetesClusters().define(aksName) + .withRegion(Region.US_CENTRAL) + .withExistingResourceGroup(rgName) + .withDefaultVersion() + .withRootUsername("testaks") + .withSshKey(SSH_KEY) + .withSystemAssignedManagedServiceIdentity() + .defineAgentPool(agentPoolName) + .withVirtualMachineSize(ContainerServiceVMSizeTypes.STANDARD_D2_V2) + .withAgentPoolVirtualMachineCount(1) + .withAgentPoolType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withAgentPoolMode(AgentPoolMode.SYSTEM) + .attach() + // spot vm + .defineAgentPool(agentPoolName1) + .withVirtualMachineSize(ContainerServiceVMSizeTypes.STANDARD_A2_V2) + .withAgentPoolVirtualMachineCount(1) + .withSpotPriorityVirtualMachine() + .attach() + .withDnsPrefix("mp1" + dnsPrefix) + .create(); + + // print config + System.out.println(new String(kubernetesCluster.adminKubeConfigContent(), StandardCharsets.UTF_8)); + + KubernetesClusterAgentPool agentPoolProfile = kubernetesCluster.agentPools().get(agentPoolName); + Assertions.assertTrue(agentPoolProfile.virtualMachinePriority() == null || agentPoolProfile.virtualMachinePriority() == ScaleSetPriority.REGULAR); + + KubernetesClusterAgentPool agentPoolProfile1 = kubernetesCluster.agentPools().get(agentPoolName1); + Assertions.assertEquals(ScaleSetPriority.SPOT, agentPoolProfile1.virtualMachinePriority()); + Assertions.assertEquals(ScaleSetEvictionPolicy.DELETE, agentPoolProfile1.virtualMachineEvictionPolicy()); + Assertions.assertEquals(-1.0, agentPoolProfile1.virtualMachineMaximumPrice()); + + kubernetesCluster.update() + .defineAgentPool(agentPoolName2) + .withVirtualMachineSize(ContainerServiceVMSizeTypes.STANDARD_A2_V2) + .withAgentPoolVirtualMachineCount(1) + .withSpotPriorityVirtualMachine(ScaleSetEvictionPolicy.DEALLOCATE) + .withVirtualMachineMaximumPrice(100.0) + .attach() + .apply(); + + KubernetesClusterAgentPool agentPoolProfile2 = kubernetesCluster.agentPools().get(agentPoolName2); + Assertions.assertEquals(ScaleSetPriority.SPOT, agentPoolProfile2.virtualMachinePriority()); + Assertions.assertEquals(ScaleSetEvictionPolicy.DEALLOCATE, agentPoolProfile2.virtualMachineEvictionPolicy()); + Assertions.assertEquals(100.0, agentPoolProfile2.virtualMachineMaximumPrice()); + } + /** * Parse azure auth to hashmap * diff --git a/sdk/resourcemanager/azure-resourcemanager-containerservice/src/test/resources/session-records/KubernetesClustersTests.canCreateClusterWithSpotVM.json b/sdk/resourcemanager/azure-resourcemanager-containerservice/src/test/resources/session-records/KubernetesClustersTests.canCreateClusterWithSpotVM.json new file mode 100644 index 000000000000..8e5d2d11bb1f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-containerservice/src/test/resources/session-records/KubernetesClustersTests.canCreateClusterWithSpotVM.json @@ -0,0 +1,689 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/javaacsrg83451?api-version=2021-01-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "391f392e-12a3-426c-a39b-c074bba48f04", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "225", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1199", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-correlation-request-id" : "626090b6-3a63-4a9a-bd9f-a0263c5bc7c8", + "Date" : "Wed, 02 Jun 2021 09:37:43 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T093744Z:626090b6-3a63-4a9a-bd9f-a0263c5bc7c8", + "Expires" : "-1", + "x-ms-request-id" : "626090b6-3a63-4a9a-bd9f-a0263c5bc7c8", + "Body" : "{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javaacsrg83451\",\"name\":\"javaacsrg83451\",\"type\":\"Microsoft.Resources/resourceGroups\",\"location\":\"eastus\",\"properties\":{\"provisioningState\":\"Succeeded\"}}", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203?api-version=2021-03-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerservice/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "990e872a-0d4b-438b-be4d-e9dc7de7185c", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "3062", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1198", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-correlation-request-id" : "a4403772-0f09-4c61-8605-a084b1642d4e", + "Date" : "Wed, 02 Jun 2021 09:37:58 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T093759Z:a4403772-0f09-4c61-8605-a084b1642d4e", + "Expires" : "-1", + "Azure-AsyncOperation" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/6e1fbe27-e733-4288-8e88-8c2b0b211740?api-version=2017-08-31", + "x-ms-request-id" : "6e1fbe27-e733-4288-8e88-8c2b0b211740", + "Body" : "{\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203\",\n \"location\": \"centralus\",\n \"name\": \"aks69744203\",\n \"type\": \"Microsoft.ContainerService/ManagedClusters\",\n \"properties\": {\n \"provisioningState\": \"Creating\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"kubernetesVersion\": \"1.19.11\",\n \"dnsPrefix\": \"mp1dns484352\",\n \"fqdn\": \"mp1dns484352-b1634c6f.hcp.centralus.azmk8s.io\",\n \"azurePortalFQDN\": \"mp1dns484352-b1634c6f.portal.hcp.centralus.azmk8s.io\",\n \"agentPoolProfiles\": [\n {\n \"name\": \"ap0558728\",\n \"count\": 1,\n \"vmSize\": \"Standard_D2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Creating\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": \"1.19.11\",\n \"nodeLabels\": {},\n \"mode\": \"System\",\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": \"AKSUbuntu-1804containerd-2021.05.19\",\n \"enableFIPS\": false\n },\n {\n \"name\": \"ap1029813\",\n \"count\": 1,\n \"vmSize\": \"Standard_A2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Creating\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": \"1.19.11\",\n \"scaleSetPriority\": \"Spot\",\n \"scaleSetEvictionPolicy\": \"Delete\",\n \"spotMaxPrice\": -1,\n \"nodeLabels\": {\n \"kubernetes.azure.com/scalesetpriority\": \"spot\"\n },\n \"nodeTaints\": [\n \"kubernetes.azure.com/scalesetpriority=spot:NoSchedule\"\n ],\n \"mode\": \"User\",\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": \"AKSUbuntu-1804containerd-2021.05.19\",\n \"enableFIPS\": false\n }\n ],\n \"linuxProfile\": {\n \"adminUsername\": \"testaks\",\n \"ssh\": {\n \"publicKeys\": [\n {\n \"keyData\": \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCPskPuIO+GTJsXwmarQcWFo3f5Cw8yroMXGZrasTEeGc1LTuX17YagLPmSoCig/ih/vrcUTUnSSXlX9nwdnpnJtx+bCUHIkMMI7ZqiDmNk/Y46PTHHrsabtHkN9XaEwyrl8OLK8X/pBv+YRY5LAOXXva8lfu6lDXSy2c8X0p4CaQ==\"\n }\n ]\n }\n },\n \"servicePrincipalProfile\": {\n \"clientId\": \"msi\"\n },\n \"nodeResourceGroup\": \"MC_javaacsrg83451_aks69744203_centralus\",\n \"enableRBAC\": true,\n \"networkProfile\": {\n \"networkPlugin\": \"kubenet\",\n \"loadBalancerSku\": \"standard\",\n \"loadBalancerProfile\": {\n \"managedOutboundIPs\": {\n \"count\": 1\n }\n },\n \"podCidr\": \"10.244.0.0/16\",\n \"serviceCidr\": \"10.0.0.0/16\",\n \"dnsServiceIP\": \"10.0.0.10\",\n \"dockerBridgeCidr\": \"172.17.0.1/16\",\n \"outboundType\": \"loadBalancer\"\n },\n \"maxAgentPools\": 100\n },\n \"identity\": {\n \"type\": \"SystemAssigned\",\n \"principalId\": \"ff4c70c8-cae8-4f97-a7be-db9acb079303\",\n \"tenantId\": \"00000000-0000-0000-0000-000000000000\"\n },\n \"sku\": {\n \"name\": \"Basic\",\n \"tier\": \"Free\"\n }\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/6e1fbe27-e733-4288-8e88-8c2b0b211740?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "7596e606-dedd-48ea-a54d-3f029754c8c2" + }, + "Response" : { + "content-length" : "126", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11999", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "208150a7-05a5-424c-ba5b-d4a8d6b013ac", + "Date" : "Wed, 02 Jun 2021 09:38:29 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T093829Z:208150a7-05a5-424c-ba5b-d4a8d6b013ac", + "Expires" : "-1", + "x-ms-request-id" : "d9b0bad8-a165-463b-9e27-9415d7467372", + "Body" : "{\n \"name\": \"27be1f6e-33e7-8842-8e88-8c2b0b211740\",\n \"status\": \"InProgress\",\n \"startTime\": \"2021-06-02T09:37:58.0033333Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/6e1fbe27-e733-4288-8e88-8c2b0b211740?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "8c564a09-acd9-49d5-8f31-5641847ab81d" + }, + "Response" : { + "content-length" : "126", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11998", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "8fcc20a6-52eb-4750-a96c-12b3fefaae32", + "Date" : "Wed, 02 Jun 2021 09:39:00 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T093900Z:8fcc20a6-52eb-4750-a96c-12b3fefaae32", + "Expires" : "-1", + "x-ms-request-id" : "1db2605c-c36c-403f-960a-bebf3d4a93d8", + "Body" : "{\n \"name\": \"27be1f6e-33e7-8842-8e88-8c2b0b211740\",\n \"status\": \"InProgress\",\n \"startTime\": \"2021-06-02T09:37:58.0033333Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/6e1fbe27-e733-4288-8e88-8c2b0b211740?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "d24a001c-f3ab-4f44-9e4f-8164131588f6" + }, + "Response" : { + "content-length" : "126", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11997", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "937f4bb4-64e4-4127-a690-c88f9d0f13b1", + "Date" : "Wed, 02 Jun 2021 09:39:30 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T093930Z:937f4bb4-64e4-4127-a690-c88f9d0f13b1", + "Expires" : "-1", + "x-ms-request-id" : "22f114ea-bce7-4200-9fa0-1dd89631ae7e", + "Body" : "{\n \"name\": \"27be1f6e-33e7-8842-8e88-8c2b0b211740\",\n \"status\": \"InProgress\",\n \"startTime\": \"2021-06-02T09:37:58.0033333Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/6e1fbe27-e733-4288-8e88-8c2b0b211740?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "ae710e65-9e3f-4339-b978-74eb00918cb7" + }, + "Response" : { + "content-length" : "126", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11996", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "c81a916c-8021-45a1-be4e-db0d45247172", + "Date" : "Wed, 02 Jun 2021 09:40:00 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094001Z:c81a916c-8021-45a1-be4e-db0d45247172", + "Expires" : "-1", + "x-ms-request-id" : "7201a8f0-211e-46e6-9284-f60f717689f0", + "Body" : "{\n \"name\": \"27be1f6e-33e7-8842-8e88-8c2b0b211740\",\n \"status\": \"InProgress\",\n \"startTime\": \"2021-06-02T09:37:58.0033333Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/6e1fbe27-e733-4288-8e88-8c2b0b211740?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "39c78356-ce77-4ada-a36c-5c452a503e3d" + }, + "Response" : { + "content-length" : "126", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11995", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "5255fc86-b441-449c-bc04-7f6e88e77281", + "Date" : "Wed, 02 Jun 2021 09:40:30 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094031Z:5255fc86-b441-449c-bc04-7f6e88e77281", + "Expires" : "-1", + "x-ms-request-id" : "d51c5c75-5b3c-4893-9e88-ab83039754ca", + "Body" : "{\n \"name\": \"27be1f6e-33e7-8842-8e88-8c2b0b211740\",\n \"status\": \"InProgress\",\n \"startTime\": \"2021-06-02T09:37:58.0033333Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/6e1fbe27-e733-4288-8e88-8c2b0b211740?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "cf11977d-e3b0-45f7-9480-48f85a01c4e9" + }, + "Response" : { + "content-length" : "126", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11994", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "ee154e5b-0960-462d-8444-a277d6d7b40f", + "Date" : "Wed, 02 Jun 2021 09:41:00 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094101Z:ee154e5b-0960-462d-8444-a277d6d7b40f", + "Expires" : "-1", + "x-ms-request-id" : "6673cff4-4ac0-4398-a4a1-d9ab89205ae3", + "Body" : "{\n \"name\": \"27be1f6e-33e7-8842-8e88-8c2b0b211740\",\n \"status\": \"InProgress\",\n \"startTime\": \"2021-06-02T09:37:58.0033333Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/6e1fbe27-e733-4288-8e88-8c2b0b211740?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "e457f201-b0f7-44a0-91f3-32e8adb7ab48" + }, + "Response" : { + "content-length" : "170", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11993", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "6f0f0999-fbaa-422c-ba10-6866822c8bad", + "Date" : "Wed, 02 Jun 2021 09:41:32 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094132Z:6f0f0999-fbaa-422c-ba10-6866822c8bad", + "Expires" : "-1", + "x-ms-request-id" : "eb522417-05de-4932-beb9-64826992a9f2", + "Body" : "{\n \"name\": \"27be1f6e-33e7-8842-8e88-8c2b0b211740\",\n \"status\": \"Succeeded\",\n \"startTime\": \"2021-06-02T09:37:58.0033333Z\",\n \"endTime\": \"2021-06-02T09:41:06.3558424Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203?api-version=2021-03-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "e848db11-62bf-4956-b3ab-728440d38818" + }, + "Response" : { + "content-length" : "3709", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11992", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "3031507c-d656-4886-af58-745c9bcc3f46", + "Date" : "Wed, 02 Jun 2021 09:41:32 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094132Z:3031507c-d656-4886-af58-745c9bcc3f46", + "Expires" : "-1", + "x-ms-request-id" : "825f9dd4-d238-4d1d-a366-b9d67473c811", + "Body" : "{\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203\",\n \"location\": \"centralus\",\n \"name\": \"aks69744203\",\n \"type\": \"Microsoft.ContainerService/ManagedClusters\",\n \"properties\": {\n \"provisioningState\": \"Succeeded\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"kubernetesVersion\": \"1.19.11\",\n \"dnsPrefix\": \"mp1dns484352\",\n \"fqdn\": \"mp1dns484352-b1634c6f.hcp.centralus.azmk8s.io\",\n \"azurePortalFQDN\": \"mp1dns484352-b1634c6f.portal.hcp.centralus.azmk8s.io\",\n \"agentPoolProfiles\": [\n {\n \"name\": \"ap0558728\",\n \"count\": 1,\n \"vmSize\": \"Standard_D2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Succeeded\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": \"1.19.11\",\n \"nodeLabels\": {},\n \"mode\": \"System\",\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": \"AKSUbuntu-1804containerd-2021.05.19\",\n \"enableFIPS\": false\n },\n {\n \"name\": \"ap1029813\",\n \"count\": 1,\n \"vmSize\": \"Standard_A2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Succeeded\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": \"1.19.11\",\n \"scaleSetPriority\": \"Spot\",\n \"scaleSetEvictionPolicy\": \"Delete\",\n \"spotMaxPrice\": -1,\n \"nodeLabels\": {\n \"kubernetes.azure.com/scalesetpriority\": \"spot\"\n },\n \"nodeTaints\": [\n \"kubernetes.azure.com/scalesetpriority=spot:NoSchedule\"\n ],\n \"mode\": \"User\",\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": \"AKSUbuntu-1804containerd-2021.05.19\",\n \"enableFIPS\": false\n }\n ],\n \"linuxProfile\": {\n \"adminUsername\": \"testaks\",\n \"ssh\": {\n \"publicKeys\": [\n {\n \"keyData\": \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCPskPuIO+GTJsXwmarQcWFo3f5Cw8yroMXGZrasTEeGc1LTuX17YagLPmSoCig/ih/vrcUTUnSSXlX9nwdnpnJtx+bCUHIkMMI7ZqiDmNk/Y46PTHHrsabtHkN9XaEwyrl8OLK8X/pBv+YRY5LAOXXva8lfu6lDXSy2c8X0p4CaQ==\"\n }\n ]\n }\n },\n \"servicePrincipalProfile\": {\n \"clientId\": \"msi\"\n },\n \"nodeResourceGroup\": \"MC_javaacsrg83451_aks69744203_centralus\",\n \"enableRBAC\": true,\n \"networkProfile\": {\n \"networkPlugin\": \"kubenet\",\n \"loadBalancerSku\": \"Standard\",\n \"loadBalancerProfile\": {\n \"managedOutboundIPs\": {\n \"count\": 1\n },\n \"effectiveOutboundIPs\": [\n {\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MC_javaacsrg83451_aks69744203_centralus/providers/Microsoft.Network/publicIPAddresses/6cc768b0-d2bb-4339-a83e-2fe3ce6cd7be\"\n }\n ]\n },\n \"podCidr\": \"10.244.0.0/16\",\n \"serviceCidr\": \"10.0.0.0/16\",\n \"dnsServiceIP\": \"10.0.0.10\",\n \"dockerBridgeCidr\": \"172.17.0.1/16\",\n \"outboundType\": \"loadBalancer\"\n },\n \"maxAgentPools\": 100,\n \"identityProfile\": {\n \"kubeletidentity\": {\n \"resourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/MC_javaacsrg83451_aks69744203_centralus/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aks69744203-agentpool\",\n \"clientId\": \"e93303b0-8511-45e3-8bc6-de4ad6eeeee6\",\n \"objectId\": \"1fc0866f-7e64-40d8-b7ee-0c61028ee0ad\"\n }\n }\n },\n \"identity\": {\n \"type\": \"SystemAssigned\",\n \"principalId\": \"ff4c70c8-cae8-4f97-a7be-db9acb079303\",\n \"tenantId\": \"00000000-0000-0000-0000-000000000000\"\n },\n \"sku\": {\n \"name\": \"Basic\",\n \"tier\": \"Free\"\n }\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203/listClusterUserCredential?api-version=2021-03-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerservice/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "a92018e7-f29e-481f-87ff-131fd4c3ac4a", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "13032", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1199", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "707dbc3d-3ef2-4751-945a-23ba151fcf92", + "Date" : "Wed, 02 Jun 2021 09:41:33 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094133Z:707dbc3d-3ef2-4751-945a-23ba151fcf92", + "Expires" : "-1", + "x-ms-request-id" : "269b85c1-b532-40bd-beaf-b193eca54783", + "Body" : "{\n \"kubeconfigs\": [\n {\n \"name\": \"clusterUser\",\n \"value\": \"YXBpVmVyc2lvbjogdjEKY2x1c3RlcnM6Ci0gY2x1c3RlcjoKICAgIGNlcnRpZmljYXRlLWF1dGhvcml0eS1kYXRhOiBMUzB0TFMxQ1JVZEpUaUJEUlZKVVNVWkpRMEZVUlMwdExTMHRDazFKU1VVMlJFTkRRWFJEWjBGM1NVSkJaMGxSVlZNMVFXZG9VemR6Y2s5RFFVeDRjMDB6TWxsbWFrRk9RbWRyY1docmFVYzVkekJDUVZGelJrRkVRVTRLVFZGemQwTlJXVVJXVVZGRVJYZEthbGxVUVdkR2R6QjVUVlJCTWsxRVNYZFBWRWswVFZST1lVZEJPSGxOUkZWNFRVUlpkMDFxUVRWTmVtZDRUVEZ2ZHdwRVZFVk1UVUZyUjBFeFZVVkJlRTFEV1RKRmQyZG5TV2xOUVRCSFExTnhSMU5KWWpORVVVVkNRVkZWUVVFMFNVTkVkMEYzWjJkSlMwRnZTVU5CVVVSaENtUktRMVUzYTBJek1VZDRWakZSSzBSVFZXRlFOVzF3YlVaelREQjNTMlZzSzBVdlZEZHVVMUZrWms1blFXcFNabFo2U0hob2NucFdjRXBKVG1seFZGZ0tXbXhDZVZKV05GbDVVa2x6UzA1VVJYQmlTRE5oU2poc1ZHWjFaalZhUTI1MWNXb3ZlVmRIZW01TVR6TXJPRVV2UW14VFNVSmFVVFpXVG1Gd2VXRlFSQXBrVUc5RFFtRTJaVTF0T1VsbVFrczFhazAyUWt4YVVrSTFXR3hTZDI1aVRFUkthMjFuT1doaWR6RjZWMUUyVUdKVWVYSnZVVGR2VVVKdGVrcE1TWFoxQ2k5aU9UWjRlVWhDSzNwd05UZERPRVpDVG1oM1Z6Tk5PV3g1ZVdvcmNITnlhVEJZUTBseVNIZG5WVGt3WkU5dVV6VktRbVpUTW1KbFRqUk9OMUJYYWxRS01YRk5VMEZKVTBSb1VXZzNZa2hpZERCVWFVWktkakZNUTNoU1NrMTViMFJsZDJsb1MwSXlRekJ6TW1WUU0weEpTbmcxTlVSaU9FUlhTa0ZaU2twSlF3cEhja05QWW1jd2FtOXRaR3RVUkVWYVFtbzRSamwzYWsxRVRGSm1TV0prUTFSTFZFd3dkM3BOUVdST1ltVmhibEY2VUV0cVoxbFBVbVpvUzJKTE5XSnJDbXA0VlRZNE9FdFdWM053T0dsM2VFbExhRXR3UkVvMGFTOXpiazQ1YjFKU2RqaEdObHBaVEhkdlNqTmpjM05YZUROdFJVazRRVlJwYmpaUmNsazVTbGdLVEM4Mk5sRkZVa0V3VVVkTk9IaEZUMlJFUVVkaVRXcHJaRGc1ZUcxQ2VqbGhSbWxrZG5CcFVrNURTREVyVGxaM2FuY3dlVFZSZG05cGIzcE5Na2hwUmdvM0x6RjJUbUZ6VFhaYWFEZHRkMEZNWW14UWFDOXdSa05TVG14MVZuQlpRVGhzTDIxTU5rODNibFowVjAxRWVGSlpiU3Q2UkdWMWQyTnRWV1JTTW1aS0NtaFpNelZNY1haRWRrNDJiVE56ZFZOT2VVMURhRkkzTVRSSVVqVm1WamMyVjNadWIxbFZSRmN5YjFKR1NrVTRWV3hyUjJGeVlqWnFaSGw0T0RseU0zWUtjaTl3VFVaVWJuRjVhWGR6T0VRd1dEWklVell4WWt0YVpHeFpiR2N3VmpWWlUwMTRTazlwZVdGM1NVUkJVVUZDYnpCSmQxRkVRVTlDWjA1V1NGRTRRZ3BCWmpoRlFrRk5RMEZ4VVhkRWQxbEVWbEl3VkVGUlNDOUNRVlYzUVhkRlFpOTZRV1JDWjA1V1NGRTBSVVpuVVZVeWNWRTJkblJpSzBoalVTOVRVblZaQ2pSUE5GZ3lVVkZaVVhJMGQwUlJXVXBMYjFwSmFIWmpUa0ZSUlV4Q1VVRkVaMmRKUWtGTlRGTlhVRWw0UkZVNWVDdFdlV3hTZW1NdldXc3lRMjU1ZVZvS2FEZFBaalJET1M4NU1sWkVWV1p6YlRGdVp5dGFNMEp5VUdGcGN5czBSREJDTlZkUllrbG1TREJOUkZwdVVtWkRTMlkwV1VONVEyWlBWRnBQWTNaSlJncGFMMnBoVW1KNFpIb3pUMEpMYVRsSWIxbHhkekJpTVdkV0t6bHhNbEJNT1NzM2VXdHFOMDlCWlhGNVFsVk1UWEEyYW1nNFdGWktRbE5xY2pRNGJEaHVDamMzVGpSc1RETllUVlZuZWs5SVVFRnJTMnQ2YVVWeVMxbExSek54Y1daMU5HTlVkVTFsY0ZkVE5pOVFkRVZXU2t0UmFteDRjVWRHVWxablNsSlNVVVFLVkRkcFUwMU1kbTExUmtReGVuZDFXVlp4V0c5amNXZFVWVFYyTUVWdWRVTXdZbGRaYXpOSUsySjJNRGRHTm1KblowdzJWMnhIYWpGaGNtTnNkMU5hVEFvdlRHRXhXbHAwVjI5T1VuUk5Nbk5zT1U0M2JYbDZOR2xUZG1KelpHMXJZMEpIVTJnelpVdE5VMUJoY3pOMVZUZEdkV1JFVURGM1IzUkJXVWRTS3poR0NrbHBhRVZDZW01VFNsZElSblpUUTNWMVpWWm5ha3BQU1ZJelVtWlFPREZaVEV4a05XMDVOVXBOVVdac2VraE1ObkZETTJKNVpWRm5abVZyYUZnM1ZtUUtOalY1WW5vMFIybHlibUUyTmpWTU9XdFBNVVpDVURkTGJFbGpRMUpLYzFvNWEzcE9PRVJ2TTFSd1VqWlNlRkZvUlRjMFJHSlJNRTlyUldZMmRHMVBhQXBTVVc5QlRVOUhZVWRFT1hoMmVHSnNMM3BMTDBsYVpYQkZZbk5RU2pCRGVHeDRSamN4YmpKa1RqTmhlWE54V0VRd01UbEllR0pPZEVGTmNUbDNVRTFuQ21SUU5GYzNVekpoTVRBMFZGVXdXWFYzTWxCaFZFeExSR1J4TUdoa1VrRXhUSGw2S3psV1RFeEdOMHR5WTFoUVMzbFNNR3BHUkZFd2N6VkRSeXRVWVhjS2JubHVjVnBqZUVwbmRUSTVOVTVxVFZKMFltZDRNWEpSZDJOUU5FOHZVa2RRV0ZneFptWkNUVGszUVZFMVQwNDVWM1JKWjNWVWJHaGFkMkpEVTJoUFVBcFBNVk5LZFZCUUswRnRlVkJVVnpCaUNpMHRMUzB0UlU1RUlFTkZVbFJKUmtsRFFWUkZMUzB0TFMwSwogICAgc2VydmVyOiBodHRwczovL21wMWRuczQ4NDM1Mi1iMTYzNGM2Zi5oY3AuY2VudHJhbHVzLmF6bWs4cy5pbzo0NDMKICBuYW1lOiBha3M2OTc0NDIwMwpjb250ZXh0czoKLSBjb250ZXh0OgogICAgY2x1c3RlcjogYWtzNjk3NDQyMDMKICAgIHVzZXI6IGNsdXN0ZXJVc2VyX2phdmFhY3NyZzgzNDUxX2FrczY5NzQ0MjAzCiAgbmFtZTogYWtzNjk3NDQyMDMKY3VycmVudC1jb250ZXh0OiBha3M2OTc0NDIwMwpraW5kOiBDb25maWcKcHJlZmVyZW5jZXM6IHt9CnVzZXJzOgotIG5hbWU6IGNsdXN0ZXJVc2VyX2phdmFhY3NyZzgzNDUxX2FrczY5NzQ0MjAzCiAgdXNlcjoKICAgIGNsaWVudC1jZXJ0aWZpY2F0ZS1kYXRhOiBMUzB0TFMxQ1JVZEpUaUJEUlZKVVNVWkpRMEZVUlMwdExTMHRDazFKU1VaSVZFTkRRWGRYWjBGM1NVSkJaMGxSVFd4UVFtZGhVVkp0VGpsVFozaFBOV1ZtUTNZMVJFRk9RbWRyY1docmFVYzVkekJDUVZGelJrRkVRVTRLVFZGemQwTlJXVVJXVVZGRVJYZEthbGxVUVdWR2R6QjVUVlJCTWsxRVNYZFBWRWswVFZST1lVWjNNSGxOZWtFeVRVUkpkMDlVVFRSTlZFNWhUVVJCZUFwR2VrRldRbWRPVmtKQmIxUkViazQxWXpOU2JHSlVjSFJaV0U0d1dsaEtlazFTVlhkRmQxbEVWbEZSUkVWM2VIUlpXRTR3V2xoS2FtSkhiR3hpYmxGM0NtZG5TV2xOUVRCSFExTnhSMU5KWWpORVVVVkNRVkZWUVVFMFNVTkVkMEYzWjJkSlMwRnZTVU5CVVVSa0wwVkNWbXAwVUd0MGJIQXhNR2d6VWxWSmRFSUtNa2h6VlVVclRuaGhhbmh6T1ZFMU1uQmhSVWxLUTJKMGRVRTRWMDVPT0d4RFRHaFVlVzEzYm5FemVGVlJNV0ptVHpWQlprRkhTVWR3TUZsVkswcHRXUXAxYldWVGMyUjFkbWhMYjFrMVMyOXlUbTlUZVdZMlZEZ3lRazlXVUVSSVVUbG1ZVEpzYUhOamFWQTBTRFJqUW5kWGJXUTRTVlpGZDJ0SFpFeEhha2hHQ2pKSWVqVldRMGR5S3pWSmFuaDBOMU4wUVVKa0syVlpiSEJ0ZEc5U2VuUnRPVXBPVDJaWE1tNVBjak55YkdWUWNqTlJZemxXU1dGSVdYUkxSbVp6VG5JS00xZFhNV3R5YjAxdFNYUkJibVUyTUZGRlJuTlJZbEZHTHpOV1l6RjNPSEZKTldOcU5HTktURGhxVkZOb1JrMVFWaXM0UjNONFVqZ3pibkZIUm5STVFRcGtUVmxJYzNSbE0yVXhOVlUyTlROU01FNVBXak5QYWpoTVdqRlBSMnhpY2k5YWFVOXpTWFV4VVRCT1dEQmhiMkZHZVRWb1pFSkxNMGRtTUZkbWRXd3dDbXRzVFRneGRXYzFkR3B4UVd0cVNWVkxVbkUyZVVWU1VqWk1SamQxTURkT1JuWXdOMnRPZFZSQ1dDOVJjVEJCZDFCNGQwZGhWWHB3TTJSV056UkdXUzhLVGxCNWJGUm1hMDVWTjNsNGRIbE5jM0JvV1ZCek1XMVhZa0pQVFRWUGFGSTJWVUpuT0VwdGFGWnVUM0ZaZUVsU1pteGpRbXhEV21wa05GZDVOemd5WndwNWFUTjJiamh2VEV0S01qVndNV2QzWVZWRk4xSkVPVmd5VWxBeWJFTndaSFpETTFsb2R6UjVSa3R3TUROVFVHRnNiWEpsY1dkb2FGWlNRWEp1VkhrNENtMU9jM1IyZFZJd2RHaHpkRTg0VW5SUE9XVllhamR0WnpOTVJtcEVNbVZ3Ylc5NmFGRkxWM2d6WTJGMEwxQmhjRXR0UTBacmNsQkVZVkJaWlU1Q2RERUtiM1JvY0Vkc1JVNVNTVlIwY2xWR2R5czVXRmcyYkhabmRrNVNWV2haU2xsVVdUazBTbGR5TW5ocE5sSllPRWcyY1hjM2FWVjBka3hHYjA1aFRYSlNWUXBKV0ZSNGFuQmhiSEZFUjAwMVZXWnZkMGhTTnpKUlNVUkJVVUZDYnpGWmQxWkVRVTlDWjA1V1NGRTRRa0ZtT0VWQ1FVMURRbUZCZDBWM1dVUldVakJzQ2tKQmQzZERaMWxKUzNkWlFrSlJWVWhCZDBsM1JFRlpSRlpTTUZSQlVVZ3ZRa0ZKZDBGRVFXWkNaMDVXU0ZOTlJVZEVRVmRuUWxSaGNFUnhLekYyTkdRS2VFUTVTa2MxYW1jM2FHWmFRa0pvUTNacVFVNUNaMnR4YUd0cFJ6bDNNRUpCVVhOR1FVRlBRMEZuUlVGYVUyWm9jRGhOZURscFNsSnZOa1pqT1dsYWF3cDRTRFpEZHpkUU9YcFZMMmxPTmxKbk1HMUpSMDFVUmxGNkt6WTNabUUxT0d0eWJqUkJhMHhDVFhwamJteENWWFV5WkU5V015OUxTRVZ6Vms0eVJDdGlDbmw2YkhOMU5IbDFWbFUwTlZOQ1NuQXdiRlpsZG1ONk5rVjJLM2RQWkdkSFl5ODBPRmxFTkVSa2IxQmtWazl3TVZWVVdIVjJPRGw2VjI1aFppOVNjRThLU2tSWGRGWlBLelJIU1Rnd1JtSkJWMGRrWTJ4eFdEaG5iRkJNYmxNd1JGaHhTM0JPVkZkTk5WTjBkblJsTVd0dU5FMUJVSEV2VjIweFJsaGpaSGxOZUFwbGJGZE5abXRNYjFrM2FsRk5XWE5pZDBKcVJUTkRaWEpUVmtSU1NXUlhiRVpxUmxJMFEzRktNME5CU0RkNWJERktNVTFtUVZkbVVGcFVTRlpQWlZkU0NreGFjSGRXV1ZoR04zSTRTMWgxVFRWTGMyNUpSMVV5VVU1RlJITTFSbXhSVW5FNU0zRnNkVGRYWkZSRVYyVXhRbkpPU0VWUFExUlZVa292V25BeE1EVUthU3N5YjNsTlYwNUNhbHBGVUROQmNrTTRXRVExVEVGU04wTjRka3MzTTJSbFJGZGhkazVWZFVkaE5uUTNaVUZMZW5GME5scG9WM2N2VWxaUGJqQnJLd28zTkRsd09YZERRVkZyTlhCbFExTm9RV0ZTYWpGMFlqaGhUVlJTYmtWdEx6TkxZVmxSY2twT1YzcFJSVkE1Y0RScFdqVmliSGRRU2poVk5FVkJVSGxHQ2psblFVOXVlVFE1VlhBek0zaDBWRmRsVlRreWNHUnlTekE1U1V4ck1FVXdabXBDY1dscGNIZGtOM0J5SzNCd1RIaGFZM013TUUxblFUTTJORmwwVFRjS2JrRkhVRFI2TWxNdlZXaE5aVlpGVFZkWGF5OUpjMDFYYmxodE0ycEpNV1FyWmxZM2JIQnpUVzg0ZEVGbVZHOHljMVpCTW5aa1prdENZbHBSTVdoV1pncDVlamswT1ZGd1ZGWk9jMHBDUlhCQmRtOXZhMUJ1YzFkTEsyVnVXRFpETDA1YVR6WjFObk0yY0dKbVdWSk5TWFp3V1U4MVFYRllkaklyUkZWQmJXRXhDak54YjNjcmRrMHZPVEUxTW05VFRVRTVkblJwTVZVd1BRb3RMUzB0TFVWT1JDQkRSVkpVU1VaSlEwRlVSUzB0TFMwdENnPT0KICAgIGNsaWVudC1rZXktZGF0YTogTFMwdExTMUNSVWRKVGlCU1UwRWdVRkpKVmtGVVJTQkxSVmt0TFMwdExRcE5TVWxLUzNkSlFrRkJTME5CWjBWQk0yWjRRVlpaTjFRMVRGcGhaR1JKWkRCV1EweFJaR2czUmtKUWFtTlhiemhpVUZWUFpIRlhhRU5EVVcwM1ltZFFDa1pxVkdaS1VXazBWVGh3YzBvMmREaFdSVTVYTTNwMVVVaDNRbWxDY1dSSFJsQnBXbTFNY0c1cmNraGljalJUY1VkUFUzRkxlbUZGYzI0cmF5OU9aMVFLYkZSM2VEQlFXREowY0ZsaVNFbHFLMElyU0VGalJuQnVaa05HVWsxS1FtNVRlRzk0ZUdSb09DdFdVV2h4TDNWVFNUaGlaVEJ5VVVGWVptNXRTbUZhY2dwaFJXTTNXblpUVkZSdU1YUndlbkU1TmpWWWFqWTVNRWhRVmxOSGFESk1VMmhZTjBSaE9URnNkRnBMTmtSS2FVeFJTak4xZEVWQ1FtSkZSekJDWmpreENsaE9ZMUJMYVU5WVNTdElRMU12U1RBd2IxSlVSREZtZGtKeVRWVm1UalUyYUdoaVUzZElWRWRDTjB4WWRETjBaVlpQZFdRd1pFUlViV1I2Ynk5RE1tUUtWR2h3VnpZdk1sbHFja05NZEZWT1JGWTVSM0ZIYUdOMVdWaFJVM1I0YmpsR2JqZHdaRXBLVkZCT1ltOVBZbGsyWjBwSmVVWkRhMkYxYzJoRlZXVnBlQXBsTjNSUGVsSmlPVTgxUkdKcmQxWXZNRXQwUVUxRU9HTkNiV3hOTm1RelZtVXJRbGRRZWxRNGNGVXpOVVJXVHpoelltTnFURXRaVjBRM1RscHNiWGRVQ21wUFZHOVZaV3hCV1ZCRFdtOVdXbnB4YlUxVFJWZzFXRUZhVVcxWk0yVkdjM1V2VG05TmIzUTNOUzlMUTNscFpIVmhaRmxOUjJ4Q1R6QlJMMVk1YTFRS09YQlJjVmhpZDNReVNXTlBUV2hUY1dST01Hb3ljRnB4TTNGdlNWbFdWVkZMTlRBNGRrcHFZa3hpTjJ0a1RGbGlURlIyUldKVWRsaHNOQ3MxYjA1NWVBcFpkemx1Y1ZweFRUUlZRMnh6WkROSGNtWjZNbkZUY0dkb1drdDZkekpxTWtocVVXSmtZVXhaWVZKd1VrUlZVMFUzWVRGQ1kxQjJWakVyY0dJMFRIcFZDbFpKVjBOWFJUSlFaVU5XY1RseldYVnJWaTlDSzNGelR6UnNUR0o1ZUdGRVYycExNRlpEUmpBNFdUWlhjR0ZuZUdwUFZrZzJUVUl3WlRsclEwRjNSVUVLUVZGTFEwRm5SVUV3VWpSVE1WRmhjRFJ0YkU5eGJrNDBSak5yVXpGelRFTnVNVlpzUXpkRFUyNHJibmsyUWpVM2NIQnRNeXR1Vmt3NFVsWTFjVkFyWmdvNVdEbGFhRGN4Y1dORk4waG9ZVUZ6TUhGbFpuTk1hbVp6YkROSVFrUlBSalJ3UjJWaVMyaEVVRkpSWTI5dWVraFpVV2RUVDNkaGNUTkJiRXQyU210YUNrRXdVa0UwWnpkRWEwWldRVE5vWVhOTGFXMVJka2hyYzJSWWJVWnlaVmRXVW1GUVZqTktaM1pSV0dwVk4wSlZXbmt5TTJoUE1VdGtSME13VTJKd2FUQUtUa1p5UVdNMmRFbDNjV1l2WjBoQ1JtODJZaXN6U1dSb00zUlNaRGhFTUhVeFdFRldlVVYyYWpCemJEQXhNbFUwZGtkNlp6RkZNbXhIUVV0WmFra3ZaUXBxTjFSaVVHOVJOamh3TkhCVFQydEVhVmxKYlV0TlVFWkdTa0p1YkZadWMwODVRbXR0Y25GcVZVMW9kR05tZVZKbFpqWTNiRTlUTjNKYWJuVnFTRE51Q25VelVHaERTemhIZGpkSlNqRnROVVZEVWxrMWEzcG1kVlJqVkdNd2JYZ3ZORUo0ZEVaYVZHZHRUekpVVEdoSmFuQlFiSFJNVm1GVk9UaG5ZVnBJVVhZS01qZzFaekF6TVhSSGFFbFBUWGR4VTNVMlpETkZkMVExTlRaTE0wUnVlakpxYVZWQksxUXpTbU5xWkhab01teFpRMnhrUjBkd09EbG5hMWd6ZUdseFJ3cHNjek41TkRKTFZIaG1SbnAyTmtKalVrRnhWazEwY0RKRFQwZFFVRWt2ZGtkMWJEaE1aVFJUVG05MlVVRlZMMGhzVFZZeU1DOVhLMGN2TjJabGVETnNDbVJHWVZOUldscHVPVmszZW01aFowWlBOMVpxYzBOVFYyeG9PSEl4V2xGUloyUTJiek54Tm1nMVZtNTRSR2xVVUZkelZEbE9SemQwY2psclZGWnVLemdLTjNNMGEwMW9XRzVEY1hOeFZrWlpXVWhhVXpSM1VWRnFhRGhYT1ZwcVRVSklXRE5qVTBKcGFHNXVVSGhWVjFaSVlqTmtaREl3Umtsbk0xZGFSVWwwY2dwTlpsQTFXRGszZG1GNlNuVkVXbWhDWlVGelNYaFJORzFXZFdoSk0xWjZUbTh4TVdwcWVFOXVhV3gwZDB4alNGVnZNbXREWjJkRlFrRlBVbXhDTTBOUENuTjJObWsxVW1VeUt6QmFkQ3RzZWs0dlFsbGxXbXRTTDFFM1VYSlhlWFJLYTFadkwzY3ZNVU4zYlRCVE5qRXljVXhEVTBSeVN5OWlRMVl3WVhkUmNuWUtaa3N2TXpoSGIwWTJTMXBhWmpnMWRVeDRZWEpVTkM5cFNrcFNXVzFvTVVJM0t6WnpiMUJ1TUVaamVGbzNlVUU1T1V4VFVrSjVTV1ZJWkhOSmNreFNaQXBXVlU5NE5XcHFaRVF2Y1V0TGVUUTVkV3BFVVdkUGExYzRZelJqWTFGalRWWnhLMjFKZW1RMVZXbG5XbXhMWkVaMlRTOW1hM0JhVG05MmRDczJSblkyQ25nMVR6Qktlamx0UmpkMVIwTnpLekZRVG1welZqRmpjMjlLWVVSVVpqaHpOWEZOUWtoMkswVTVVVlExY0VRd1lqTldVazVWTW1neGJHcGxUWHBSV1ZjS1pFVlRUbTVPWVZWNWNHOXNNblJ4Y1hsdlRqUlVSQ3R0VFV4WlprOUVlazgxVDNneU16ZE1NRkpZVGpSR1QyVm1OMHhrYlU1MWVVVmpiV3RRVTNVcmRBb3piRzg1VWxwdlVqQm5ielExTlUxRFoyZEZRa0ZRYWxFMlFrTXpObEIwT0hSeE0ySk5UMFpZVUhKNGNFbFRUWFZ4TVhWTk4zSkZNbTF6ZWswME1URnZDbTEwZHpJNFoycElaMXBpUlVwTmVEZExhRGR3TkhCeWVURndTbVprYzJ3eFQxZEhPV2h6Vmk5RU9ITmpRM2Q2TVZGbVVXTlZPVWRaT0daVGRXNDRZa1lLVERKMlVWUkNTbGR1Y0VoVVFqZ3pWRUl4WjNkT2FrOVRlVkJXZFVSdVNuWkxWWGhsWm05VVNtOTRiMVZqTmpjME4wSnJZMkV5T1ZsNmNHUjNOMUY0UWdvNFptTTNaVUpaZWtacVRpdFFhbU5tY2pKamEyWlBlbFJJU2tGWVRWRTBVWFZpUTJJNU9VTkdPWE5xUzJ4NFJVcDRjRFZKTmpJMFIyeEZUbGhwV2pBd0NucE5iMWQ2YUU5MmJVaFhWMDR5U0RGQ0wxaFJVa2hIZUUxeU5rUkplalJEUkZGVWVtSjZTbVpNTkdWcVVuSlhTMjV5VGl0SmNGTmphMmhUU1ZsbE1YTUtlVU5hYTFabFZWWjBaWGRxWlcweGRVa3ZabU5FUmt4S1NuRkZRVGRTWkZoaWEzcDJTRWxCWVVkdFRVTm5aMFZDUVUxUFpWWktWSFphUW1ZNE5WVk5Ld3ByYkVaelpWQmtjalZtU0RjM05WQlVaazlYWjBSUFNYbHFURUpFTVZaWWFVUkRlbTRyTTJWd0wxVjZOVU55ZEVWWEszcEhjMWhxZDFSc1pGcG5VekJQQ2tOdmIxRk9aM1JXUkVSbVlWZHlZbVE1YmpadmRFeGtRMlJ2U25sclVqUkdSbGhoUm5kUE5WbHZia3hXYkUxeFFVTlJjRVpxT0dGaUsyZ3JWa00xTjBFS2JVdE1Oa2hMYm5GaVRVeExhM1E0VW5FclNHaE5iRE5pUkRWUk5rNUJaV0ptWldGcGIyeFFlWGQ0YXpSWlNrVnFlR1ZwY1dSa1NIbEtWMWswT0hwVE1Rb3JURmhCZUZKdVMwaFhaV1ZhWlVKblpFNXlNV00yVTFCcVMzTnZiSEZuTnpsTVFtbE5Wekl4Y0VGb1JXZHhRVUowY25VeFpWSlZlSFpxZGtwSWQwRmlDbE5NZUcxc0swTmhWVUZJZVRCNmRtY3hLeTlzU2xsSVVHOTJkREZvV0hZNVFrVTRNa1p3UjJONFJqaEJlVk5KYVM5MWRFWkZaVmhtWjFsaVFUTkNRblVLUjNaNGRXRk5hME5uWjBWQ1FVOUNSR1V3WmtkWVFYRkJjVU00Wm5nemFqQkxRMjExU1VJMFZEZEpUME5FV1hCU1F6QnVXWGx1TTJjd1QxQXpObXRQWWdwbWRWRnFUMjR2VERZelZXUnVaeTlJU0ZSMWJFc3JNemcyU2tZclVVVkZNbVV3WlRSeFVWVjFPR2hzVTJoM1NEazVkV1I0YkdKWFZTdFdPRlo1WkhOc0NtczFjMmRQU1VvNU1reHlWME5oVTBkbmRtTnJSVmxXTTFORFVEZGlPVWhFTlVkNVdGUnZXRUVyZUhwUVJITTJNMjV6TTBaRVVWQnNWa2hDWjJVMllWY0tkVlZaUlZoYVRsWjZZMVZNYTBWWWRFdHRkRGxYT0hWMmNUUTNVbkJhVjJacFdWbEdhRUV2Y0ZoamNFSk5Na3BwVERkU1lUZEZRbm96VEcxNGQwZEVhQW92YlhKT01FaEdUVm8zV2xveE4yTmFNMmRFTVU1bmFXNHhTa0pJTUd0Mk1tMHlTMGdyYVRKaVIyUjJlWEp5ZVVGUGRrdHBNSEJGY2xsWFQzQlFMM0JTQ21wVU1tWTFURTVLWlUxWWJ6UnVjV3B5TVhWcEswRXZNekJCVlhJMUsxcFhiMHd3UTJkblJVSkJUbnBsZVZKR04yUjZObEUyUkVsS01qZFFlazlNVG5nS2RWUnpOa1pPVkZjdk5FcENaV1JFWVVOSVIwcHVlR2x2VmtocFltaEVXSEpxUzFwcGQyUkNVemMxTkZwdmJuWnRhblZtVVVjeldtZHNOMUpFWWxoM1Z3cFJaRkZuTlhWbFUwSjJSMkpPYkRodlQzQlJTM2hhTWtScWMzSklSVzFsTlhsWU4zVlJXQzlsVVdwRWFIaFZXVU5HYW0xT1ExSjJWVlYwV0dkalFUZFBDamRVU25OMGNqUjZZMHhEYUZjNGIxbFVRalptUWxWa2EyWk5ZVGR6YTJ0QlZXY3lUWHAyYzIxV1ZTOXliMWhuVW1ScVNuTnpXVFF6ZFhacWVuQjJSR0VLUldkVlJqbHhZUzgwWWpnd1VTdEpZelJ0YUV0cWVIb3lSMkk1V1dkMlVIZDBjWEpvZGpsdWVHdExPVTVpTjFwaVZHdDZRaTlYY0VrMFFYRkxNVEpNZFFwbFFVZzVhV1ZhYWtWc01Vd3pVRnB3YmpreWVVVnNaWGxFZDFkS2NGVlFRVmwyYWtKb1drZE1kbTEwTVN0MFZVVmxWa1ZyVVhGSk9UVndWRUZLVW1jOUNpMHRMUzB0UlU1RUlGSlRRU0JRVWtsV1FWUkZJRXRGV1MwdExTMHRDZz09CiAgICB0b2tlbjogMWVmZDYyZmJkMTgzOTBmOTI3ZjAyYWU2MTQwYTIxYzVhNjkxYTIxN2RkMWU4NjY2Nzc5NGYwODgxZTI2YmIzNDAwYmY5MmFhMGJmN2E2YjNiNzliYmEwYTU3ODU4ZWU1NGZkMWViMTg5OGEwZmJjMmJiOTNhMWQzYzM0ZjNkNzYK\"\n }\n ]\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203/listClusterAdminCredential?api-version=2021-03-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerservice/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "92b1f554-5949-421b-b97f-5afea3c894cf", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "13037", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1199", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "2dfbfcc7-93b7-40d0-8943-4d15f695449b", + "Date" : "Wed, 02 Jun 2021 09:41:34 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094134Z:2dfbfcc7-93b7-40d0-8943-4d15f695449b", + "Expires" : "-1", + "x-ms-request-id" : "e25cb727-5f88-4e68-a3bb-3a4b5be5579f", + "Body" : "{\n \"kubeconfigs\": [\n {\n \"name\": \"clusterAdmin\",\n \"value\": \"YXBpVmVyc2lvbjogdjEKY2x1c3RlcnM6Ci0gY2x1c3RlcjoKICAgIGNlcnRpZmljYXRlLWF1dGhvcml0eS1kYXRhOiBMUzB0TFMxQ1JVZEpUaUJEUlZKVVNVWkpRMEZVUlMwdExTMHRDazFKU1VVMlJFTkRRWFJEWjBGM1NVSkJaMGxSVlZNMVFXZG9VemR6Y2s5RFFVeDRjMDB6TWxsbWFrRk9RbWRyY1docmFVYzVkekJDUVZGelJrRkVRVTRLVFZGemQwTlJXVVJXVVZGRVJYZEthbGxVUVdkR2R6QjVUVlJCTWsxRVNYZFBWRWswVFZST1lVZEJPSGxOUkZWNFRVUlpkMDFxUVRWTmVtZDRUVEZ2ZHdwRVZFVk1UVUZyUjBFeFZVVkJlRTFEV1RKRmQyZG5TV2xOUVRCSFExTnhSMU5KWWpORVVVVkNRVkZWUVVFMFNVTkVkMEYzWjJkSlMwRnZTVU5CVVVSaENtUktRMVUzYTBJek1VZDRWakZSSzBSVFZXRlFOVzF3YlVaelREQjNTMlZzSzBVdlZEZHVVMUZrWms1blFXcFNabFo2U0hob2NucFdjRXBKVG1seFZGZ0tXbXhDZVZKV05GbDVVa2x6UzA1VVJYQmlTRE5oU2poc1ZHWjFaalZhUTI1MWNXb3ZlVmRIZW01TVR6TXJPRVV2UW14VFNVSmFVVFpXVG1Gd2VXRlFSQXBrVUc5RFFtRTJaVTF0T1VsbVFrczFhazAyUWt4YVVrSTFXR3hTZDI1aVRFUkthMjFuT1doaWR6RjZWMUUyVUdKVWVYSnZVVGR2VVVKdGVrcE1TWFoxQ2k5aU9UWjRlVWhDSzNwd05UZERPRVpDVG1oM1Z6Tk5PV3g1ZVdvcmNITnlhVEJZUTBseVNIZG5WVGt3WkU5dVV6VktRbVpUTW1KbFRqUk9OMUJYYWxRS01YRk5VMEZKVTBSb1VXZzNZa2hpZERCVWFVWktkakZNUTNoU1NrMTViMFJsZDJsb1MwSXlRekJ6TW1WUU0weEpTbmcxTlVSaU9FUlhTa0ZaU2twSlF3cEhja05QWW1jd2FtOXRaR3RVUkVWYVFtbzRSamwzYWsxRVRGSm1TV0prUTFSTFZFd3dkM3BOUVdST1ltVmhibEY2VUV0cVoxbFBVbVpvUzJKTE5XSnJDbXA0VlRZNE9FdFdWM053T0dsM2VFbExhRXR3UkVvMGFTOXpiazQ1YjFKU2RqaEdObHBaVEhkdlNqTmpjM05YZUROdFJVazRRVlJwYmpaUmNsazVTbGdLVEM4Mk5sRkZVa0V3VVVkTk9IaEZUMlJFUVVkaVRXcHJaRGc1ZUcxQ2VqbGhSbWxrZG5CcFVrNURTREVyVGxaM2FuY3dlVFZSZG05cGIzcE5Na2hwUmdvM0x6RjJUbUZ6VFhaYWFEZHRkMEZNWW14UWFDOXdSa05TVG14MVZuQlpRVGhzTDIxTU5rODNibFowVjAxRWVGSlpiU3Q2UkdWMWQyTnRWV1JTTW1aS0NtaFpNelZNY1haRWRrNDJiVE56ZFZOT2VVMURhRkkzTVRSSVVqVm1WamMyVjNadWIxbFZSRmN5YjFKR1NrVTRWV3hyUjJGeVlqWnFaSGw0T0RseU0zWUtjaTl3VFVaVWJuRjVhWGR6T0VRd1dEWklVell4WWt0YVpHeFpiR2N3VmpWWlUwMTRTazlwZVdGM1NVUkJVVUZDYnpCSmQxRkVRVTlDWjA1V1NGRTRRZ3BCWmpoRlFrRk5RMEZ4VVhkRWQxbEVWbEl3VkVGUlNDOUNRVlYzUVhkRlFpOTZRV1JDWjA1V1NGRTBSVVpuVVZVeWNWRTJkblJpSzBoalVTOVRVblZaQ2pSUE5GZ3lVVkZaVVhJMGQwUlJXVXBMYjFwSmFIWmpUa0ZSUlV4Q1VVRkVaMmRKUWtGTlRGTlhVRWw0UkZVNWVDdFdlV3hTZW1NdldXc3lRMjU1ZVZvS2FEZFBaalJET1M4NU1sWkVWV1p6YlRGdVp5dGFNMEp5VUdGcGN5czBSREJDTlZkUllrbG1TREJOUkZwdVVtWkRTMlkwV1VONVEyWlBWRnBQWTNaSlJncGFMMnBoVW1KNFpIb3pUMEpMYVRsSWIxbHhkekJpTVdkV0t6bHhNbEJNT1NzM2VXdHFOMDlCWlhGNVFsVk1UWEEyYW1nNFdGWktRbE5xY2pRNGJEaHVDamMzVGpSc1RETllUVlZuZWs5SVVFRnJTMnQ2YVVWeVMxbExSek54Y1daMU5HTlVkVTFsY0ZkVE5pOVFkRVZXU2t0UmFteDRjVWRHVWxablNsSlNVVVFLVkRkcFUwMU1kbTExUmtReGVuZDFXVlp4V0c5amNXZFVWVFYyTUVWdWRVTXdZbGRaYXpOSUsySjJNRGRHTm1KblowdzJWMnhIYWpGaGNtTnNkMU5hVEFvdlRHRXhXbHAwVjI5T1VuUk5Nbk5zT1U0M2JYbDZOR2xUZG1KelpHMXJZMEpIVTJnelpVdE5VMUJoY3pOMVZUZEdkV1JFVURGM1IzUkJXVWRTS3poR0NrbHBhRVZDZW01VFNsZElSblpUUTNWMVpWWm5ha3BQU1ZJelVtWlFPREZaVEV4a05XMDVOVXBOVVdac2VraE1ObkZETTJKNVpWRm5abVZyYUZnM1ZtUUtOalY1WW5vMFIybHlibUUyTmpWTU9XdFBNVVpDVURkTGJFbGpRMUpLYzFvNWEzcE9PRVJ2TTFSd1VqWlNlRkZvUlRjMFJHSlJNRTlyUldZMmRHMVBhQXBTVVc5QlRVOUhZVWRFT1hoMmVHSnNMM3BMTDBsYVpYQkZZbk5RU2pCRGVHeDRSamN4YmpKa1RqTmhlWE54V0VRd01UbEllR0pPZEVGTmNUbDNVRTFuQ21SUU5GYzNVekpoTVRBMFZGVXdXWFYzTWxCaFZFeExSR1J4TUdoa1VrRXhUSGw2S3psV1RFeEdOMHR5WTFoUVMzbFNNR3BHUkZFd2N6VkRSeXRVWVhjS2JubHVjVnBqZUVwbmRUSTVOVTVxVFZKMFltZDRNWEpSZDJOUU5FOHZVa2RRV0ZneFptWkNUVGszUVZFMVQwNDVWM1JKWjNWVWJHaGFkMkpEVTJoUFVBcFBNVk5LZFZCUUswRnRlVkJVVnpCaUNpMHRMUzB0UlU1RUlFTkZVbFJKUmtsRFFWUkZMUzB0TFMwSwogICAgc2VydmVyOiBodHRwczovL21wMWRuczQ4NDM1Mi1iMTYzNGM2Zi5oY3AuY2VudHJhbHVzLmF6bWs4cy5pbzo0NDMKICBuYW1lOiBha3M2OTc0NDIwMwpjb250ZXh0czoKLSBjb250ZXh0OgogICAgY2x1c3RlcjogYWtzNjk3NDQyMDMKICAgIHVzZXI6IGNsdXN0ZXJBZG1pbl9qYXZhYWNzcmc4MzQ1MV9ha3M2OTc0NDIwMwogIG5hbWU6IGFrczY5NzQ0MjAzCmN1cnJlbnQtY29udGV4dDogYWtzNjk3NDQyMDMKa2luZDogQ29uZmlnCnByZWZlcmVuY2VzOiB7fQp1c2VyczoKLSBuYW1lOiBjbHVzdGVyQWRtaW5famF2YWFjc3JnODM0NTFfYWtzNjk3NDQyMDMKICB1c2VyOgogICAgY2xpZW50LWNlcnRpZmljYXRlLWRhdGE6IExTMHRMUzFDUlVkSlRpQkRSVkpVU1VaSlEwRlVSUzB0TFMwdENrMUpTVVpJVkVORFFYZFhaMEYzU1VKQlowbFJUV3hRUW1kaFVWSnRUamxUWjNoUE5XVm1RM1kxUkVGT1FtZHJjV2hyYVVjNWR6QkNRVkZ6UmtGRVFVNEtUVkZ6ZDBOUldVUldVVkZFUlhkS2FsbFVRV1ZHZHpCNVRWUkJNazFFU1hkUFZFazBUVlJPWVVaM01IbE5la0V5VFVSSmQwOVVUVFJOVkU1aFRVUkJlQXBHZWtGV1FtZE9Wa0pCYjFSRWJrNDFZek5TYkdKVWNIUlpXRTR3V2xoS2VrMVNWWGRGZDFsRVZsRlJSRVYzZUhSWldFNHdXbGhLYW1KSGJHeGlibEYzQ21kblNXbE5RVEJIUTFOeFIxTkpZak5FVVVWQ1FWRlZRVUUwU1VORWQwRjNaMmRKUzBGdlNVTkJVVVJrTDBWQ1ZtcDBVR3QwYkhBeE1HZ3pVbFZKZEVJS01raHpWVVVyVG5oaGFuaHpPVkUxTW5CaFJVbEtRMkowZFVFNFYwNU9PR3hEVEdoVWVXMTNibkV6ZUZWUk1XSm1UelZCWmtGSFNVZHdNRmxWSzBwdFdRcDFiV1ZUYzJSMWRtaExiMWsxUzI5eVRtOVRlV1kyVkRneVFrOVdVRVJJVVRsbVlUSnNhSE5qYVZBMFNEUmpRbmRYYldRNFNWWkZkMnRIWkV4SGFraEdDakpJZWpWV1EwZHlLelZKYW5oME4xTjBRVUprSzJWWmJIQnRkRzlTZW5SdE9VcE9UMlpYTW01UGNqTnliR1ZRY2pOUll6bFdTV0ZJV1hSTFJtWnpUbklLTTFkWE1XdHliMDF0U1hSQmJtVTJNRkZGUm5OUllsRkdMek5XWXpGM09IRkpOV05xTkdOS1REaHFWRk5vUmsxUVZpczRSM040VWpnemJuRkhSblJNUVFwa1RWbEljM1JsTTJVeE5WVTJOVE5TTUU1UFdqTlBhamhNV2pGUFIyeGljaTlhYVU5elNYVXhVVEJPV0RCaGIyRkdlVFZvWkVKTE0wZG1NRmRtZFd3d0NtdHNUVGd4ZFdjMWRHcHhRV3RxU1ZWTFVuRTJlVVZTVWpaTVJqZDFNRGRPUm5Zd04ydE9kVlJDV0M5UmNUQkJkMUI0ZDBkaFZYcHdNMlJXTnpSR1dTOEtUbEI1YkZSbWEwNVZOM2w0ZEhsTmMzQm9XVkJ6TVcxWFlrSlBUVFZQYUZJMlZVSm5PRXB0YUZadVQzRlplRWxTWm14alFteERXbXBrTkZkNU56Z3lad3A1YVROMmJqaHZURXRLTWpWd01XZDNZVlZGTjFKRU9WZ3lVbEF5YkVOd1pIWkRNMWxvZHpSNVJrdHdNRE5UVUdGc2JYSmxjV2RvYUZaU1FYSnVWSGs0Q20xT2MzUjJkVkl3ZEdoemRFODRVblJQT1dWWWFqZHRaek5NUm1wRU1tVndiVzk2YUZGTFYzZ3pZMkYwTDFCaGNFdHRRMFpyY2xCRVlWQlpaVTVDZERFS2IzUm9jRWRzUlU1U1NWUjBjbFZHZHlzNVdGZzJiSFpuZGs1U1ZXaFpTbGxVV1RrMFNsZHlNbmhwTmxKWU9FZzJjWGMzYVZWMGRreEdiMDVoVFhKU1ZRcEpXRlI0YW5CaGJIRkVSMDAxVldadmQwaFNOekpSU1VSQlVVRkNiekZaZDFaRVFVOUNaMDVXU0ZFNFFrRm1PRVZDUVUxRFFtRkJkMFYzV1VSV1VqQnNDa0pCZDNkRFoxbEpTM2RaUWtKUlZVaEJkMGwzUkVGWlJGWlNNRlJCVVVndlFrRkpkMEZFUVdaQ1owNVdTRk5OUlVkRVFWZG5RbFJoY0VSeEt6RjJOR1FLZUVRNVNrYzFhbWMzYUdaYVFrSm9RM1pxUVU1Q1oydHhhR3RwUnpsM01FSkJVWE5HUVVGUFEwRm5SVUZhVTJab2NEaE5lRGxwU2xKdk5rWmpPV2xhYXdwNFNEWkRkemRRT1hwVkwybE9ObEpuTUcxSlIwMVVSbEY2S3pZM1ptRTFPR3R5YmpSQmEweENUWHBqYm14Q1ZYVXlaRTlXTXk5TFNFVnpWazR5UkN0aUNubDZiSE4xTkhsMVZsVTBOVk5DU25Bd2JGWmxkbU42TmtWMkszZFBaR2RIWXk4ME9GbEVORVJrYjFCa1ZrOXdNVlZVV0hWMk9EbDZWMjVoWmk5U2NFOEtTa1JYZEZaUEt6UkhTVGd3Um1KQlYwZGtZMnh4V0RobmJGQk1ibE13UkZoeFMzQk9WRmROTlZOMGRuUmxNV3R1TkUxQlVIRXZWMjB4UmxoalpIbE5lQXBsYkZkTlptdE1iMWszYWxGTldYTmlkMEpxUlRORFpYSlRWa1JTU1dSWGJFWnFSbEkwUTNGS00wTkJTRGQ1YkRGS01VMW1RVmRtVUZwVVNGWlBaVmRTQ2t4YWNIZFdXVmhHTjNJNFMxaDFUVFZMYzI1SlIxVXlVVTVGUkhNMVJteFJVbkU1TTNGc2RUZFhaRlJFVjJVeFFuSk9TRVZQUTFSVlVrb3ZXbkF4TURVS2FTc3liM2xOVjA1Q2FscEZVRE5CY2tNNFdFUTFURUZTTjBONGRrczNNMlJsUkZkaGRrNVZkVWRoTm5RM1pVRkxlbkYwTmxwb1YzY3ZVbFpQYmpCckt3bzNORGx3T1hkRFFWRnJOWEJsUTFOb1FXRlNhakYwWWpoaFRWUlNia1Z0THpOTFlWbFJja3BPVjNwUlJWQTVjRFJwV2pWaWJIZFFTamhWTkVWQlVIbEdDamxuUVU5dWVUUTVWWEF6TTNoMFZGZGxWVGt5Y0dSeVN6QTVTVXhyTUVVd1ptcENjV2xwY0hka04zQnlLM0J3VEhoYVkzTXdNRTFuUVRNMk5GbDBUVGNLYmtGSFVEUjZNbE12VldoTlpWWkZUVmRYYXk5SmMwMVhibGh0TTJwSk1XUXJabFkzYkhCelRXODRkRUZtVkc4eWMxWkJNblprWmt0Q1lscFJNV2hXWmdwNWVqazBPVkZ3VkZaT2MwcENSWEJCZG05dmExQnVjMWRMSzJWdVdEWkRMMDVhVHpaMU5uTTJjR0ptV1ZKTlNYWndXVTgxUVhGWWRqSXJSRlZCYldFeENqTnhiM2NyZGswdk9URTFNbTlUVFVFNWRuUnBNVlV3UFFvdExTMHRMVVZPUkNCRFJWSlVTVVpKUTBGVVJTMHRMUzB0Q2c9PQogICAgY2xpZW50LWtleS1kYXRhOiBMUzB0TFMxQ1JVZEpUaUJTVTBFZ1VGSkpWa0ZVUlNCTFJWa3RMUzB0TFFwTlNVbEtTM2RKUWtGQlMwTkJaMFZCTTJaNFFWWlpOMVExVEZwaFpHUkpaREJXUTB4UlpHZzNSa0pRYW1OWGJ6aGlVRlZQWkhGWGFFTkRVVzAzWW1kUUNrWnFWR1pLVVdrMFZUaHdjMG8yZERoV1JVNVhNM3AxVVVoM1FtbENjV1JIUmxCcFdtMU1jRzVyY2toaWNqUlRjVWRQVTNGTGVtRkZjMjRyYXk5T1oxUUtiRlIzZURCUVdESjBjRmxpU0VscUswSXJTRUZqUm5CdVprTkdVazFLUW01VGVHOTRlR1JvT0N0V1VXaHhMM1ZUU1RoaVpUQnlVVUZZWm01dFNtRmFjZ3BoUldNM1duWlRWRlJ1TVhSd2VuRTVOalZZYWpZNU1FaFFWbE5IYURKTVUyaFlOMFJoT1RGc2RGcExOa1JLYVV4UlNqTjFkRVZDUW1KRlJ6QkNaamt4Q2xoT1kxQkxhVTlZU1N0SVExTXZTVEF3YjFKVVJERm1ka0p5VFZWbVRqVTJhR2hpVTNkSVZFZENOMHhZZEROMFpWWlBkV1F3WkVSVWJXUjZieTlETW1RS1ZHaHdWell2TWxscWNrTk1kRlZPUkZZNVIzRkhhR04xV1ZoUlUzUjRiamxHYmpkd1pFcEtWRkJPWW05UFlsazJaMHBKZVVaRGEyRjFjMmhGVldWcGVBcGxOM1JQZWxKaU9VODFSR0pyZDFZdk1FdDBRVTFFT0dOQ2JXeE5ObVF6Vm1VclFsZFFlbFE0Y0ZVek5VUldUemh6WW1OcVRFdFpWMFEzVGxwc2JYZFVDbXBQVkc5VlpXeEJXVkJEV205V1ducHhiVTFUUlZnMVdFRmFVVzFaTTJWR2MzVXZUbTlOYjNRM05TOUxRM2xwWkhWaFpGbE5SMnhDVHpCUkwxWTVhMVFLT1hCUmNWaGlkM1F5U1dOUFRXaFRjV1JPTUdveWNGcHhNM0Z2U1ZsV1ZWRkxOVEE0ZGtwcVlreGlOMnRrVEZsaVRGUjJSV0pVZGxoc05DczFiMDU1ZUFwWmR6bHVjVnB4VFRSVlEyeHpaRE5IY21aNk1uRlRjR2RvV2t0NmR6SnFNa2hxVVdKa1lVeFpZVkp3VWtSVlUwVTNZVEZDWTFCMlZqRXJjR0kwVEhwVkNsWkpWME5YUlRKUVpVTldjVGx6V1hWclZpOUNLM0Z6VHpSc1RHSjVlR0ZFVjJwTE1GWkRSakE0V1RaWGNHRm5lR3BQVmtnMlRVSXdaVGxyUTBGM1JVRUtRVkZMUTBGblJVRXdValJUTVZGaGNEUnRiRTl4Yms0MFJqTnJVekZ6VEVOdU1WWnNRemREVTI0cmJuazJRalUzY0hCdE15dHVWa3c0VWxZMWNWQXJaZ281V0RsYWFEY3hjV05GTjBob1lVRnpNSEZsWm5OTWFtWnpiRE5JUWtSUFJqUndSMlZpUzJoRVVGSlJZMjl1ZWtoWlVXZFRUM2RoY1ROQmJFdDJTbXRhQ2tFd1VrRTBaemRFYTBaV1FUTm9ZWE5MYVcxUmRraHJjMlJZYlVaeVpWZFdVbUZRVmpOS1ozWlJXR3BWTjBKVldua3lNMmhQTVV0a1IwTXdVMkp3YVRBS1RrWnlRV00yZEVsM2NXWXZaMGhDUm04Mllpc3pTV1JvTTNSU1pEaEVNSFV4V0VGV2VVVjJhakJ6YkRBeE1sVTBka2Q2WnpGRk1teEhRVXRaYWtrdlpRcHFOMVJpVUc5Uk5qaHdOSEJUVDJ0RWFWbEpiVXROVUVaR1NrSnViRlp1YzA4NVFtdHRjbkZxVlUxb2RHTm1lVkpsWmpZM2JFOVROM0phYm5WcVNETnVDblV6VUdoRFN6aEhkamRKU2pGdE5VVkRVbGsxYTNwbWRWUmpWR013Ylhndk5FSjRkRVphVkdkdFR6SlVUR2hKYW5CUWJIUk1WbUZWT1RobllWcElVWFlLTWpnMVp6QXpNWFJIYUVsUFRYZHhVM1UyWkRORmQxUTFOVFpMTTBSdWVqSnFhVlZCSzFRelNtTnFaSFpvTW14WlEyeGtSMGR3T0RsbmExZ3plR2x4Undwc2N6TjVOREpMVkhobVJucDJOa0pqVWtGeFZrMTBjREpEVDBkUVVFa3Zka2QxYkRoTVpUUlRUbTkyVVVGVkwwaHNUVll5TUM5WEswY3ZOMlpsZUROc0NtUkdZVk5SV2xwdU9WazNlbTVoWjBaUE4xWnFjME5UVjJ4b09ISXhXbEZSWjJRMmJ6TnhObWcxVm01NFJHbFVVRmR6VkRsT1J6ZDBjamxyVkZadUt6Z0tOM00wYTAxb1dHNURjWE54VmtaWldVaGFVelIzVVZGcWFEaFhPVnBxVFVKSVdETmpVMEpwYUc1dVVIaFZWMVpJWWpOa1pESXdSa2xuTTFkYVJVbDBjZ3BOWmxBMVdEazNkbUY2U25WRVdtaENaVUZ6U1hoUk5HMVdkV2hKTTFaNlRtOHhNV3BxZUU5dWFXeDBkMHhqU0ZWdk1tdERaMmRGUWtGUFVteENNME5QQ25OMk5tazFVbVV5S3pCYWRDdHNlazR2UWxsbFdtdFNMMUUzVVhKWGVYUkthMVp2TDNjdk1VTjNiVEJUTmpFeWNVeERVMFJ5U3k5aVExWXdZWGRSY25ZS1prc3ZNemhIYjBZMlMxcGFaamcxZFV4NFlYSlVOQzlwU2twU1dXMW9NVUkzS3paemIxQnVNRVpqZUZvM2VVRTVPVXhUVWtKNVNXVklaSE5KY2t4U1pBcFdWVTk0TldwcVpFUXZjVXRMZVRRNWRXcEVVV2RQYTFjNFl6UmpZMUZqVFZaeEsyMUplbVExVldsbldteExaRVoyVFM5bWEzQmFUbTkyZENzMlJuWTJDbmcxVHpCS2VqbHRSamQxUjBOekt6RlFUbXB6VmpGamMyOUtZVVJVWmpoek5YRk5Ra2gySzBVNVVWUTFjRVF3WWpOV1VrNVZNbWd4YkdwbFRYcFJXVmNLWkVWVFRtNU9ZVlY1Y0c5c01uUnhjWGx2VGpSVVJDdHRUVXhaWms5RWVrODFUM2d5TXpkTU1GSllUalJHVDJWbU4weGtiVTUxZVVWamJXdFFVM1VyZEFvemJHODVVbHB2VWpCbmJ6UTFOVTFEWjJkRlFrRlFhbEUyUWtNek5sQjBPSFJ4TTJKTlQwWllVSEo0Y0VsVFRYVnhNWFZOTjNKRk1tMXplazAwTVRGdkNtMTBkekk0WjJwSVoxcGlSVXBOZURkTGFEZHdOSEJ5ZVRGd1NtWmtjMnd4VDFkSE9XaHpWaTlFT0hOalEzZDZNVkZtVVdOVk9VZFpPR1pUZFc0NFlrWUtUREoyVVZSQ1NsZHVjRWhVUWpnelZFSXhaM2RPYWs5VGVWQldkVVJ1U25aTFZYaGxabTlVU205NGIxVmpOamMwTjBKclkyRXlPVmw2Y0dSM04xRjRRZ280Wm1NM1pVSlpla1pxVGl0UWFtTm1jakpqYTJaUGVsUklTa0ZZVFZFMFVYVmlRMkk1T1VOR09YTnFTMng0UlVwNGNEVkpOakkwUjJ4RlRsaHBXakF3Q25wTmIxZDZhRTkyYlVoWFYwNHlTREZDTDFoUlVraEhlRTF5TmtSSmVqUkRSRkZVZW1KNlNtWk1OR1ZxVW5KWFMyNXlUaXRKY0ZOamEyaFRTVmxsTVhNS2VVTmFhMVpsVlZaMFpYZHFaVzB4ZFVrdlptTkVSa3hLU25GRlFUZFNaRmhpYTNwMlNFbEJZVWR0VFVOblowVkNRVTFQWlZaS1ZIWmFRbVk0TlZWTkt3cHJiRVp6WlZCa2NqVm1TRGMzTlZCVVprOVhaMFJQU1hscVRFSkVNVlpZYVVSRGVtNHJNMlZ3TDFWNk5VTnlkRVZYSzNwSGMxaHFkMVJzWkZwblV6QlBDa052YjFGT1ozUldSRVJtWVZkeVltUTVialp2ZEV4a1EyUnZTbmxyVWpSR1JsaGhSbmRQTlZsdmJreFdiRTF4UVVOUmNFWnFPR0ZpSzJnclZrTTFOMEVLYlV0TU5raExibkZpVFV4TGEzUTRVbkVyU0doTmJETmlSRFZSTms1QlpXSm1aV0ZwYjJ4UWVYZDRhelJaU2tWcWVHVnBjV1JrU0hsS1YxazBPSHBUTVFvclRGaEJlRkp1UzBoWFpXVmFaVUpuWkU1eU1XTTJVMUJxUzNOdmJIRm5OemxNUW1sTlZ6SXhjRUZvUldkeFFVSjBjblV4WlZKVmVIWnFka3BJZDBGaUNsTk1lRzFzSzBOaFZVRkllVEI2ZG1jeEt5OXNTbGxJVUc5MmRERm9XSFk1UWtVNE1rWndSMk40UmpoQmVWTkphUzkxZEVaRlpWaG1aMWxpUVROQ1FuVUtSM1o0ZFdGTmEwTm5aMFZDUVU5Q1JHVXdaa2RZUVhGQmNVTTRabmd6YWpCTFEyMTFTVUkwVkRkSlQwTkVXWEJTUXpCdVdYbHVNMmN3VDFBek5tdFBZZ3BtZFZGcVQyNHZURFl6VldSdVp5OUlTRlIxYkVzck16ZzJTa1lyVVVWRk1tVXdaVFJ4VVZWMU9HaHNVMmgzU0RrNWRXUjRiR0pYVlN0V09GWjVaSE5zQ21zMWMyZFBTVW81TWt4eVYwTmhVMGRuZG1OclJWbFdNMU5EVURkaU9VaEVOVWQ1V0ZSdldFRXJlSHBRUkhNMk0yNXpNMFpFVVZCc1ZraENaMlUyWVZjS2RWVlpSVmhhVGxaNlkxVk1hMFZZZEV0dGREbFhPSFYyY1RRM1VuQmFWMlpwV1ZsR2FFRXZjRmhqY0VKTk1rcHBURGRTWVRkRlFub3pURzE0ZDBkRWFBb3ZiWEpPTUVoR1RWbzNXbG94TjJOYU0yZEVNVTVuYVc0eFNrSklNR3QyTW0weVMwZ3JhVEppUjJSMmVYSnllVUZQZGt0cE1IQkZjbGxYVDNCUUwzQlNDbXBVTW1ZMVRFNUtaVTFZYnpSdWNXcHlNWFZwSzBFdk16QkJWWEkxSzFwWGIwd3dRMmRuUlVKQlRucGxlVkpHTjJSNk5sRTJSRWxLTWpkUWVrOU1UbmdLZFZSek5rWk9WRmN2TkVwQ1pXUkVZVU5JUjBwdWVHbHZWa2hwWW1oRVdISnFTMXBwZDJSQ1V6YzFORnB2Ym5adGFuVm1VVWN6V21kc04xSkVZbGgzVndwUlpGRm5OWFZsVTBKMlIySk9iRGh2VDNCUlMzaGFNa1JxYzNKSVJXMWxOWGxZTjNWUldDOWxVV3BFYUhoVldVTkdhbTFPUTFKMlZWVjBXR2RqUVRkUENqZFVTbk4wY2pSNlkweERhRmM0YjFsVVFqWm1RbFZrYTJaTllUZHphMnRCVldjeVRYcDJjMjFXVlM5eWIxaG5VbVJxU25OeldUUXpkWFpxZW5CMlJHRUtSV2RWUmpseFlTODBZamd3VVN0Sll6UnRhRXRxZUhveVIySTVXV2QyVUhkMGNYSm9kamx1ZUd0TE9VNWlOMXBpVkd0NlFpOVhjRWswUVhGTE1USk1kUXBsUVVnNWFXVmFha1ZzTVV3elVGcHdiamt5ZVVWc1pYbEVkMWRLY0ZWUVFWbDJha0pvV2tkTWRtMTBNU3QwVlVWbFZrVnJVWEZKT1RWd1ZFRktVbWM5Q2kwdExTMHRSVTVFSUZKVFFTQlFVa2xXUVZSRklFdEZXUzB0TFMwdENnPT0KICAgIHRva2VuOiAyMWI3NjBjNTU2NGYwODEyMDFhYWQwYWI2ZDQ0MDkwNjU0M2Y1ZjU1Mzk3NzRjNGE2NzgwZjA0MmFjYzI1ODZhOGNiMGRiNTRlMjM4MWRhYWVhNzQ4NWZkZDA4NmFiM2FkZmQ2OGU0ZWVkNjZhZjFjYTQyOTA1MzMyMGEwYzcyNAo=\"\n }\n ]\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203/agentPools/ap2978030?api-version=2021-03-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerservice/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "3186f21f-307a-44eb-9bb6-592d7992ad5a", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "1006", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1197", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-correlation-request-id" : "a940b01e-76b5-409e-bd92-b602570fcdd1", + "Date" : "Wed, 02 Jun 2021 09:41:37 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094137Z:a940b01e-76b5-409e-bd92-b602570fcdd1", + "Expires" : "-1", + "Azure-AsyncOperation" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/b11c3b26-f637-485b-8b1f-cada3db15af0?api-version=2017-08-31", + "x-ms-request-id" : "b11c3b26-f637-485b-8b1f-cada3db15af0", + "Body" : "{\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203/agentPools/ap2978030\",\n \"name\": \"ap2978030\",\n \"type\": \"Microsoft.ContainerService/managedClusters/agentPools\",\n \"properties\": {\n \"count\": 1,\n \"vmSize\": \"Standard_A2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Creating\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": \"1.19.11\",\n \"scaleSetPriority\": \"Spot\",\n \"scaleSetEvictionPolicy\": \"Deallocate\",\n \"spotMaxPrice\": 100,\n \"nodeLabels\": {\n \"kubernetes.azure.com/scalesetpriority\": \"spot\"\n },\n \"nodeTaints\": [\n \"kubernetes.azure.com/scalesetpriority=spot:NoSchedule\"\n ],\n \"mode\": \"User\",\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": \"AKSUbuntu-1804containerd-2021.05.19\",\n \"enableFIPS\": false\n }\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/b11c3b26-f637-485b-8b1f-cada3db15af0?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "1ec87d9c-6c23-4ced-b5cb-489f309886da" + }, + "Response" : { + "content-length" : "126", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11999", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "eee138fb-e73a-4fe1-957c-b370cd84b083", + "Date" : "Wed, 02 Jun 2021 09:42:07 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094207Z:eee138fb-e73a-4fe1-957c-b370cd84b083", + "Expires" : "-1", + "x-ms-request-id" : "b481c6e0-4579-42cf-852e-f82157a93c60", + "Body" : "{\n \"name\": \"263b1cb1-37f6-5b48-8b1f-cada3db15af0\",\n \"status\": \"InProgress\",\n \"startTime\": \"2021-06-02T09:41:37.1133333Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/b11c3b26-f637-485b-8b1f-cada3db15af0?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "e07670ae-da6d-4595-9baf-73230a0109b8" + }, + "Response" : { + "content-length" : "126", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11991", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "db72e92f-5d85-40bd-a4bc-5377c3aa246f", + "Date" : "Wed, 02 Jun 2021 09:42:38 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094238Z:db72e92f-5d85-40bd-a4bc-5377c3aa246f", + "Expires" : "-1", + "x-ms-request-id" : "79cb9b32-c4fa-4df0-aadb-0727b6133914", + "Body" : "{\n \"name\": \"263b1cb1-37f6-5b48-8b1f-cada3db15af0\",\n \"status\": \"InProgress\",\n \"startTime\": \"2021-06-02T09:41:37.1133333Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/b11c3b26-f637-485b-8b1f-cada3db15af0?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "93cf57c7-1ea9-4f33-9e71-47beacc43d21" + }, + "Response" : { + "content-length" : "126", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11998", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "3d374ac2-f1e5-487e-846f-86d188e31362", + "Date" : "Wed, 02 Jun 2021 09:43:09 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094309Z:3d374ac2-f1e5-487e-846f-86d188e31362", + "Expires" : "-1", + "x-ms-request-id" : "acc1899a-d546-4594-930d-7a941dd070da", + "Body" : "{\n \"name\": \"263b1cb1-37f6-5b48-8b1f-cada3db15af0\",\n \"status\": \"InProgress\",\n \"startTime\": \"2021-06-02T09:41:37.1133333Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/b11c3b26-f637-485b-8b1f-cada3db15af0?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "9113155c-0d80-4c81-aea8-c1844685cfb7" + }, + "Response" : { + "content-length" : "126", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11990", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "91d2bd3f-4bb5-4080-a869-b4b441cbf2f9", + "Date" : "Wed, 02 Jun 2021 09:43:40 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094340Z:91d2bd3f-4bb5-4080-a869-b4b441cbf2f9", + "Expires" : "-1", + "x-ms-request-id" : "87593ede-10a9-4e19-918d-0343b6170947", + "Body" : "{\n \"name\": \"263b1cb1-37f6-5b48-8b1f-cada3db15af0\",\n \"status\": \"InProgress\",\n \"startTime\": \"2021-06-02T09:41:37.1133333Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/b11c3b26-f637-485b-8b1f-cada3db15af0?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "7abebd39-1933-40b5-b609-178aeecd64af" + }, + "Response" : { + "content-length" : "170", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11997", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "7dc12445-8f8b-40c7-85f6-76dde00aa76a", + "Date" : "Wed, 02 Jun 2021 09:44:11 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094411Z:7dc12445-8f8b-40c7-85f6-76dde00aa76a", + "Expires" : "-1", + "x-ms-request-id" : "9694a075-5e3e-418f-9a4f-f58ffded64d4", + "Body" : "{\n \"name\": \"263b1cb1-37f6-5b48-8b1f-cada3db15af0\",\n \"status\": \"Succeeded\",\n \"startTime\": \"2021-06-02T09:41:37.1133333Z\",\n \"endTime\": \"2021-06-02T09:43:54.7837329Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203/agentPools/ap2978030?api-version=2021-03-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "66e158b7-d618-4ae2-b39d-feb50b90368f" + }, + "Response" : { + "content-length" : "1007", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11989", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "23bce110-6c0d-403a-a20d-729a8a7f7d5d", + "Date" : "Wed, 02 Jun 2021 09:44:11 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094412Z:23bce110-6c0d-403a-a20d-729a8a7f7d5d", + "Expires" : "-1", + "x-ms-request-id" : "5075ba1e-4706-47f4-bb86-e06c98a90c2d", + "Body" : "{\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203/agentPools/ap2978030\",\n \"name\": \"ap2978030\",\n \"type\": \"Microsoft.ContainerService/managedClusters/agentPools\",\n \"properties\": {\n \"count\": 1,\n \"vmSize\": \"Standard_A2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Succeeded\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": \"1.19.11\",\n \"scaleSetPriority\": \"Spot\",\n \"scaleSetEvictionPolicy\": \"Deallocate\",\n \"spotMaxPrice\": 100,\n \"nodeLabels\": {\n \"kubernetes.azure.com/scalesetpriority\": \"spot\"\n },\n \"nodeTaints\": [\n \"kubernetes.azure.com/scalesetpriority=spot:NoSchedule\"\n ],\n \"mode\": \"User\",\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": \"AKSUbuntu-1804containerd-2021.05.19\",\n \"enableFIPS\": false\n }\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203?api-version=2021-03-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerservice/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "44feab6e-f3c6-42b7-b881-b26de5166e88", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "4508", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1199", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "e25f36b7-0207-4873-912d-b9e0d9acf22a", + "Date" : "Wed, 02 Jun 2021 09:44:19 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094420Z:e25f36b7-0207-4873-912d-b9e0d9acf22a", + "Expires" : "-1", + "Azure-AsyncOperation" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/59b82f87-811b-4c55-b4d1-d20e72b2df13?api-version=2017-08-31", + "x-ms-request-id" : "59b82f87-811b-4c55-b4d1-d20e72b2df13", + "Body" : "{\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203\",\n \"location\": \"centralus\",\n \"name\": \"aks69744203\",\n \"type\": \"Microsoft.ContainerService/ManagedClusters\",\n \"properties\": {\n \"provisioningState\": \"Updating\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"kubernetesVersion\": \"1.19.11\",\n \"dnsPrefix\": \"mp1dns484352\",\n \"fqdn\": \"mp1dns484352-b1634c6f.hcp.centralus.azmk8s.io\",\n \"azurePortalFQDN\": \"mp1dns484352-b1634c6f.portal.hcp.centralus.azmk8s.io\",\n \"agentPoolProfiles\": [\n {\n \"name\": \"ap0558728\",\n \"count\": 1,\n \"vmSize\": \"Standard_D2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Updating\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": \"1.19.11\",\n \"nodeLabels\": {},\n \"mode\": \"System\",\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": \"AKSUbuntu-1804containerd-2021.05.19\",\n \"enableFIPS\": false\n },\n {\n \"name\": \"ap1029813\",\n \"count\": 1,\n \"vmSize\": \"Standard_A2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Updating\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": \"1.19.11\",\n \"scaleSetPriority\": \"Spot\",\n \"scaleSetEvictionPolicy\": \"Delete\",\n \"spotMaxPrice\": -1,\n \"nodeLabels\": {\n \"kubernetes.azure.com/scalesetpriority\": \"spot\"\n },\n \"nodeTaints\": [\n \"kubernetes.azure.com/scalesetpriority=spot:NoSchedule\"\n ],\n \"mode\": \"User\",\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": \"AKSUbuntu-1804containerd-2021.05.19\",\n \"enableFIPS\": false\n },\n {\n \"name\": \"ap2978030\",\n \"count\": 1,\n \"vmSize\": \"Standard_A2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Updating\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": \"1.19.11\",\n \"scaleSetPriority\": \"Spot\",\n \"scaleSetEvictionPolicy\": \"Deallocate\",\n \"spotMaxPrice\": 100,\n \"nodeLabels\": {\n \"kubernetes.azure.com/scalesetpriority\": \"spot\"\n },\n \"nodeTaints\": [\n \"kubernetes.azure.com/scalesetpriority=spot:NoSchedule\"\n ],\n \"mode\": \"User\",\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": \"AKSUbuntu-1804containerd-2021.05.19\",\n \"enableFIPS\": false\n }\n ],\n \"linuxProfile\": {\n \"adminUsername\": \"testaks\",\n \"ssh\": {\n \"publicKeys\": [\n {\n \"keyData\": \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCPskPuIO+GTJsXwmarQcWFo3f5Cw8yroMXGZrasTEeGc1LTuX17YagLPmSoCig/ih/vrcUTUnSSXlX9nwdnpnJtx+bCUHIkMMI7ZqiDmNk/Y46PTHHrsabtHkN9XaEwyrl8OLK8X/pBv+YRY5LAOXXva8lfu6lDXSy2c8X0p4CaQ==\"\n }\n ]\n }\n },\n \"servicePrincipalProfile\": {\n \"clientId\": \"msi\"\n },\n \"nodeResourceGroup\": \"MC_javaacsrg83451_aks69744203_centralus\",\n \"enableRBAC\": true,\n \"networkProfile\": {\n \"networkPlugin\": \"kubenet\",\n \"loadBalancerSku\": \"Standard\",\n \"loadBalancerProfile\": {\n \"managedOutboundIPs\": {\n \"count\": 1\n },\n \"effectiveOutboundIPs\": [\n {\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MC_javaacsrg83451_aks69744203_centralus/providers/Microsoft.Network/publicIPAddresses/6cc768b0-d2bb-4339-a83e-2fe3ce6cd7be\"\n }\n ]\n },\n \"podCidr\": \"10.244.0.0/16\",\n \"serviceCidr\": \"10.0.0.0/16\",\n \"dnsServiceIP\": \"10.0.0.10\",\n \"dockerBridgeCidr\": \"172.17.0.1/16\",\n \"outboundType\": \"loadBalancer\"\n },\n \"maxAgentPools\": 100,\n \"identityProfile\": {\n \"kubeletidentity\": {\n \"resourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/MC_javaacsrg83451_aks69744203_centralus/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aks69744203-agentpool\",\n \"clientId\": \"e93303b0-8511-45e3-8bc6-de4ad6eeeee6\",\n \"objectId\": \"1fc0866f-7e64-40d8-b7ee-0c61028ee0ad\"\n }\n }\n },\n \"identity\": {\n \"type\": \"SystemAssigned\",\n \"principalId\": \"ff4c70c8-cae8-4f97-a7be-db9acb079303\",\n \"tenantId\": \"00000000-0000-0000-0000-000000000000\"\n },\n \"sku\": {\n \"name\": \"Basic\",\n \"tier\": \"Free\"\n }\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/59b82f87-811b-4c55-b4d1-d20e72b2df13?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "421bca6e-0b32-43af-8cb7-07468d214c2b" + }, + "Response" : { + "content-length" : "126", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11988", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "c4b662d2-f541-4077-aa5e-5ff44da02096", + "Date" : "Wed, 02 Jun 2021 09:44:50 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094450Z:c4b662d2-f541-4077-aa5e-5ff44da02096", + "Expires" : "-1", + "x-ms-request-id" : "48435d77-c3bb-4c09-aca7-5d1f5b3df31d", + "Body" : "{\n \"name\": \"872fb859-1b81-554c-b4d1-d20e72b2df13\",\n \"status\": \"InProgress\",\n \"startTime\": \"2021-06-02T09:44:16.5666666Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/centralus/operations/59b82f87-811b-4c55-b4d1-d20e72b2df13?api-version=2017-08-31", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "2b229664-e89e-4d48-b9ba-25a3ad9e3aba" + }, + "Response" : { + "content-length" : "170", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11996", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "b869c474-81fb-4e89-8355-ca8c14ddfecc", + "Date" : "Wed, 02 Jun 2021 09:45:20 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094521Z:b869c474-81fb-4e89-8355-ca8c14ddfecc", + "Expires" : "-1", + "x-ms-request-id" : "f73fd886-4cdc-4cad-87c7-5e6cab3317ed", + "Body" : "{\n \"name\": \"872fb859-1b81-554c-b4d1-d20e72b2df13\",\n \"status\": \"Succeeded\",\n \"startTime\": \"2021-06-02T09:44:16.5666666Z\",\n \"endTime\": \"2021-06-02T09:45:17.9708505Z\"\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203?api-version=2021-03-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources.fluentcore.policy/null (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "3af040ea-bd2b-4253-a063-f3a51a79e07b" + }, + "Response" : { + "content-length" : "4512", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "x-ms-ratelimit-remaining-subscription-reads" : "11987", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "e793db32-6a9e-43ae-9d5b-318543f18366", + "Date" : "Wed, 02 Jun 2021 09:45:21 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094521Z:e793db32-6a9e-43ae-9d5b-318543f18366", + "Expires" : "-1", + "x-ms-request-id" : "a9339ed1-9cc5-46d1-b4d1-4649b7599622", + "Body" : "{\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203\",\n \"location\": \"centralus\",\n \"name\": \"aks69744203\",\n \"type\": \"Microsoft.ContainerService/ManagedClusters\",\n \"properties\": {\n \"provisioningState\": \"Succeeded\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"kubernetesVersion\": \"1.19.11\",\n \"dnsPrefix\": \"mp1dns484352\",\n \"fqdn\": \"mp1dns484352-b1634c6f.hcp.centralus.azmk8s.io\",\n \"azurePortalFQDN\": \"mp1dns484352-b1634c6f.portal.hcp.centralus.azmk8s.io\",\n \"agentPoolProfiles\": [\n {\n \"name\": \"ap0558728\",\n \"count\": 1,\n \"vmSize\": \"Standard_D2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Succeeded\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": \"1.19.11\",\n \"nodeLabels\": {},\n \"mode\": \"System\",\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": \"AKSUbuntu-1804containerd-2021.05.19\",\n \"enableFIPS\": false\n },\n {\n \"name\": \"ap1029813\",\n \"count\": 1,\n \"vmSize\": \"Standard_A2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Succeeded\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": \"1.19.11\",\n \"scaleSetPriority\": \"Spot\",\n \"scaleSetEvictionPolicy\": \"Delete\",\n \"spotMaxPrice\": -1,\n \"nodeLabels\": {\n \"kubernetes.azure.com/scalesetpriority\": \"spot\"\n },\n \"nodeTaints\": [\n \"kubernetes.azure.com/scalesetpriority=spot:NoSchedule\"\n ],\n \"mode\": \"User\",\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": \"AKSUbuntu-1804containerd-2021.05.19\",\n \"enableFIPS\": false\n },\n {\n \"name\": \"ap2978030\",\n \"count\": 1,\n \"vmSize\": \"Standard_A2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Succeeded\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": \"1.19.11\",\n \"scaleSetPriority\": \"Spot\",\n \"scaleSetEvictionPolicy\": \"Deallocate\",\n \"spotMaxPrice\": 100,\n \"nodeLabels\": {\n \"kubernetes.azure.com/scalesetpriority\": \"spot\"\n },\n \"nodeTaints\": [\n \"kubernetes.azure.com/scalesetpriority=spot:NoSchedule\"\n ],\n \"mode\": \"User\",\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": \"AKSUbuntu-1804containerd-2021.05.19\",\n \"enableFIPS\": false\n }\n ],\n \"linuxProfile\": {\n \"adminUsername\": \"testaks\",\n \"ssh\": {\n \"publicKeys\": [\n {\n \"keyData\": \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCPskPuIO+GTJsXwmarQcWFo3f5Cw8yroMXGZrasTEeGc1LTuX17YagLPmSoCig/ih/vrcUTUnSSXlX9nwdnpnJtx+bCUHIkMMI7ZqiDmNk/Y46PTHHrsabtHkN9XaEwyrl8OLK8X/pBv+YRY5LAOXXva8lfu6lDXSy2c8X0p4CaQ==\"\n }\n ]\n }\n },\n \"servicePrincipalProfile\": {\n \"clientId\": \"msi\"\n },\n \"nodeResourceGroup\": \"MC_javaacsrg83451_aks69744203_centralus\",\n \"enableRBAC\": true,\n \"networkProfile\": {\n \"networkPlugin\": \"kubenet\",\n \"loadBalancerSku\": \"Standard\",\n \"loadBalancerProfile\": {\n \"managedOutboundIPs\": {\n \"count\": 1\n },\n \"effectiveOutboundIPs\": [\n {\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MC_javaacsrg83451_aks69744203_centralus/providers/Microsoft.Network/publicIPAddresses/6cc768b0-d2bb-4339-a83e-2fe3ce6cd7be\"\n }\n ]\n },\n \"podCidr\": \"10.244.0.0/16\",\n \"serviceCidr\": \"10.0.0.0/16\",\n \"dnsServiceIP\": \"10.0.0.10\",\n \"dockerBridgeCidr\": \"172.17.0.1/16\",\n \"outboundType\": \"loadBalancer\"\n },\n \"maxAgentPools\": 100,\n \"identityProfile\": {\n \"kubeletidentity\": {\n \"resourceId\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/MC_javaacsrg83451_aks69744203_centralus/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aks69744203-agentpool\",\n \"clientId\": \"e93303b0-8511-45e3-8bc6-de4ad6eeeee6\",\n \"objectId\": \"1fc0866f-7e64-40d8-b7ee-0c61028ee0ad\"\n }\n }\n },\n \"identity\": {\n \"type\": \"SystemAssigned\",\n \"principalId\": \"ff4c70c8-cae8-4f97-a7be-db9acb079303\",\n \"tenantId\": \"00000000-0000-0000-0000-000000000000\"\n },\n \"sku\": {\n \"name\": \"Basic\",\n \"tier\": \"Free\"\n }\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203/listClusterAdminCredential?api-version=2021-03-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerservice/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "7fa3b441-c524-432d-ac0e-3895928198d6", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "13037", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1198", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "77168fb4-6d55-4fd2-9c37-623d4a1ad7fc", + "Date" : "Wed, 02 Jun 2021 09:45:21 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094522Z:77168fb4-6d55-4fd2-9c37-623d4a1ad7fc", + "Expires" : "-1", + "x-ms-request-id" : "42ac3df4-6ea7-47f0-a7e9-f2d24393c959", + "Body" : "{\n \"kubeconfigs\": [\n {\n \"name\": \"clusterAdmin\",\n \"value\": \"YXBpVmVyc2lvbjogdjEKY2x1c3RlcnM6Ci0gY2x1c3RlcjoKICAgIGNlcnRpZmljYXRlLWF1dGhvcml0eS1kYXRhOiBMUzB0TFMxQ1JVZEpUaUJEUlZKVVNVWkpRMEZVUlMwdExTMHRDazFKU1VVMlJFTkRRWFJEWjBGM1NVSkJaMGxSVlZNMVFXZG9VemR6Y2s5RFFVeDRjMDB6TWxsbWFrRk9RbWRyY1docmFVYzVkekJDUVZGelJrRkVRVTRLVFZGemQwTlJXVVJXVVZGRVJYZEthbGxVUVdkR2R6QjVUVlJCTWsxRVNYZFBWRWswVFZST1lVZEJPSGxOUkZWNFRVUlpkMDFxUVRWTmVtZDRUVEZ2ZHdwRVZFVk1UVUZyUjBFeFZVVkJlRTFEV1RKRmQyZG5TV2xOUVRCSFExTnhSMU5KWWpORVVVVkNRVkZWUVVFMFNVTkVkMEYzWjJkSlMwRnZTVU5CVVVSaENtUktRMVUzYTBJek1VZDRWakZSSzBSVFZXRlFOVzF3YlVaelREQjNTMlZzSzBVdlZEZHVVMUZrWms1blFXcFNabFo2U0hob2NucFdjRXBKVG1seFZGZ0tXbXhDZVZKV05GbDVVa2x6UzA1VVJYQmlTRE5oU2poc1ZHWjFaalZhUTI1MWNXb3ZlVmRIZW01TVR6TXJPRVV2UW14VFNVSmFVVFpXVG1Gd2VXRlFSQXBrVUc5RFFtRTJaVTF0T1VsbVFrczFhazAyUWt4YVVrSTFXR3hTZDI1aVRFUkthMjFuT1doaWR6RjZWMUUyVUdKVWVYSnZVVGR2VVVKdGVrcE1TWFoxQ2k5aU9UWjRlVWhDSzNwd05UZERPRVpDVG1oM1Z6Tk5PV3g1ZVdvcmNITnlhVEJZUTBseVNIZG5WVGt3WkU5dVV6VktRbVpUTW1KbFRqUk9OMUJYYWxRS01YRk5VMEZKVTBSb1VXZzNZa2hpZERCVWFVWktkakZNUTNoU1NrMTViMFJsZDJsb1MwSXlRekJ6TW1WUU0weEpTbmcxTlVSaU9FUlhTa0ZaU2twSlF3cEhja05QWW1jd2FtOXRaR3RVUkVWYVFtbzRSamwzYWsxRVRGSm1TV0prUTFSTFZFd3dkM3BOUVdST1ltVmhibEY2VUV0cVoxbFBVbVpvUzJKTE5XSnJDbXA0VlRZNE9FdFdWM053T0dsM2VFbExhRXR3UkVvMGFTOXpiazQ1YjFKU2RqaEdObHBaVEhkdlNqTmpjM05YZUROdFJVazRRVlJwYmpaUmNsazVTbGdLVEM4Mk5sRkZVa0V3VVVkTk9IaEZUMlJFUVVkaVRXcHJaRGc1ZUcxQ2VqbGhSbWxrZG5CcFVrNURTREVyVGxaM2FuY3dlVFZSZG05cGIzcE5Na2hwUmdvM0x6RjJUbUZ6VFhaYWFEZHRkMEZNWW14UWFDOXdSa05TVG14MVZuQlpRVGhzTDIxTU5rODNibFowVjAxRWVGSlpiU3Q2UkdWMWQyTnRWV1JTTW1aS0NtaFpNelZNY1haRWRrNDJiVE56ZFZOT2VVMURhRkkzTVRSSVVqVm1WamMyVjNadWIxbFZSRmN5YjFKR1NrVTRWV3hyUjJGeVlqWnFaSGw0T0RseU0zWUtjaTl3VFVaVWJuRjVhWGR6T0VRd1dEWklVell4WWt0YVpHeFpiR2N3VmpWWlUwMTRTazlwZVdGM1NVUkJVVUZDYnpCSmQxRkVRVTlDWjA1V1NGRTRRZ3BCWmpoRlFrRk5RMEZ4VVhkRWQxbEVWbEl3VkVGUlNDOUNRVlYzUVhkRlFpOTZRV1JDWjA1V1NGRTBSVVpuVVZVeWNWRTJkblJpSzBoalVTOVRVblZaQ2pSUE5GZ3lVVkZaVVhJMGQwUlJXVXBMYjFwSmFIWmpUa0ZSUlV4Q1VVRkVaMmRKUWtGTlRGTlhVRWw0UkZVNWVDdFdlV3hTZW1NdldXc3lRMjU1ZVZvS2FEZFBaalJET1M4NU1sWkVWV1p6YlRGdVp5dGFNMEp5VUdGcGN5czBSREJDTlZkUllrbG1TREJOUkZwdVVtWkRTMlkwV1VONVEyWlBWRnBQWTNaSlJncGFMMnBoVW1KNFpIb3pUMEpMYVRsSWIxbHhkekJpTVdkV0t6bHhNbEJNT1NzM2VXdHFOMDlCWlhGNVFsVk1UWEEyYW1nNFdGWktRbE5xY2pRNGJEaHVDamMzVGpSc1RETllUVlZuZWs5SVVFRnJTMnQ2YVVWeVMxbExSek54Y1daMU5HTlVkVTFsY0ZkVE5pOVFkRVZXU2t0UmFteDRjVWRHVWxablNsSlNVVVFLVkRkcFUwMU1kbTExUmtReGVuZDFXVlp4V0c5amNXZFVWVFYyTUVWdWRVTXdZbGRaYXpOSUsySjJNRGRHTm1KblowdzJWMnhIYWpGaGNtTnNkMU5hVEFvdlRHRXhXbHAwVjI5T1VuUk5Nbk5zT1U0M2JYbDZOR2xUZG1KelpHMXJZMEpIVTJnelpVdE5VMUJoY3pOMVZUZEdkV1JFVURGM1IzUkJXVWRTS3poR0NrbHBhRVZDZW01VFNsZElSblpUUTNWMVpWWm5ha3BQU1ZJelVtWlFPREZaVEV4a05XMDVOVXBOVVdac2VraE1ObkZETTJKNVpWRm5abVZyYUZnM1ZtUUtOalY1WW5vMFIybHlibUUyTmpWTU9XdFBNVVpDVURkTGJFbGpRMUpLYzFvNWEzcE9PRVJ2TTFSd1VqWlNlRkZvUlRjMFJHSlJNRTlyUldZMmRHMVBhQXBTVVc5QlRVOUhZVWRFT1hoMmVHSnNMM3BMTDBsYVpYQkZZbk5RU2pCRGVHeDRSamN4YmpKa1RqTmhlWE54V0VRd01UbEllR0pPZEVGTmNUbDNVRTFuQ21SUU5GYzNVekpoTVRBMFZGVXdXWFYzTWxCaFZFeExSR1J4TUdoa1VrRXhUSGw2S3psV1RFeEdOMHR5WTFoUVMzbFNNR3BHUkZFd2N6VkRSeXRVWVhjS2JubHVjVnBqZUVwbmRUSTVOVTVxVFZKMFltZDRNWEpSZDJOUU5FOHZVa2RRV0ZneFptWkNUVGszUVZFMVQwNDVWM1JKWjNWVWJHaGFkMkpEVTJoUFVBcFBNVk5LZFZCUUswRnRlVkJVVnpCaUNpMHRMUzB0UlU1RUlFTkZVbFJKUmtsRFFWUkZMUzB0TFMwSwogICAgc2VydmVyOiBodHRwczovL21wMWRuczQ4NDM1Mi1iMTYzNGM2Zi5oY3AuY2VudHJhbHVzLmF6bWs4cy5pbzo0NDMKICBuYW1lOiBha3M2OTc0NDIwMwpjb250ZXh0czoKLSBjb250ZXh0OgogICAgY2x1c3RlcjogYWtzNjk3NDQyMDMKICAgIHVzZXI6IGNsdXN0ZXJBZG1pbl9qYXZhYWNzcmc4MzQ1MV9ha3M2OTc0NDIwMwogIG5hbWU6IGFrczY5NzQ0MjAzCmN1cnJlbnQtY29udGV4dDogYWtzNjk3NDQyMDMKa2luZDogQ29uZmlnCnByZWZlcmVuY2VzOiB7fQp1c2VyczoKLSBuYW1lOiBjbHVzdGVyQWRtaW5famF2YWFjc3JnODM0NTFfYWtzNjk3NDQyMDMKICB1c2VyOgogICAgY2xpZW50LWNlcnRpZmljYXRlLWRhdGE6IExTMHRMUzFDUlVkSlRpQkRSVkpVU1VaSlEwRlVSUzB0TFMwdENrMUpTVVpJVkVORFFYZFhaMEYzU1VKQlowbFJUV3hRUW1kaFVWSnRUamxUWjNoUE5XVm1RM1kxUkVGT1FtZHJjV2hyYVVjNWR6QkNRVkZ6UmtGRVFVNEtUVkZ6ZDBOUldVUldVVkZFUlhkS2FsbFVRV1ZHZHpCNVRWUkJNazFFU1hkUFZFazBUVlJPWVVaM01IbE5la0V5VFVSSmQwOVVUVFJOVkU1aFRVUkJlQXBHZWtGV1FtZE9Wa0pCYjFSRWJrNDFZek5TYkdKVWNIUlpXRTR3V2xoS2VrMVNWWGRGZDFsRVZsRlJSRVYzZUhSWldFNHdXbGhLYW1KSGJHeGlibEYzQ21kblNXbE5RVEJIUTFOeFIxTkpZak5FVVVWQ1FWRlZRVUUwU1VORWQwRjNaMmRKUzBGdlNVTkJVVVJrTDBWQ1ZtcDBVR3QwYkhBeE1HZ3pVbFZKZEVJS01raHpWVVVyVG5oaGFuaHpPVkUxTW5CaFJVbEtRMkowZFVFNFYwNU9PR3hEVEdoVWVXMTNibkV6ZUZWUk1XSm1UelZCWmtGSFNVZHdNRmxWSzBwdFdRcDFiV1ZUYzJSMWRtaExiMWsxUzI5eVRtOVRlV1kyVkRneVFrOVdVRVJJVVRsbVlUSnNhSE5qYVZBMFNEUmpRbmRYYldRNFNWWkZkMnRIWkV4SGFraEdDakpJZWpWV1EwZHlLelZKYW5oME4xTjBRVUprSzJWWmJIQnRkRzlTZW5SdE9VcE9UMlpYTW01UGNqTnliR1ZRY2pOUll6bFdTV0ZJV1hSTFJtWnpUbklLTTFkWE1XdHliMDF0U1hSQmJtVTJNRkZGUm5OUllsRkdMek5XWXpGM09IRkpOV05xTkdOS1REaHFWRk5vUmsxUVZpczRSM040VWpnemJuRkhSblJNUVFwa1RWbEljM1JsTTJVeE5WVTJOVE5TTUU1UFdqTlBhamhNV2pGUFIyeGljaTlhYVU5elNYVXhVVEJPV0RCaGIyRkdlVFZvWkVKTE0wZG1NRmRtZFd3d0NtdHNUVGd4ZFdjMWRHcHhRV3RxU1ZWTFVuRTJlVVZTVWpaTVJqZDFNRGRPUm5Zd04ydE9kVlJDV0M5UmNUQkJkMUI0ZDBkaFZYcHdNMlJXTnpSR1dTOEtUbEI1YkZSbWEwNVZOM2w0ZEhsTmMzQm9XVkJ6TVcxWFlrSlBUVFZQYUZJMlZVSm5PRXB0YUZadVQzRlplRWxTWm14alFteERXbXBrTkZkNU56Z3lad3A1YVROMmJqaHZURXRLTWpWd01XZDNZVlZGTjFKRU9WZ3lVbEF5YkVOd1pIWkRNMWxvZHpSNVJrdHdNRE5UVUdGc2JYSmxjV2RvYUZaU1FYSnVWSGs0Q20xT2MzUjJkVkl3ZEdoemRFODRVblJQT1dWWWFqZHRaek5NUm1wRU1tVndiVzk2YUZGTFYzZ3pZMkYwTDFCaGNFdHRRMFpyY2xCRVlWQlpaVTVDZERFS2IzUm9jRWRzUlU1U1NWUjBjbFZHZHlzNVdGZzJiSFpuZGs1U1ZXaFpTbGxVV1RrMFNsZHlNbmhwTmxKWU9FZzJjWGMzYVZWMGRreEdiMDVoVFhKU1ZRcEpXRlI0YW5CaGJIRkVSMDAxVldadmQwaFNOekpSU1VSQlVVRkNiekZaZDFaRVFVOUNaMDVXU0ZFNFFrRm1PRVZDUVUxRFFtRkJkMFYzV1VSV1VqQnNDa0pCZDNkRFoxbEpTM2RaUWtKUlZVaEJkMGwzUkVGWlJGWlNNRlJCVVVndlFrRkpkMEZFUVdaQ1owNVdTRk5OUlVkRVFWZG5RbFJoY0VSeEt6RjJOR1FLZUVRNVNrYzFhbWMzYUdaYVFrSm9RM1pxUVU1Q1oydHhhR3RwUnpsM01FSkJVWE5HUVVGUFEwRm5SVUZhVTJab2NEaE5lRGxwU2xKdk5rWmpPV2xhYXdwNFNEWkRkemRRT1hwVkwybE9ObEpuTUcxSlIwMVVSbEY2S3pZM1ptRTFPR3R5YmpSQmEweENUWHBqYm14Q1ZYVXlaRTlXTXk5TFNFVnpWazR5UkN0aUNubDZiSE4xTkhsMVZsVTBOVk5DU25Bd2JGWmxkbU42TmtWMkszZFBaR2RIWXk4ME9GbEVORVJrYjFCa1ZrOXdNVlZVV0hWMk9EbDZWMjVoWmk5U2NFOEtTa1JYZEZaUEt6UkhTVGd3Um1KQlYwZGtZMnh4V0RobmJGQk1ibE13UkZoeFMzQk9WRmROTlZOMGRuUmxNV3R1TkUxQlVIRXZWMjB4UmxoalpIbE5lQXBsYkZkTlptdE1iMWszYWxGTldYTmlkMEpxUlRORFpYSlRWa1JTU1dSWGJFWnFSbEkwUTNGS00wTkJTRGQ1YkRGS01VMW1RVmRtVUZwVVNGWlBaVmRTQ2t4YWNIZFdXVmhHTjNJNFMxaDFUVFZMYzI1SlIxVXlVVTVGUkhNMVJteFJVbkU1TTNGc2RUZFhaRlJFVjJVeFFuSk9TRVZQUTFSVlVrb3ZXbkF4TURVS2FTc3liM2xOVjA1Q2FscEZVRE5CY2tNNFdFUTFURUZTTjBONGRrczNNMlJsUkZkaGRrNVZkVWRoTm5RM1pVRkxlbkYwTmxwb1YzY3ZVbFpQYmpCckt3bzNORGx3T1hkRFFWRnJOWEJsUTFOb1FXRlNhakYwWWpoaFRWUlNia1Z0THpOTFlWbFJja3BPVjNwUlJWQTVjRFJwV2pWaWJIZFFTamhWTkVWQlVIbEdDamxuUVU5dWVUUTVWWEF6TTNoMFZGZGxWVGt5Y0dSeVN6QTVTVXhyTUVVd1ptcENjV2xwY0hka04zQnlLM0J3VEhoYVkzTXdNRTFuUVRNMk5GbDBUVGNLYmtGSFVEUjZNbE12VldoTlpWWkZUVmRYYXk5SmMwMVhibGh0TTJwSk1XUXJabFkzYkhCelRXODRkRUZtVkc4eWMxWkJNblprWmt0Q1lscFJNV2hXWmdwNWVqazBPVkZ3VkZaT2MwcENSWEJCZG05dmExQnVjMWRMSzJWdVdEWkRMMDVhVHpaMU5uTTJjR0ptV1ZKTlNYWndXVTgxUVhGWWRqSXJSRlZCYldFeENqTnhiM2NyZGswdk9URTFNbTlUVFVFNWRuUnBNVlV3UFFvdExTMHRMVVZPUkNCRFJWSlVTVVpKUTBGVVJTMHRMUzB0Q2c9PQogICAgY2xpZW50LWtleS1kYXRhOiBMUzB0TFMxQ1JVZEpUaUJTVTBFZ1VGSkpWa0ZVUlNCTFJWa3RMUzB0TFFwTlNVbEtTM2RKUWtGQlMwTkJaMFZCTTJaNFFWWlpOMVExVEZwaFpHUkpaREJXUTB4UlpHZzNSa0pRYW1OWGJ6aGlVRlZQWkhGWGFFTkRVVzAzWW1kUUNrWnFWR1pLVVdrMFZUaHdjMG8yZERoV1JVNVhNM3AxVVVoM1FtbENjV1JIUmxCcFdtMU1jRzVyY2toaWNqUlRjVWRQVTNGTGVtRkZjMjRyYXk5T1oxUUtiRlIzZURCUVdESjBjRmxpU0VscUswSXJTRUZqUm5CdVprTkdVazFLUW01VGVHOTRlR1JvT0N0V1VXaHhMM1ZUU1RoaVpUQnlVVUZZWm01dFNtRmFjZ3BoUldNM1duWlRWRlJ1TVhSd2VuRTVOalZZYWpZNU1FaFFWbE5IYURKTVUyaFlOMFJoT1RGc2RGcExOa1JLYVV4UlNqTjFkRVZDUW1KRlJ6QkNaamt4Q2xoT1kxQkxhVTlZU1N0SVExTXZTVEF3YjFKVVJERm1ka0p5VFZWbVRqVTJhR2hpVTNkSVZFZENOMHhZZEROMFpWWlBkV1F3WkVSVWJXUjZieTlETW1RS1ZHaHdWell2TWxscWNrTk1kRlZPUkZZNVIzRkhhR04xV1ZoUlUzUjRiamxHYmpkd1pFcEtWRkJPWW05UFlsazJaMHBKZVVaRGEyRjFjMmhGVldWcGVBcGxOM1JQZWxKaU9VODFSR0pyZDFZdk1FdDBRVTFFT0dOQ2JXeE5ObVF6Vm1VclFsZFFlbFE0Y0ZVek5VUldUemh6WW1OcVRFdFpWMFEzVGxwc2JYZFVDbXBQVkc5VlpXeEJXVkJEV205V1ducHhiVTFUUlZnMVdFRmFVVzFaTTJWR2MzVXZUbTlOYjNRM05TOUxRM2xwWkhWaFpGbE5SMnhDVHpCUkwxWTVhMVFLT1hCUmNWaGlkM1F5U1dOUFRXaFRjV1JPTUdveWNGcHhNM0Z2U1ZsV1ZWRkxOVEE0ZGtwcVlreGlOMnRrVEZsaVRGUjJSV0pVZGxoc05DczFiMDU1ZUFwWmR6bHVjVnB4VFRSVlEyeHpaRE5IY21aNk1uRlRjR2RvV2t0NmR6SnFNa2hxVVdKa1lVeFpZVkp3VWtSVlUwVTNZVEZDWTFCMlZqRXJjR0kwVEhwVkNsWkpWME5YUlRKUVpVTldjVGx6V1hWclZpOUNLM0Z6VHpSc1RHSjVlR0ZFVjJwTE1GWkRSakE0V1RaWGNHRm5lR3BQVmtnMlRVSXdaVGxyUTBGM1JVRUtRVkZMUTBGblJVRXdValJUTVZGaGNEUnRiRTl4Yms0MFJqTnJVekZ6VEVOdU1WWnNRemREVTI0cmJuazJRalUzY0hCdE15dHVWa3c0VWxZMWNWQXJaZ281V0RsYWFEY3hjV05GTjBob1lVRnpNSEZsWm5OTWFtWnpiRE5JUWtSUFJqUndSMlZpUzJoRVVGSlJZMjl1ZWtoWlVXZFRUM2RoY1ROQmJFdDJTbXRhQ2tFd1VrRTBaemRFYTBaV1FUTm9ZWE5MYVcxUmRraHJjMlJZYlVaeVpWZFdVbUZRVmpOS1ozWlJXR3BWTjBKVldua3lNMmhQTVV0a1IwTXdVMkp3YVRBS1RrWnlRV00yZEVsM2NXWXZaMGhDUm04Mllpc3pTV1JvTTNSU1pEaEVNSFV4V0VGV2VVVjJhakJ6YkRBeE1sVTBka2Q2WnpGRk1teEhRVXRaYWtrdlpRcHFOMVJpVUc5Uk5qaHdOSEJUVDJ0RWFWbEpiVXROVUVaR1NrSnViRlp1YzA4NVFtdHRjbkZxVlUxb2RHTm1lVkpsWmpZM2JFOVROM0phYm5WcVNETnVDblV6VUdoRFN6aEhkamRKU2pGdE5VVkRVbGsxYTNwbWRWUmpWR013Ylhndk5FSjRkRVphVkdkdFR6SlVUR2hKYW5CUWJIUk1WbUZWT1RobllWcElVWFlLTWpnMVp6QXpNWFJIYUVsUFRYZHhVM1UyWkRORmQxUTFOVFpMTTBSdWVqSnFhVlZCSzFRelNtTnFaSFpvTW14WlEyeGtSMGR3T0RsbmExZ3plR2x4Undwc2N6TjVOREpMVkhobVJucDJOa0pqVWtGeFZrMTBjREpEVDBkUVVFa3Zka2QxYkRoTVpUUlRUbTkyVVVGVkwwaHNUVll5TUM5WEswY3ZOMlpsZUROc0NtUkdZVk5SV2xwdU9WazNlbTVoWjBaUE4xWnFjME5UVjJ4b09ISXhXbEZSWjJRMmJ6TnhObWcxVm01NFJHbFVVRmR6VkRsT1J6ZDBjamxyVkZadUt6Z0tOM00wYTAxb1dHNURjWE54VmtaWldVaGFVelIzVVZGcWFEaFhPVnBxVFVKSVdETmpVMEpwYUc1dVVIaFZWMVpJWWpOa1pESXdSa2xuTTFkYVJVbDBjZ3BOWmxBMVdEazNkbUY2U25WRVdtaENaVUZ6U1hoUk5HMVdkV2hKTTFaNlRtOHhNV3BxZUU5dWFXeDBkMHhqU0ZWdk1tdERaMmRGUWtGUFVteENNME5QQ25OMk5tazFVbVV5S3pCYWRDdHNlazR2UWxsbFdtdFNMMUUzVVhKWGVYUkthMVp2TDNjdk1VTjNiVEJUTmpFeWNVeERVMFJ5U3k5aVExWXdZWGRSY25ZS1prc3ZNemhIYjBZMlMxcGFaamcxZFV4NFlYSlVOQzlwU2twU1dXMW9NVUkzS3paemIxQnVNRVpqZUZvM2VVRTVPVXhUVWtKNVNXVklaSE5KY2t4U1pBcFdWVTk0TldwcVpFUXZjVXRMZVRRNWRXcEVVV2RQYTFjNFl6UmpZMUZqVFZaeEsyMUplbVExVldsbldteExaRVoyVFM5bWEzQmFUbTkyZENzMlJuWTJDbmcxVHpCS2VqbHRSamQxUjBOekt6RlFUbXB6VmpGamMyOUtZVVJVWmpoek5YRk5Ra2gySzBVNVVWUTFjRVF3WWpOV1VrNVZNbWd4YkdwbFRYcFJXVmNLWkVWVFRtNU9ZVlY1Y0c5c01uUnhjWGx2VGpSVVJDdHRUVXhaWms5RWVrODFUM2d5TXpkTU1GSllUalJHVDJWbU4weGtiVTUxZVVWamJXdFFVM1VyZEFvemJHODVVbHB2VWpCbmJ6UTFOVTFEWjJkRlFrRlFhbEUyUWtNek5sQjBPSFJ4TTJKTlQwWllVSEo0Y0VsVFRYVnhNWFZOTjNKRk1tMXplazAwTVRGdkNtMTBkekk0WjJwSVoxcGlSVXBOZURkTGFEZHdOSEJ5ZVRGd1NtWmtjMnd4VDFkSE9XaHpWaTlFT0hOalEzZDZNVkZtVVdOVk9VZFpPR1pUZFc0NFlrWUtUREoyVVZSQ1NsZHVjRWhVUWpnelZFSXhaM2RPYWs5VGVWQldkVVJ1U25aTFZYaGxabTlVU205NGIxVmpOamMwTjBKclkyRXlPVmw2Y0dSM04xRjRRZ280Wm1NM1pVSlpla1pxVGl0UWFtTm1jakpqYTJaUGVsUklTa0ZZVFZFMFVYVmlRMkk1T1VOR09YTnFTMng0UlVwNGNEVkpOakkwUjJ4RlRsaHBXakF3Q25wTmIxZDZhRTkyYlVoWFYwNHlTREZDTDFoUlVraEhlRTF5TmtSSmVqUkRSRkZVZW1KNlNtWk1OR1ZxVW5KWFMyNXlUaXRKY0ZOamEyaFRTVmxsTVhNS2VVTmFhMVpsVlZaMFpYZHFaVzB4ZFVrdlptTkVSa3hLU25GRlFUZFNaRmhpYTNwMlNFbEJZVWR0VFVOblowVkNRVTFQWlZaS1ZIWmFRbVk0TlZWTkt3cHJiRVp6WlZCa2NqVm1TRGMzTlZCVVprOVhaMFJQU1hscVRFSkVNVlpZYVVSRGVtNHJNMlZ3TDFWNk5VTnlkRVZYSzNwSGMxaHFkMVJzWkZwblV6QlBDa052YjFGT1ozUldSRVJtWVZkeVltUTVialp2ZEV4a1EyUnZTbmxyVWpSR1JsaGhSbmRQTlZsdmJreFdiRTF4UVVOUmNFWnFPR0ZpSzJnclZrTTFOMEVLYlV0TU5raExibkZpVFV4TGEzUTRVbkVyU0doTmJETmlSRFZSTms1QlpXSm1aV0ZwYjJ4UWVYZDRhelJaU2tWcWVHVnBjV1JrU0hsS1YxazBPSHBUTVFvclRGaEJlRkp1UzBoWFpXVmFaVUpuWkU1eU1XTTJVMUJxUzNOdmJIRm5OemxNUW1sTlZ6SXhjRUZvUldkeFFVSjBjblV4WlZKVmVIWnFka3BJZDBGaUNsTk1lRzFzSzBOaFZVRkllVEI2ZG1jeEt5OXNTbGxJVUc5MmRERm9XSFk1UWtVNE1rWndSMk40UmpoQmVWTkphUzkxZEVaRlpWaG1aMWxpUVROQ1FuVUtSM1o0ZFdGTmEwTm5aMFZDUVU5Q1JHVXdaa2RZUVhGQmNVTTRabmd6YWpCTFEyMTFTVUkwVkRkSlQwTkVXWEJTUXpCdVdYbHVNMmN3VDFBek5tdFBZZ3BtZFZGcVQyNHZURFl6VldSdVp5OUlTRlIxYkVzck16ZzJTa1lyVVVWRk1tVXdaVFJ4VVZWMU9HaHNVMmgzU0RrNWRXUjRiR0pYVlN0V09GWjVaSE5zQ21zMWMyZFBTVW81TWt4eVYwTmhVMGRuZG1OclJWbFdNMU5EVURkaU9VaEVOVWQ1V0ZSdldFRXJlSHBRUkhNMk0yNXpNMFpFVVZCc1ZraENaMlUyWVZjS2RWVlpSVmhhVGxaNlkxVk1hMFZZZEV0dGREbFhPSFYyY1RRM1VuQmFWMlpwV1ZsR2FFRXZjRmhqY0VKTk1rcHBURGRTWVRkRlFub3pURzE0ZDBkRWFBb3ZiWEpPTUVoR1RWbzNXbG94TjJOYU0yZEVNVTVuYVc0eFNrSklNR3QyTW0weVMwZ3JhVEppUjJSMmVYSnllVUZQZGt0cE1IQkZjbGxYVDNCUUwzQlNDbXBVTW1ZMVRFNUtaVTFZYnpSdWNXcHlNWFZwSzBFdk16QkJWWEkxSzFwWGIwd3dRMmRuUlVKQlRucGxlVkpHTjJSNk5sRTJSRWxLTWpkUWVrOU1UbmdLZFZSek5rWk9WRmN2TkVwQ1pXUkVZVU5JUjBwdWVHbHZWa2hwWW1oRVdISnFTMXBwZDJSQ1V6YzFORnB2Ym5adGFuVm1VVWN6V21kc04xSkVZbGgzVndwUlpGRm5OWFZsVTBKMlIySk9iRGh2VDNCUlMzaGFNa1JxYzNKSVJXMWxOWGxZTjNWUldDOWxVV3BFYUhoVldVTkdhbTFPUTFKMlZWVjBXR2RqUVRkUENqZFVTbk4wY2pSNlkweERhRmM0YjFsVVFqWm1RbFZrYTJaTllUZHphMnRCVldjeVRYcDJjMjFXVlM5eWIxaG5VbVJxU25OeldUUXpkWFpxZW5CMlJHRUtSV2RWUmpseFlTODBZamd3VVN0Sll6UnRhRXRxZUhveVIySTVXV2QyVUhkMGNYSm9kamx1ZUd0TE9VNWlOMXBpVkd0NlFpOVhjRWswUVhGTE1USk1kUXBsUVVnNWFXVmFha1ZzTVV3elVGcHdiamt5ZVVWc1pYbEVkMWRLY0ZWUVFWbDJha0pvV2tkTWRtMTBNU3QwVlVWbFZrVnJVWEZKT1RWd1ZFRktVbWM5Q2kwdExTMHRSVTVFSUZKVFFTQlFVa2xXUVZSRklFdEZXUzB0TFMwdENnPT0KICAgIHRva2VuOiAyMWI3NjBjNTU2NGYwODEyMDFhYWQwYWI2ZDQ0MDkwNjU0M2Y1ZjU1Mzk3NzRjNGE2NzgwZjA0MmFjYzI1ODZhOGNiMGRiNTRlMjM4MWRhYWVhNzQ4NWZkZDA4NmFiM2FkZmQ2OGU0ZWVkNjZhZjFjYTQyOTA1MzMyMGEwYzcyNAo=\"\n }\n ]\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/javaacsrg83451/providers/Microsoft.ContainerService/managedClusters/aks69744203/listClusterUserCredential?api-version=2021-03-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerservice/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "433ea229-0231-421f-a8b2-b0a8af913e3d", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "13032", + "Server" : "nginx", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1198", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-correlation-request-id" : "2d4f4d0f-a8d7-4e8f-a32e-a5d9706182ae", + "Date" : "Wed, 02 Jun 2021 09:45:21 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094522Z:2d4f4d0f-a8d7-4e8f-a32e-a5d9706182ae", + "Expires" : "-1", + "x-ms-request-id" : "de290044-a715-417b-82a4-87f1a5aacff1", + "Body" : "{\n \"kubeconfigs\": [\n {\n \"name\": \"clusterUser\",\n \"value\": \"YXBpVmVyc2lvbjogdjEKY2x1c3RlcnM6Ci0gY2x1c3RlcjoKICAgIGNlcnRpZmljYXRlLWF1dGhvcml0eS1kYXRhOiBMUzB0TFMxQ1JVZEpUaUJEUlZKVVNVWkpRMEZVUlMwdExTMHRDazFKU1VVMlJFTkRRWFJEWjBGM1NVSkJaMGxSVlZNMVFXZG9VemR6Y2s5RFFVeDRjMDB6TWxsbWFrRk9RbWRyY1docmFVYzVkekJDUVZGelJrRkVRVTRLVFZGemQwTlJXVVJXVVZGRVJYZEthbGxVUVdkR2R6QjVUVlJCTWsxRVNYZFBWRWswVFZST1lVZEJPSGxOUkZWNFRVUlpkMDFxUVRWTmVtZDRUVEZ2ZHdwRVZFVk1UVUZyUjBFeFZVVkJlRTFEV1RKRmQyZG5TV2xOUVRCSFExTnhSMU5KWWpORVVVVkNRVkZWUVVFMFNVTkVkMEYzWjJkSlMwRnZTVU5CVVVSaENtUktRMVUzYTBJek1VZDRWakZSSzBSVFZXRlFOVzF3YlVaelREQjNTMlZzSzBVdlZEZHVVMUZrWms1blFXcFNabFo2U0hob2NucFdjRXBKVG1seFZGZ0tXbXhDZVZKV05GbDVVa2x6UzA1VVJYQmlTRE5oU2poc1ZHWjFaalZhUTI1MWNXb3ZlVmRIZW01TVR6TXJPRVV2UW14VFNVSmFVVFpXVG1Gd2VXRlFSQXBrVUc5RFFtRTJaVTF0T1VsbVFrczFhazAyUWt4YVVrSTFXR3hTZDI1aVRFUkthMjFuT1doaWR6RjZWMUUyVUdKVWVYSnZVVGR2VVVKdGVrcE1TWFoxQ2k5aU9UWjRlVWhDSzNwd05UZERPRVpDVG1oM1Z6Tk5PV3g1ZVdvcmNITnlhVEJZUTBseVNIZG5WVGt3WkU5dVV6VktRbVpUTW1KbFRqUk9OMUJYYWxRS01YRk5VMEZKVTBSb1VXZzNZa2hpZERCVWFVWktkakZNUTNoU1NrMTViMFJsZDJsb1MwSXlRekJ6TW1WUU0weEpTbmcxTlVSaU9FUlhTa0ZaU2twSlF3cEhja05QWW1jd2FtOXRaR3RVUkVWYVFtbzRSamwzYWsxRVRGSm1TV0prUTFSTFZFd3dkM3BOUVdST1ltVmhibEY2VUV0cVoxbFBVbVpvUzJKTE5XSnJDbXA0VlRZNE9FdFdWM053T0dsM2VFbExhRXR3UkVvMGFTOXpiazQ1YjFKU2RqaEdObHBaVEhkdlNqTmpjM05YZUROdFJVazRRVlJwYmpaUmNsazVTbGdLVEM4Mk5sRkZVa0V3VVVkTk9IaEZUMlJFUVVkaVRXcHJaRGc1ZUcxQ2VqbGhSbWxrZG5CcFVrNURTREVyVGxaM2FuY3dlVFZSZG05cGIzcE5Na2hwUmdvM0x6RjJUbUZ6VFhaYWFEZHRkMEZNWW14UWFDOXdSa05TVG14MVZuQlpRVGhzTDIxTU5rODNibFowVjAxRWVGSlpiU3Q2UkdWMWQyTnRWV1JTTW1aS0NtaFpNelZNY1haRWRrNDJiVE56ZFZOT2VVMURhRkkzTVRSSVVqVm1WamMyVjNadWIxbFZSRmN5YjFKR1NrVTRWV3hyUjJGeVlqWnFaSGw0T0RseU0zWUtjaTl3VFVaVWJuRjVhWGR6T0VRd1dEWklVell4WWt0YVpHeFpiR2N3VmpWWlUwMTRTazlwZVdGM1NVUkJVVUZDYnpCSmQxRkVRVTlDWjA1V1NGRTRRZ3BCWmpoRlFrRk5RMEZ4VVhkRWQxbEVWbEl3VkVGUlNDOUNRVlYzUVhkRlFpOTZRV1JDWjA1V1NGRTBSVVpuVVZVeWNWRTJkblJpSzBoalVTOVRVblZaQ2pSUE5GZ3lVVkZaVVhJMGQwUlJXVXBMYjFwSmFIWmpUa0ZSUlV4Q1VVRkVaMmRKUWtGTlRGTlhVRWw0UkZVNWVDdFdlV3hTZW1NdldXc3lRMjU1ZVZvS2FEZFBaalJET1M4NU1sWkVWV1p6YlRGdVp5dGFNMEp5VUdGcGN5czBSREJDTlZkUllrbG1TREJOUkZwdVVtWkRTMlkwV1VONVEyWlBWRnBQWTNaSlJncGFMMnBoVW1KNFpIb3pUMEpMYVRsSWIxbHhkekJpTVdkV0t6bHhNbEJNT1NzM2VXdHFOMDlCWlhGNVFsVk1UWEEyYW1nNFdGWktRbE5xY2pRNGJEaHVDamMzVGpSc1RETllUVlZuZWs5SVVFRnJTMnQ2YVVWeVMxbExSek54Y1daMU5HTlVkVTFsY0ZkVE5pOVFkRVZXU2t0UmFteDRjVWRHVWxablNsSlNVVVFLVkRkcFUwMU1kbTExUmtReGVuZDFXVlp4V0c5amNXZFVWVFYyTUVWdWRVTXdZbGRaYXpOSUsySjJNRGRHTm1KblowdzJWMnhIYWpGaGNtTnNkMU5hVEFvdlRHRXhXbHAwVjI5T1VuUk5Nbk5zT1U0M2JYbDZOR2xUZG1KelpHMXJZMEpIVTJnelpVdE5VMUJoY3pOMVZUZEdkV1JFVURGM1IzUkJXVWRTS3poR0NrbHBhRVZDZW01VFNsZElSblpUUTNWMVpWWm5ha3BQU1ZJelVtWlFPREZaVEV4a05XMDVOVXBOVVdac2VraE1ObkZETTJKNVpWRm5abVZyYUZnM1ZtUUtOalY1WW5vMFIybHlibUUyTmpWTU9XdFBNVVpDVURkTGJFbGpRMUpLYzFvNWEzcE9PRVJ2TTFSd1VqWlNlRkZvUlRjMFJHSlJNRTlyUldZMmRHMVBhQXBTVVc5QlRVOUhZVWRFT1hoMmVHSnNMM3BMTDBsYVpYQkZZbk5RU2pCRGVHeDRSamN4YmpKa1RqTmhlWE54V0VRd01UbEllR0pPZEVGTmNUbDNVRTFuQ21SUU5GYzNVekpoTVRBMFZGVXdXWFYzTWxCaFZFeExSR1J4TUdoa1VrRXhUSGw2S3psV1RFeEdOMHR5WTFoUVMzbFNNR3BHUkZFd2N6VkRSeXRVWVhjS2JubHVjVnBqZUVwbmRUSTVOVTVxVFZKMFltZDRNWEpSZDJOUU5FOHZVa2RRV0ZneFptWkNUVGszUVZFMVQwNDVWM1JKWjNWVWJHaGFkMkpEVTJoUFVBcFBNVk5LZFZCUUswRnRlVkJVVnpCaUNpMHRMUzB0UlU1RUlFTkZVbFJKUmtsRFFWUkZMUzB0TFMwSwogICAgc2VydmVyOiBodHRwczovL21wMWRuczQ4NDM1Mi1iMTYzNGM2Zi5oY3AuY2VudHJhbHVzLmF6bWs4cy5pbzo0NDMKICBuYW1lOiBha3M2OTc0NDIwMwpjb250ZXh0czoKLSBjb250ZXh0OgogICAgY2x1c3RlcjogYWtzNjk3NDQyMDMKICAgIHVzZXI6IGNsdXN0ZXJVc2VyX2phdmFhY3NyZzgzNDUxX2FrczY5NzQ0MjAzCiAgbmFtZTogYWtzNjk3NDQyMDMKY3VycmVudC1jb250ZXh0OiBha3M2OTc0NDIwMwpraW5kOiBDb25maWcKcHJlZmVyZW5jZXM6IHt9CnVzZXJzOgotIG5hbWU6IGNsdXN0ZXJVc2VyX2phdmFhY3NyZzgzNDUxX2FrczY5NzQ0MjAzCiAgdXNlcjoKICAgIGNsaWVudC1jZXJ0aWZpY2F0ZS1kYXRhOiBMUzB0TFMxQ1JVZEpUaUJEUlZKVVNVWkpRMEZVUlMwdExTMHRDazFKU1VaSVZFTkRRWGRYWjBGM1NVSkJaMGxSVFd4UVFtZGhVVkp0VGpsVFozaFBOV1ZtUTNZMVJFRk9RbWRyY1docmFVYzVkekJDUVZGelJrRkVRVTRLVFZGemQwTlJXVVJXVVZGRVJYZEthbGxVUVdWR2R6QjVUVlJCTWsxRVNYZFBWRWswVFZST1lVWjNNSGxOZWtFeVRVUkpkMDlVVFRSTlZFNWhUVVJCZUFwR2VrRldRbWRPVmtKQmIxUkViazQxWXpOU2JHSlVjSFJaV0U0d1dsaEtlazFTVlhkRmQxbEVWbEZSUkVWM2VIUlpXRTR3V2xoS2FtSkhiR3hpYmxGM0NtZG5TV2xOUVRCSFExTnhSMU5KWWpORVVVVkNRVkZWUVVFMFNVTkVkMEYzWjJkSlMwRnZTVU5CVVVSa0wwVkNWbXAwVUd0MGJIQXhNR2d6VWxWSmRFSUtNa2h6VlVVclRuaGhhbmh6T1ZFMU1uQmhSVWxLUTJKMGRVRTRWMDVPT0d4RFRHaFVlVzEzYm5FemVGVlJNV0ptVHpWQlprRkhTVWR3TUZsVkswcHRXUXAxYldWVGMyUjFkbWhMYjFrMVMyOXlUbTlUZVdZMlZEZ3lRazlXVUVSSVVUbG1ZVEpzYUhOamFWQTBTRFJqUW5kWGJXUTRTVlpGZDJ0SFpFeEhha2hHQ2pKSWVqVldRMGR5S3pWSmFuaDBOMU4wUVVKa0syVlpiSEJ0ZEc5U2VuUnRPVXBPVDJaWE1tNVBjak55YkdWUWNqTlJZemxXU1dGSVdYUkxSbVp6VG5JS00xZFhNV3R5YjAxdFNYUkJibVUyTUZGRlJuTlJZbEZHTHpOV1l6RjNPSEZKTldOcU5HTktURGhxVkZOb1JrMVFWaXM0UjNONFVqZ3pibkZIUm5STVFRcGtUVmxJYzNSbE0yVXhOVlUyTlROU01FNVBXak5QYWpoTVdqRlBSMnhpY2k5YWFVOXpTWFV4VVRCT1dEQmhiMkZHZVRWb1pFSkxNMGRtTUZkbWRXd3dDbXRzVFRneGRXYzFkR3B4UVd0cVNWVkxVbkUyZVVWU1VqWk1SamQxTURkT1JuWXdOMnRPZFZSQ1dDOVJjVEJCZDFCNGQwZGhWWHB3TTJSV056UkdXUzhLVGxCNWJGUm1hMDVWTjNsNGRIbE5jM0JvV1ZCek1XMVhZa0pQVFRWUGFGSTJWVUpuT0VwdGFGWnVUM0ZaZUVsU1pteGpRbXhEV21wa05GZDVOemd5WndwNWFUTjJiamh2VEV0S01qVndNV2QzWVZWRk4xSkVPVmd5VWxBeWJFTndaSFpETTFsb2R6UjVSa3R3TUROVFVHRnNiWEpsY1dkb2FGWlNRWEp1VkhrNENtMU9jM1IyZFZJd2RHaHpkRTg0VW5SUE9XVllhamR0WnpOTVJtcEVNbVZ3Ylc5NmFGRkxWM2d6WTJGMEwxQmhjRXR0UTBacmNsQkVZVkJaWlU1Q2RERUtiM1JvY0Vkc1JVNVNTVlIwY2xWR2R5czVXRmcyYkhabmRrNVNWV2haU2xsVVdUazBTbGR5TW5ocE5sSllPRWcyY1hjM2FWVjBka3hHYjA1aFRYSlNWUXBKV0ZSNGFuQmhiSEZFUjAwMVZXWnZkMGhTTnpKUlNVUkJVVUZDYnpGWmQxWkVRVTlDWjA1V1NGRTRRa0ZtT0VWQ1FVMURRbUZCZDBWM1dVUldVakJzQ2tKQmQzZERaMWxKUzNkWlFrSlJWVWhCZDBsM1JFRlpSRlpTTUZSQlVVZ3ZRa0ZKZDBGRVFXWkNaMDVXU0ZOTlJVZEVRVmRuUWxSaGNFUnhLekYyTkdRS2VFUTVTa2MxYW1jM2FHWmFRa0pvUTNacVFVNUNaMnR4YUd0cFJ6bDNNRUpCVVhOR1FVRlBRMEZuUlVGYVUyWm9jRGhOZURscFNsSnZOa1pqT1dsYWF3cDRTRFpEZHpkUU9YcFZMMmxPTmxKbk1HMUpSMDFVUmxGNkt6WTNabUUxT0d0eWJqUkJhMHhDVFhwamJteENWWFV5WkU5V015OUxTRVZ6Vms0eVJDdGlDbmw2YkhOMU5IbDFWbFUwTlZOQ1NuQXdiRlpsZG1ONk5rVjJLM2RQWkdkSFl5ODBPRmxFTkVSa2IxQmtWazl3TVZWVVdIVjJPRGw2VjI1aFppOVNjRThLU2tSWGRGWlBLelJIU1Rnd1JtSkJWMGRrWTJ4eFdEaG5iRkJNYmxNd1JGaHhTM0JPVkZkTk5WTjBkblJsTVd0dU5FMUJVSEV2VjIweFJsaGpaSGxOZUFwbGJGZE5abXRNYjFrM2FsRk5XWE5pZDBKcVJUTkRaWEpUVmtSU1NXUlhiRVpxUmxJMFEzRktNME5CU0RkNWJERktNVTFtUVZkbVVGcFVTRlpQWlZkU0NreGFjSGRXV1ZoR04zSTRTMWgxVFRWTGMyNUpSMVV5VVU1RlJITTFSbXhSVW5FNU0zRnNkVGRYWkZSRVYyVXhRbkpPU0VWUFExUlZVa292V25BeE1EVUthU3N5YjNsTlYwNUNhbHBGVUROQmNrTTRXRVExVEVGU04wTjRka3MzTTJSbFJGZGhkazVWZFVkaE5uUTNaVUZMZW5GME5scG9WM2N2VWxaUGJqQnJLd28zTkRsd09YZERRVkZyTlhCbFExTm9RV0ZTYWpGMFlqaGhUVlJTYmtWdEx6TkxZVmxSY2twT1YzcFJSVkE1Y0RScFdqVmliSGRRU2poVk5FVkJVSGxHQ2psblFVOXVlVFE1VlhBek0zaDBWRmRsVlRreWNHUnlTekE1U1V4ck1FVXdabXBDY1dscGNIZGtOM0J5SzNCd1RIaGFZM013TUUxblFUTTJORmwwVFRjS2JrRkhVRFI2TWxNdlZXaE5aVlpGVFZkWGF5OUpjMDFYYmxodE0ycEpNV1FyWmxZM2JIQnpUVzg0ZEVGbVZHOHljMVpCTW5aa1prdENZbHBSTVdoV1pncDVlamswT1ZGd1ZGWk9jMHBDUlhCQmRtOXZhMUJ1YzFkTEsyVnVXRFpETDA1YVR6WjFObk0yY0dKbVdWSk5TWFp3V1U4MVFYRllkaklyUkZWQmJXRXhDak54YjNjcmRrMHZPVEUxTW05VFRVRTVkblJwTVZVd1BRb3RMUzB0TFVWT1JDQkRSVkpVU1VaSlEwRlVSUzB0TFMwdENnPT0KICAgIGNsaWVudC1rZXktZGF0YTogTFMwdExTMUNSVWRKVGlCU1UwRWdVRkpKVmtGVVJTQkxSVmt0TFMwdExRcE5TVWxLUzNkSlFrRkJTME5CWjBWQk0yWjRRVlpaTjFRMVRGcGhaR1JKWkRCV1EweFJaR2czUmtKUWFtTlhiemhpVUZWUFpIRlhhRU5EVVcwM1ltZFFDa1pxVkdaS1VXazBWVGh3YzBvMmREaFdSVTVYTTNwMVVVaDNRbWxDY1dSSFJsQnBXbTFNY0c1cmNraGljalJUY1VkUFUzRkxlbUZGYzI0cmF5OU9aMVFLYkZSM2VEQlFXREowY0ZsaVNFbHFLMElyU0VGalJuQnVaa05HVWsxS1FtNVRlRzk0ZUdSb09DdFdVV2h4TDNWVFNUaGlaVEJ5VVVGWVptNXRTbUZhY2dwaFJXTTNXblpUVkZSdU1YUndlbkU1TmpWWWFqWTVNRWhRVmxOSGFESk1VMmhZTjBSaE9URnNkRnBMTmtSS2FVeFJTak4xZEVWQ1FtSkZSekJDWmpreENsaE9ZMUJMYVU5WVNTdElRMU12U1RBd2IxSlVSREZtZGtKeVRWVm1UalUyYUdoaVUzZElWRWRDTjB4WWRETjBaVlpQZFdRd1pFUlViV1I2Ynk5RE1tUUtWR2h3VnpZdk1sbHFja05NZEZWT1JGWTVSM0ZIYUdOMVdWaFJVM1I0YmpsR2JqZHdaRXBLVkZCT1ltOVBZbGsyWjBwSmVVWkRhMkYxYzJoRlZXVnBlQXBsTjNSUGVsSmlPVTgxUkdKcmQxWXZNRXQwUVUxRU9HTkNiV3hOTm1RelZtVXJRbGRRZWxRNGNGVXpOVVJXVHpoelltTnFURXRaVjBRM1RscHNiWGRVQ21wUFZHOVZaV3hCV1ZCRFdtOVdXbnB4YlUxVFJWZzFXRUZhVVcxWk0yVkdjM1V2VG05TmIzUTNOUzlMUTNscFpIVmhaRmxOUjJ4Q1R6QlJMMVk1YTFRS09YQlJjVmhpZDNReVNXTlBUV2hUY1dST01Hb3ljRnB4TTNGdlNWbFdWVkZMTlRBNGRrcHFZa3hpTjJ0a1RGbGlURlIyUldKVWRsaHNOQ3MxYjA1NWVBcFpkemx1Y1ZweFRUUlZRMnh6WkROSGNtWjZNbkZUY0dkb1drdDZkekpxTWtocVVXSmtZVXhaWVZKd1VrUlZVMFUzWVRGQ1kxQjJWakVyY0dJMFRIcFZDbFpKVjBOWFJUSlFaVU5XY1RseldYVnJWaTlDSzNGelR6UnNUR0o1ZUdGRVYycExNRlpEUmpBNFdUWlhjR0ZuZUdwUFZrZzJUVUl3WlRsclEwRjNSVUVLUVZGTFEwRm5SVUV3VWpSVE1WRmhjRFJ0YkU5eGJrNDBSak5yVXpGelRFTnVNVlpzUXpkRFUyNHJibmsyUWpVM2NIQnRNeXR1Vmt3NFVsWTFjVkFyWmdvNVdEbGFhRGN4Y1dORk4waG9ZVUZ6TUhGbFpuTk1hbVp6YkROSVFrUlBSalJ3UjJWaVMyaEVVRkpSWTI5dWVraFpVV2RUVDNkaGNUTkJiRXQyU210YUNrRXdVa0UwWnpkRWEwWldRVE5vWVhOTGFXMVJka2hyYzJSWWJVWnlaVmRXVW1GUVZqTktaM1pSV0dwVk4wSlZXbmt5TTJoUE1VdGtSME13VTJKd2FUQUtUa1p5UVdNMmRFbDNjV1l2WjBoQ1JtODJZaXN6U1dSb00zUlNaRGhFTUhVeFdFRldlVVYyYWpCemJEQXhNbFUwZGtkNlp6RkZNbXhIUVV0WmFra3ZaUXBxTjFSaVVHOVJOamh3TkhCVFQydEVhVmxKYlV0TlVFWkdTa0p1YkZadWMwODVRbXR0Y25GcVZVMW9kR05tZVZKbFpqWTNiRTlUTjNKYWJuVnFTRE51Q25VelVHaERTemhIZGpkSlNqRnROVVZEVWxrMWEzcG1kVlJqVkdNd2JYZ3ZORUo0ZEVaYVZHZHRUekpVVEdoSmFuQlFiSFJNVm1GVk9UaG5ZVnBJVVhZS01qZzFaekF6TVhSSGFFbFBUWGR4VTNVMlpETkZkMVExTlRaTE0wUnVlakpxYVZWQksxUXpTbU5xWkhab01teFpRMnhrUjBkd09EbG5hMWd6ZUdseFJ3cHNjek41TkRKTFZIaG1SbnAyTmtKalVrRnhWazEwY0RKRFQwZFFVRWt2ZGtkMWJEaE1aVFJUVG05MlVVRlZMMGhzVFZZeU1DOVhLMGN2TjJabGVETnNDbVJHWVZOUldscHVPVmszZW01aFowWlBOMVpxYzBOVFYyeG9PSEl4V2xGUloyUTJiek54Tm1nMVZtNTRSR2xVVUZkelZEbE9SemQwY2psclZGWnVLemdLTjNNMGEwMW9XRzVEY1hOeFZrWlpXVWhhVXpSM1VWRnFhRGhYT1ZwcVRVSklXRE5qVTBKcGFHNXVVSGhWVjFaSVlqTmtaREl3Umtsbk0xZGFSVWwwY2dwTlpsQTFXRGszZG1GNlNuVkVXbWhDWlVGelNYaFJORzFXZFdoSk0xWjZUbTh4TVdwcWVFOXVhV3gwZDB4alNGVnZNbXREWjJkRlFrRlBVbXhDTTBOUENuTjJObWsxVW1VeUt6QmFkQ3RzZWs0dlFsbGxXbXRTTDFFM1VYSlhlWFJLYTFadkwzY3ZNVU4zYlRCVE5qRXljVXhEVTBSeVN5OWlRMVl3WVhkUmNuWUtaa3N2TXpoSGIwWTJTMXBhWmpnMWRVeDRZWEpVTkM5cFNrcFNXVzFvTVVJM0t6WnpiMUJ1TUVaamVGbzNlVUU1T1V4VFVrSjVTV1ZJWkhOSmNreFNaQXBXVlU5NE5XcHFaRVF2Y1V0TGVUUTVkV3BFVVdkUGExYzRZelJqWTFGalRWWnhLMjFKZW1RMVZXbG5XbXhMWkVaMlRTOW1hM0JhVG05MmRDczJSblkyQ25nMVR6Qktlamx0UmpkMVIwTnpLekZRVG1welZqRmpjMjlLWVVSVVpqaHpOWEZOUWtoMkswVTVVVlExY0VRd1lqTldVazVWTW1neGJHcGxUWHBSV1ZjS1pFVlRUbTVPWVZWNWNHOXNNblJ4Y1hsdlRqUlVSQ3R0VFV4WlprOUVlazgxVDNneU16ZE1NRkpZVGpSR1QyVm1OMHhrYlU1MWVVVmpiV3RRVTNVcmRBb3piRzg1VWxwdlVqQm5ielExTlUxRFoyZEZRa0ZRYWxFMlFrTXpObEIwT0hSeE0ySk5UMFpZVUhKNGNFbFRUWFZ4TVhWTk4zSkZNbTF6ZWswME1URnZDbTEwZHpJNFoycElaMXBpUlVwTmVEZExhRGR3TkhCeWVURndTbVprYzJ3eFQxZEhPV2h6Vmk5RU9ITmpRM2Q2TVZGbVVXTlZPVWRaT0daVGRXNDRZa1lLVERKMlVWUkNTbGR1Y0VoVVFqZ3pWRUl4WjNkT2FrOVRlVkJXZFVSdVNuWkxWWGhsWm05VVNtOTRiMVZqTmpjME4wSnJZMkV5T1ZsNmNHUjNOMUY0UWdvNFptTTNaVUpaZWtacVRpdFFhbU5tY2pKamEyWlBlbFJJU2tGWVRWRTBVWFZpUTJJNU9VTkdPWE5xUzJ4NFJVcDRjRFZKTmpJMFIyeEZUbGhwV2pBd0NucE5iMWQ2YUU5MmJVaFhWMDR5U0RGQ0wxaFJVa2hIZUUxeU5rUkplalJEUkZGVWVtSjZTbVpNTkdWcVVuSlhTMjV5VGl0SmNGTmphMmhUU1ZsbE1YTUtlVU5hYTFabFZWWjBaWGRxWlcweGRVa3ZabU5FUmt4S1NuRkZRVGRTWkZoaWEzcDJTRWxCWVVkdFRVTm5aMFZDUVUxUFpWWktWSFphUW1ZNE5WVk5Ld3ByYkVaelpWQmtjalZtU0RjM05WQlVaazlYWjBSUFNYbHFURUpFTVZaWWFVUkRlbTRyTTJWd0wxVjZOVU55ZEVWWEszcEhjMWhxZDFSc1pGcG5VekJQQ2tOdmIxRk9aM1JXUkVSbVlWZHlZbVE1YmpadmRFeGtRMlJ2U25sclVqUkdSbGhoUm5kUE5WbHZia3hXYkUxeFFVTlJjRVpxT0dGaUsyZ3JWa00xTjBFS2JVdE1Oa2hMYm5GaVRVeExhM1E0VW5FclNHaE5iRE5pUkRWUk5rNUJaV0ptWldGcGIyeFFlWGQ0YXpSWlNrVnFlR1ZwY1dSa1NIbEtWMWswT0hwVE1Rb3JURmhCZUZKdVMwaFhaV1ZhWlVKblpFNXlNV00yVTFCcVMzTnZiSEZuTnpsTVFtbE5Wekl4Y0VGb1JXZHhRVUowY25VeFpWSlZlSFpxZGtwSWQwRmlDbE5NZUcxc0swTmhWVUZJZVRCNmRtY3hLeTlzU2xsSVVHOTJkREZvV0hZNVFrVTRNa1p3UjJONFJqaEJlVk5KYVM5MWRFWkZaVmhtWjFsaVFUTkNRblVLUjNaNGRXRk5hME5uWjBWQ1FVOUNSR1V3WmtkWVFYRkJjVU00Wm5nemFqQkxRMjExU1VJMFZEZEpUME5FV1hCU1F6QnVXWGx1TTJjd1QxQXpObXRQWWdwbWRWRnFUMjR2VERZelZXUnVaeTlJU0ZSMWJFc3JNemcyU2tZclVVVkZNbVV3WlRSeFVWVjFPR2hzVTJoM1NEazVkV1I0YkdKWFZTdFdPRlo1WkhOc0NtczFjMmRQU1VvNU1reHlWME5oVTBkbmRtTnJSVmxXTTFORFVEZGlPVWhFTlVkNVdGUnZXRUVyZUhwUVJITTJNMjV6TTBaRVVWQnNWa2hDWjJVMllWY0tkVlZaUlZoYVRsWjZZMVZNYTBWWWRFdHRkRGxYT0hWMmNUUTNVbkJhVjJacFdWbEdhRUV2Y0ZoamNFSk5Na3BwVERkU1lUZEZRbm96VEcxNGQwZEVhQW92YlhKT01FaEdUVm8zV2xveE4yTmFNMmRFTVU1bmFXNHhTa0pJTUd0Mk1tMHlTMGdyYVRKaVIyUjJlWEp5ZVVGUGRrdHBNSEJGY2xsWFQzQlFMM0JTQ21wVU1tWTFURTVLWlUxWWJ6UnVjV3B5TVhWcEswRXZNekJCVlhJMUsxcFhiMHd3UTJkblJVSkJUbnBsZVZKR04yUjZObEUyUkVsS01qZFFlazlNVG5nS2RWUnpOa1pPVkZjdk5FcENaV1JFWVVOSVIwcHVlR2x2VmtocFltaEVXSEpxUzFwcGQyUkNVemMxTkZwdmJuWnRhblZtVVVjeldtZHNOMUpFWWxoM1Z3cFJaRkZuTlhWbFUwSjJSMkpPYkRodlQzQlJTM2hhTWtScWMzSklSVzFsTlhsWU4zVlJXQzlsVVdwRWFIaFZXVU5HYW0xT1ExSjJWVlYwV0dkalFUZFBDamRVU25OMGNqUjZZMHhEYUZjNGIxbFVRalptUWxWa2EyWk5ZVGR6YTJ0QlZXY3lUWHAyYzIxV1ZTOXliMWhuVW1ScVNuTnpXVFF6ZFhacWVuQjJSR0VLUldkVlJqbHhZUzgwWWpnd1VTdEpZelJ0YUV0cWVIb3lSMkk1V1dkMlVIZDBjWEpvZGpsdWVHdExPVTVpTjFwaVZHdDZRaTlYY0VrMFFYRkxNVEpNZFFwbFFVZzVhV1ZhYWtWc01Vd3pVRnB3YmpreWVVVnNaWGxFZDFkS2NGVlFRVmwyYWtKb1drZE1kbTEwTVN0MFZVVmxWa1ZyVVhGSk9UVndWRUZLVW1jOUNpMHRMUzB0UlU1RUlGSlRRU0JRVWtsV1FWUkZJRXRGV1MwdExTMHRDZz09CiAgICB0b2tlbjogMWVmZDYyZmJkMTgzOTBmOTI3ZjAyYWU2MTQwYTIxYzVhNjkxYTIxN2RkMWU4NjY2Nzc5NGYwODgxZTI2YmIzNDAwYmY5MmFhMGJmN2E2YjNiNzliYmEwYTU3ODU4ZWU1NGZkMWViMTg5OGEwZmJjMmJiOTNhMWQzYzM0ZjNkNzYK\"\n }\n ]\n }", + "Content-Type" : "application/json" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/javaacsrg83451?api-version=2021-01-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources/2.6.0-beta.1 (15.0.1; Windows 10; 10.0)", + "x-ms-client-request-id" : "038d73c3-d53e-476d-9f72-04e7c06791ab", + "Content-Type" : "application/json" + }, + "Response" : { + "content-length" : "0", + "x-ms-ratelimit-remaining-subscription-deletes" : "14999", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "StatusCode" : "202", + "x-ms-correlation-request-id" : "07d9f238-568e-40ea-8824-709ea7bb1a9b", + "Date" : "Wed, 02 Jun 2021 09:45:36 GMT", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "Retry-After" : "0", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20210602T094536Z:07d9f238-568e-40ea-8824-709ea7bb1a9b", + "Expires" : "-1", + "x-ms-request-id" : "07d9f238-568e-40ea-8824-709ea7bb1a9b", + "Location" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1KQVZBQUNTUkc4MzQ1MS1FQVNUVVMiLCJqb2JMb2NhdGlvbiI6ImVhc3R1cyJ9?api-version=2021-01-01" + }, + "Exception" : null + } ], + "variables" : [ "javaacsrg83451", "aks69744203", "dns484352", "ap0558728", "ap1029813", "ap2978030" ] +} \ No newline at end of file From a466b3d474290eacdbd1a7afcf211d431df7356f Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Fri, 4 Jun 2021 08:10:11 -0700 Subject: [PATCH 38/53] Expose CbsAuthorizationType (#22072) * Adding CbsAuthorizationType model. * Deleting implementation CbsAuthorizationType. * Update AzureTokenManagerProvider to use ExpandableEnum CbsAuthorizationType. * Fix CbsAuthorizationType imports. * Fixing Event Hubs breaks. * Fix Service Bus breaks. --- .../AzureTokenManagerProvider.java | 16 +++++----- .../ClaimsBasedSecurityChannel.java | 3 +- .../implementation/ConnectionOptions.java | 1 + .../CbsAuthorizationType.java | 27 +++++------------ .../AzureTokenManagerProviderTest.java | 29 ++++++++++--------- .../ClaimsBasedSecurityChannelTest.java | 1 + .../implementation/ConnectionOptionsTest.java | 1 + .../implementation/ReactorConnectionTest.java | 9 +++++- .../ReactorHandlerProviderTest.java | 1 + .../handler/ConnectionHandlerTest.java | 2 +- .../WebSocketsConnectionHandlerTest.java | 2 +- .../WebSocketsProxyConnectionHandlerTest.java | 2 +- .../eventhubs/EventHubClientBuilder.java | 2 +- .../EventHubConsumerAsyncClientTest.java | 2 +- .../eventhubs/EventHubConsumerClientTest.java | 2 +- .../EventHubProducerAsyncClientTest.java | 4 +-- .../eventhubs/EventHubProducerClientTest.java | 2 +- .../implementation/CBSChannelTest.java | 9 +++--- .../EventHubReactorConnectionTest.java | 2 +- .../servicebus/ServiceBusClientBuilder.java | 2 +- .../ServiceBusReactorAmqpConnection.java | 2 +- .../ServiceBusReceiverAsyncClientTest.java | 2 +- .../ServiceBusSenderAsyncClientTest.java | 2 +- .../ServiceBusSessionManagerTest.java | 2 +- ...viceBusSessionReceiverAsyncClientTest.java | 2 +- 25 files changed, 66 insertions(+), 63 deletions(-) rename sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/{implementation => models}/CbsAuthorizationType.java (55%) diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/AzureTokenManagerProvider.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/AzureTokenManagerProvider.java index cef5dc3e8ee9..9641fb0ef688 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/AzureTokenManagerProvider.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/AzureTokenManagerProvider.java @@ -4,6 +4,7 @@ package com.azure.core.amqp.implementation; import com.azure.core.amqp.ClaimsBasedSecurityNode; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; @@ -57,14 +58,13 @@ public TokenManager getTokenManager(Mono cbsNodeMono, S */ @Override public String getScopesFromResource(String resource) { - switch (authorizationType) { - case JSON_WEB_TOKEN: - return activeDirectoryScope; - case SHARED_ACCESS_SIGNATURE: - return String.format(Locale.US, TOKEN_AUDIENCE_FORMAT, fullyQualifiedNamespace, resource); - default: - throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, - "'%s' is not supported authorization type for token audience.", authorizationType))); + if (CbsAuthorizationType.JSON_WEB_TOKEN.equals(authorizationType)) { + return activeDirectoryScope; + } else if (CbsAuthorizationType.SHARED_ACCESS_SIGNATURE.equals(authorizationType)) { + return String.format(Locale.US, TOKEN_AUDIENCE_FORMAT, fullyQualifiedNamespace, resource); + } else { + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, + "'%s' is not supported authorization type for token audience.", authorizationType))); } } } diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ClaimsBasedSecurityChannel.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ClaimsBasedSecurityChannel.java index 6e72b5acb2bf..5dee735fa688 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ClaimsBasedSecurityChannel.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ClaimsBasedSecurityChannel.java @@ -7,6 +7,7 @@ import com.azure.core.amqp.ClaimsBasedSecurityNode; import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.exception.AmqpResponseCode; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.credential.TokenRequestContext; import com.azure.core.util.logging.ClientLogger; @@ -58,7 +59,7 @@ public Mono authorize(String tokenAudience, String scopes) { final Map properties = new HashMap<>(); properties.put(PUT_TOKEN_OPERATION, PUT_TOKEN_OPERATION_VALUE); properties.put(PUT_TOKEN_EXPIRY, Date.from(accessToken.getExpiresAt().toInstant())); - properties.put(PUT_TOKEN_TYPE, authorizationType.getTokenType()); + properties.put(PUT_TOKEN_TYPE, authorizationType.toString()); properties.put(PUT_TOKEN_AUDIENCE, tokenAudience); final ApplicationProperties applicationProperties = new ApplicationProperties(properties); diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ConnectionOptions.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ConnectionOptions.java index 5e5cb378dfca..5075a6c7529a 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ConnectionOptions.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ConnectionOptions.java @@ -8,6 +8,7 @@ import com.azure.core.amqp.ProxyOptions; import com.azure.core.amqp.implementation.handler.ConnectionHandler; import com.azure.core.amqp.implementation.handler.WebSocketsConnectionHandler; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.annotation.Immutable; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/CbsAuthorizationType.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/models/CbsAuthorizationType.java similarity index 55% rename from sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/CbsAuthorizationType.java rename to sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/models/CbsAuthorizationType.java index 92390dd50305..7e6828f43e53 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/CbsAuthorizationType.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/models/CbsAuthorizationType.java @@ -1,38 +1,27 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.core.amqp.implementation; +package com.azure.core.amqp.models; import com.azure.core.amqp.ClaimsBasedSecurityNode; +import com.azure.core.util.ExpandableStringEnum; /** * An enumeration of supported authorization methods with the {@link ClaimsBasedSecurityNode}. */ -public enum CbsAuthorizationType { +public final class CbsAuthorizationType extends ExpandableStringEnum { /** * Authorize with CBS through a shared access signature. */ - SHARED_ACCESS_SIGNATURE("servicebus.windows.net:sastoken"), + public static final CbsAuthorizationType SHARED_ACCESS_SIGNATURE = + fromString("servicebus.windows.net:sastoken", CbsAuthorizationType.class); + /** * Authorize with CBS using a JSON web token. * * This is used in the case where Azure Active Directory is used for authentication and the authenticated user * wants to authorize with Azure Event Hubs. */ - JSON_WEB_TOKEN("jwt"); - - private final String scheme; - - CbsAuthorizationType(String scheme) { - this.scheme = scheme; - } - - /** - * Gets the token type scheme. - * - * @return The token type scheme. - */ - public String getTokenType() { - return scheme; - } + public static final CbsAuthorizationType JSON_WEB_TOKEN = + fromString("jwt", CbsAuthorizationType.class); } diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/AzureTokenManagerProviderTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/AzureTokenManagerProviderTest.java index 8f3fb2bd5d5c..7cdfa44fed3f 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/AzureTokenManagerProviderTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/AzureTokenManagerProviderTest.java @@ -4,13 +4,14 @@ package com.azure.core.amqp.implementation; import com.azure.core.amqp.ClaimsBasedSecurityNode; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.AccessToken; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; +import org.junit.jupiter.params.provider.MethodSource; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; @@ -20,6 +21,7 @@ import java.time.Duration; import java.time.OffsetDateTime; import java.util.Locale; +import java.util.stream.Stream; import static com.azure.core.amqp.implementation.AzureTokenManagerProvider.TOKEN_AUDIENCE_FORMAT; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -62,12 +64,16 @@ void constructorNullScope() { assertThrows(NullPointerException.class, () -> new AzureTokenManagerProvider(CbsAuthorizationType.JSON_WEB_TOKEN, HOST_NAME, null)); } + public static Stream getResourceString() { + return Stream.of(CbsAuthorizationType.JSON_WEB_TOKEN, CbsAuthorizationType.SHARED_ACCESS_SIGNATURE); + } + /** * Verifies that the correct resource string is returned when we pass in different authorization types. */ @ParameterizedTest - @EnumSource(CbsAuthorizationType.class) - void getResourceString(CbsAuthorizationType authorizationType) { + @MethodSource + public void getResourceString(CbsAuthorizationType authorizationType) { // Arrange final String scope = "some-scope"; final AzureTokenManagerProvider provider = new AzureTokenManagerProvider(authorizationType, HOST_NAME, scope); @@ -77,16 +83,13 @@ void getResourceString(CbsAuthorizationType authorizationType) { final String actual = provider.getScopesFromResource(entityPath); // Assert - switch (authorizationType) { - case SHARED_ACCESS_SIGNATURE: - final String expected = "amqp://" + HOST_NAME + "/" + entityPath; - Assertions.assertEquals(expected, actual); - break; - case JSON_WEB_TOKEN: - Assertions.assertEquals(scope, actual); - break; - default: - Assertions.fail("This authorization type is unknown: " + authorizationType); + if (CbsAuthorizationType.SHARED_ACCESS_SIGNATURE.equals(authorizationType)) { + final String expected = "amqp://" + HOST_NAME + "/" + entityPath; + Assertions.assertEquals(expected, actual); + } else if (CbsAuthorizationType.JSON_WEB_TOKEN.equals(authorizationType)) { + Assertions.assertEquals(scope, actual); + } else { + Assertions.fail("This authorization type is unknown: " + authorizationType); } } diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ClaimsBasedSecurityChannelTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ClaimsBasedSecurityChannelTest.java index 3cfb11b4d835..436f8faadce0 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ClaimsBasedSecurityChannelTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ClaimsBasedSecurityChannelTest.java @@ -8,6 +8,7 @@ import com.azure.core.amqp.exception.AmqpErrorCondition; import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.exception.AmqpResponseCode; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.AccessToken; import com.azure.core.credential.TokenCredential; import org.apache.qpid.proton.Proton; diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ConnectionOptionsTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ConnectionOptionsTest.java index e4ef8fef13c0..a6426dfa83aa 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ConnectionOptionsTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ConnectionOptionsTest.java @@ -7,6 +7,7 @@ import com.azure.core.amqp.AmqpTransportType; import com.azure.core.amqp.ProxyOptions; import com.azure.core.amqp.implementation.handler.ConnectionHandler; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import org.apache.qpid.proton.engine.SslDomain; diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorConnectionTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorConnectionTest.java index f865fa579123..6f2083faeeec 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorConnectionTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorConnectionTest.java @@ -13,6 +13,7 @@ import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.implementation.handler.ConnectionHandler; import com.azure.core.amqp.implementation.handler.SessionHandler; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import com.azure.core.util.Header; @@ -32,7 +33,13 @@ import org.apache.qpid.proton.engine.Transport; import org.apache.qpid.proton.reactor.Reactor; import org.apache.qpid.proton.reactor.Selectable; -import org.junit.jupiter.api.*; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorHandlerProviderTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorHandlerProviderTest.java index 404771c67a35..0c3ad885e5a7 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorHandlerProviderTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorHandlerProviderTest.java @@ -10,6 +10,7 @@ import com.azure.core.amqp.implementation.handler.ConnectionHandler; import com.azure.core.amqp.implementation.handler.WebSocketsConnectionHandler; import com.azure.core.amqp.implementation.handler.WebSocketsProxyConnectionHandler; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import com.azure.core.util.Header; diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/ConnectionHandlerTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/ConnectionHandlerTest.java index 7f4f6d6d2e9f..763c2e6eca71 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/ConnectionHandlerTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/ConnectionHandlerTest.java @@ -6,9 +6,9 @@ import com.azure.core.amqp.AmqpRetryOptions; import com.azure.core.amqp.AmqpTransportType; import com.azure.core.amqp.ProxyOptions; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ClientConstants; import com.azure.core.amqp.implementation.ConnectionOptions; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import com.azure.core.util.Header; diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsConnectionHandlerTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsConnectionHandlerTest.java index 583a123e90a6..af00cfea64dd 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsConnectionHandlerTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsConnectionHandlerTest.java @@ -6,9 +6,9 @@ import com.azure.core.amqp.AmqpRetryOptions; import com.azure.core.amqp.AmqpTransportType; import com.azure.core.amqp.ProxyOptions; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ClientConstants; import com.azure.core.amqp.implementation.ConnectionOptions; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import org.apache.qpid.proton.Proton; diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsProxyConnectionHandlerTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsProxyConnectionHandlerTest.java index e5222d49bab5..c11a815e05a4 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsProxyConnectionHandlerTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/WebSocketsProxyConnectionHandlerTest.java @@ -7,8 +7,8 @@ import com.azure.core.amqp.AmqpTransportType; import com.azure.core.amqp.ProxyAuthenticationType; import com.azure.core.amqp.ProxyOptions; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ConnectionOptions; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import com.azure.core.util.Header; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java index ca295d97cec8..d2c59007da6d 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java @@ -8,7 +8,6 @@ import com.azure.core.amqp.ProxyAuthenticationType; import com.azure.core.amqp.ProxyOptions; import com.azure.core.amqp.implementation.AzureTokenManagerProvider; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ConnectionOptions; import com.azure.core.amqp.implementation.ConnectionStringProperties; import com.azure.core.amqp.implementation.MessageSerializer; @@ -17,6 +16,7 @@ import com.azure.core.amqp.implementation.StringUtil; import com.azure.core.amqp.implementation.TokenManagerProvider; import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.annotation.ServiceClientBuilder; import com.azure.core.annotation.ServiceClientProtocol; import com.azure.core.credential.TokenCredential; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientTest.java index 43f56d50b0b1..377d9e8ce904 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientTest.java @@ -8,9 +8,9 @@ import com.azure.core.amqp.AmqpTransportType; import com.azure.core.amqp.ProxyOptions; import com.azure.core.amqp.implementation.AmqpReceiveLink; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ConnectionOptions; import com.azure.core.amqp.implementation.MessageSerializer; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import com.azure.core.util.logging.ClientLogger; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientTest.java index 5dc2a40b6236..49d8c3cb19b0 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerClientTest.java @@ -8,9 +8,9 @@ import com.azure.core.amqp.AmqpTransportType; import com.azure.core.amqp.ProxyOptions; import com.azure.core.amqp.implementation.AmqpReceiveLink; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ConnectionOptions; import com.azure.core.amqp.implementation.MessageSerializer; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import com.azure.core.util.IterableStream; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientTest.java index 522dc4cf32c8..0bf81bc5a2bb 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientTest.java @@ -12,10 +12,10 @@ import com.azure.core.amqp.exception.AmqpErrorContext; import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.implementation.AmqpSendLink; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ConnectionOptions; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import com.azure.core.util.Context; @@ -77,8 +77,8 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; class EventHubProducerAsyncClientTest { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerClientTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerClientTest.java index 4180a2d83a97..daa39bc7e652 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerClientTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerClientTest.java @@ -11,10 +11,10 @@ import com.azure.core.amqp.exception.AmqpErrorContext; import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.implementation.AmqpSendLink; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ConnectionOptions; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import com.azure.core.util.Context; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java index 116c2aa64270..a1571fd908c8 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java @@ -18,6 +18,7 @@ import com.azure.core.amqp.implementation.ReactorProvider; import com.azure.core.amqp.implementation.RequestResponseChannel; import com.azure.core.amqp.implementation.TokenManagerProvider; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import com.azure.core.util.CoreUtils; @@ -43,8 +44,6 @@ import java.util.Arrays; import java.util.Map; -import static com.azure.core.amqp.implementation.CbsAuthorizationType.SHARED_ACCESS_SIGNATURE; - /** * Verifies we authorize with Event Hubs CBS node correctly. */ @@ -84,7 +83,7 @@ protected void beforeTest() { MockitoAnnotations.initMocks(this); connectionProperties = getConnectionStringProperties(); - azureTokenManagerProvider = new AzureTokenManagerProvider(SHARED_ACCESS_SIGNATURE, + azureTokenManagerProvider = new AzureTokenManagerProvider(CbsAuthorizationType.SHARED_ACCESS_SIGNATURE, connectionProperties.getEndpoint().getHost(), ClientConstants.AZURE_ACTIVE_DIRECTORY_SCOPE); tokenAudience = azureTokenManagerProvider.getScopesFromResource(connectionProperties.getEntityPath()); @@ -113,7 +112,7 @@ void successfullyAuthorizes() { TokenCredential tokenCredential = new EventHubSharedKeyCredential( connectionProperties.getSharedAccessKeyName(), connectionProperties.getSharedAccessKey()); ConnectionOptions connectionOptions = new ConnectionOptions(connectionProperties.getEndpoint().getHost(), - tokenCredential, SHARED_ACCESS_SIGNATURE, AmqpTransportType.AMQP, + tokenCredential, CbsAuthorizationType.SHARED_ACCESS_SIGNATURE, AmqpTransportType.AMQP, RETRY_OPTIONS, ProxyOptions.SYSTEM_DEFAULTS, Schedulers.elastic(), clientOptions, SslDomain.VerifyMode.VERIFY_PEER_NAME, "test-product", "test-client-version"); connection = new TestReactorConnection(CONNECTION_ID, connectionOptions, reactorProvider, handlerProvider, @@ -136,7 +135,7 @@ void unsuccessfulAuthorize() { connectionProperties.getSharedAccessKeyName(), "Invalid shared access key."); final ConnectionOptions connectionOptions = new ConnectionOptions(connectionProperties.getEndpoint().getHost(), - invalidToken, SHARED_ACCESS_SIGNATURE, AmqpTransportType.AMQP, RETRY_OPTIONS, ProxyOptions.SYSTEM_DEFAULTS, + invalidToken, CbsAuthorizationType.SHARED_ACCESS_SIGNATURE, AmqpTransportType.AMQP, RETRY_OPTIONS, ProxyOptions.SYSTEM_DEFAULTS, Schedulers.elastic(), clientOptions, SslDomain.VerifyMode.VERIFY_PEER, "test-product", "test-client-version"); connection = new TestReactorConnection(CONNECTION_ID, connectionOptions, reactorProvider, handlerProvider, diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EventHubReactorConnectionTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EventHubReactorConnectionTest.java index d1e97100ab8f..70a02f5f999e 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EventHubReactorConnectionTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EventHubReactorConnectionTest.java @@ -6,7 +6,6 @@ import com.azure.core.amqp.AmqpRetryOptions; import com.azure.core.amqp.AmqpTransportType; import com.azure.core.amqp.ProxyOptions; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ConnectionOptions; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.amqp.implementation.ReactorDispatcher; @@ -17,6 +16,7 @@ import com.azure.core.amqp.implementation.handler.ReceiveLinkHandler; import com.azure.core.amqp.implementation.handler.SendLinkHandler; import com.azure.core.amqp.implementation.handler.SessionHandler; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import com.azure.core.util.CoreUtils; diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusClientBuilder.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusClientBuilder.java index bc98e2c2d9ae..110619cac5a7 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusClientBuilder.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusClientBuilder.java @@ -8,7 +8,6 @@ import com.azure.core.amqp.ProxyAuthenticationType; import com.azure.core.amqp.ProxyOptions; import com.azure.core.amqp.implementation.AzureTokenManagerProvider; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ConnectionOptions; import com.azure.core.amqp.implementation.ConnectionStringProperties; import com.azure.core.amqp.implementation.MessageSerializer; @@ -17,6 +16,7 @@ import com.azure.core.amqp.implementation.StringUtil; import com.azure.core.amqp.implementation.TokenManagerProvider; import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.annotation.ServiceClientBuilder; import com.azure.core.annotation.ServiceClientProtocol; import com.azure.core.credential.TokenCredential; diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReactorAmqpConnection.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReactorAmqpConnection.java index 81fb67fc6f1b..f1c32b69dd1c 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReactorAmqpConnection.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ServiceBusReactorAmqpConnection.java @@ -8,7 +8,6 @@ import com.azure.core.amqp.AmqpSession; import com.azure.core.amqp.implementation.AmqpSendLink; import com.azure.core.amqp.implementation.AzureTokenManagerProvider; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ConnectionOptions; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.amqp.implementation.ReactorConnection; @@ -18,6 +17,7 @@ import com.azure.core.amqp.implementation.TokenManager; import com.azure.core.amqp.implementation.TokenManagerProvider; import com.azure.core.amqp.implementation.handler.SessionHandler; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.servicebus.models.ServiceBusReceiveMode; import org.apache.qpid.proton.amqp.transport.ReceiverSettleMode; diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientTest.java index a87981fecc1f..bd7207a2dc97 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientTest.java @@ -9,10 +9,10 @@ import com.azure.core.amqp.ProxyOptions; import com.azure.core.amqp.exception.AmqpErrorCondition; import com.azure.core.amqp.exception.AmqpException; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ConnectionOptions; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.exception.AzureException; import com.azure.core.util.ClientOptions; diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientTest.java index 2985c6b5ddc5..50f1699f1f2f 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientTest.java @@ -10,11 +10,11 @@ import com.azure.core.amqp.AmqpTransportType; import com.azure.core.amqp.ProxyOptions; import com.azure.core.amqp.implementation.AmqpSendLink; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ConnectionOptions; import com.azure.core.amqp.implementation.ErrorContextProvider; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.BinaryData; import com.azure.core.util.ClientOptions; diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionManagerTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionManagerTest.java index 5c9e7dc55d20..cc58b9c3e46e 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionManagerTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionManagerTest.java @@ -7,10 +7,10 @@ import com.azure.core.amqp.AmqpRetryOptions; import com.azure.core.amqp.AmqpTransportType; import com.azure.core.amqp.ProxyOptions; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ConnectionOptions; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import com.azure.core.util.logging.ClientLogger; diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClientTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClientTest.java index fd607dafec9e..60710582addd 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClientTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClientTest.java @@ -7,10 +7,10 @@ import com.azure.core.amqp.AmqpRetryOptions; import com.azure.core.amqp.AmqpTransportType; import com.azure.core.amqp.ProxyOptions; -import com.azure.core.amqp.implementation.CbsAuthorizationType; import com.azure.core.amqp.implementation.ConnectionOptions; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.amqp.models.CbsAuthorizationType; import com.azure.core.credential.TokenCredential; import com.azure.core.util.ClientOptions; import com.azure.core.util.logging.ClientLogger; From 71e63f73efddad44e54d035485ec4c855dc3a32e Mon Sep 17 00:00:00 2001 From: Gauri Prasad <51212198+gapra-msft@users.noreply.github.com> Date: Fri, 4 Jun 2021 10:18:02 -0700 Subject: [PATCH 39/53] Addressed API Feedback for Storage STG77 (#22023) --- .../storage/blob/sas/BlobContainerSasPermission.java | 12 ++++++------ .../azure/storage/blob/sas/BlobSasPermission.java | 12 ++++++------ .../storage/common/sas/AccountSasPermission.java | 12 ++++++------ .../datalake/models/DataLakeSignedIdentifier.java | 3 +++ .../file/datalake/sas/FileSystemSasPermission.java | 12 ++++++------ .../storage/file/datalake/sas/PathSasPermission.java | 12 ++++++------ .../file/share/sas/ShareFileSasPermission.java | 12 ++++++------ .../storage/file/share/sas/ShareSasPermission.java | 2 +- .../azure/storage/queue/sas/QueueSasPermission.java | 12 ++++++------ .../azure/storage/blob/AccountSASPermission.java | 10 +++++----- .../azure/storage/blob/BlobSASPermission.java | 10 +++++----- .../azure/storage/blob/ContainerSASPermission.java | 10 +++++----- 12 files changed, 61 insertions(+), 58 deletions(-) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobContainerSasPermission.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobContainerSasPermission.java index 7f13fe9f8ef0..71387cc63efd 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobContainerSasPermission.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobContainerSasPermission.java @@ -45,15 +45,15 @@ public BlobContainerSasPermission() { * Creates an {@code BlobContainerSasPermission} from the specified permissions string. This method will throw an * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. * - * @param permString A {@code String} which represents the {@code BlobContainerSasPermission}. + * @param permissionString A {@code String} which represents the {@code BlobContainerSasPermission}. * @return A {@code BlobContainerSasPermission} generated from the given {@code String}. - * @throws IllegalArgumentException If {@code permString} contains a character other than r, a, c, w, d, x, l or t. + * @throws IllegalArgumentException If {@code permissionString} contains a character other than r, a, c, w, d, x, l or t. */ - public static BlobContainerSasPermission parse(String permString) { + public static BlobContainerSasPermission parse(String permissionString) { BlobContainerSasPermission permissions = new BlobContainerSasPermission(); - for (int i = 0; i < permString.length(); i++) { - char c = permString.charAt(i); + for (int i = 0; i < permissionString.length(); i++) { + char c = permissionString.charAt(i); switch (c) { case 'r': permissions.readPermission = true; @@ -88,7 +88,7 @@ public static BlobContainerSasPermission parse(String permString) { default: throw new IllegalArgumentException( String.format(Locale.ROOT, Constants.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, - "Permissions", permString, c)); + "Permissions", permissionString, c)); } } return permissions; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobSasPermission.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobSasPermission.java index cbf287804af0..a4b55cd4d914 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobSasPermission.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobSasPermission.java @@ -45,16 +45,16 @@ public BlobSasPermission() { * Creates a {@code BlobSasPermission} from the specified permissions string. This method will throw an * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. * - * @param permString A {@code String} which represents the {@code BlobSasPermission}. + * @param permissionString A {@code String} which represents the {@code BlobSasPermission}. * @return A {@code BlobSasPermission} generated from the given {@code String}. - * @throws IllegalArgumentException If {@code permString} contains a character other than r, a, c, w, d, x, l, t, + * @throws IllegalArgumentException If {@code permissionString} contains a character other than r, a, c, w, d, x, l, t, * m, or e. */ - public static BlobSasPermission parse(String permString) { + public static BlobSasPermission parse(String permissionString) { BlobSasPermission permissions = new BlobSasPermission(); - for (int i = 0; i < permString.length(); i++) { - char c = permString.charAt(i); + for (int i = 0; i < permissionString.length(); i++) { + char c = permissionString.charAt(i); switch (c) { case 'r': permissions.readPermission = true; @@ -89,7 +89,7 @@ public static BlobSasPermission parse(String permString) { default: throw new IllegalArgumentException( String.format(Locale.ROOT, Constants.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, - "Permissions", permString, c)); + "Permissions", permissionString, c)); } } return permissions; diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasPermission.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasPermission.java index ed22c6232b1b..334006a3daed 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasPermission.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasPermission.java @@ -55,18 +55,18 @@ public AccountSasPermission() { * Creates an {@link AccountSasPermission} from the specified permissions string. This method will throw an {@link * IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. * - * @param permString A {@code String} which represents the {@link AccountSasPermission}. + * @param permissionString A {@code String} which represents the {@link AccountSasPermission}. * * @return An {@link AccountSasPermission} object generated from the given {@link String}. * - * @throws IllegalArgumentException If {@code permString} contains a character other than r, w, d, x, l, a, c, u, p, + * @throws IllegalArgumentException If {@code permissionString} contains a character other than r, w, d, x, l, a, c, u, p, * t or f. */ - public static AccountSasPermission parse(String permString) { + public static AccountSasPermission parse(String permissionString) { AccountSasPermission permissions = new AccountSasPermission(); - for (int i = 0; i < permString.length(); i++) { - char c = permString.charAt(i); + for (int i = 0; i < permissionString.length(); i++) { + char c = permissionString.charAt(i); switch (c) { case 'r': permissions.readPermission = true; @@ -104,7 +104,7 @@ public static AccountSasPermission parse(String permString) { default: throw new IllegalArgumentException( String.format(Locale.ROOT, Constants.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, - "Permissions", permString, c)); + "Permissions", permissionString, c)); } } return permissions; diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeSignedIdentifier.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeSignedIdentifier.java index b576740bc570..098732f2de02 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeSignedIdentifier.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/models/DataLakeSignedIdentifier.java @@ -3,9 +3,12 @@ package com.azure.storage.file.datalake.models; +import com.azure.core.annotation.Fluent; + /** * signed identifier. */ +@Fluent public class DataLakeSignedIdentifier { /* * a unique id diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/sas/FileSystemSasPermission.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/sas/FileSystemSasPermission.java index ab6391aac793..6e74d64abac5 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/sas/FileSystemSasPermission.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/sas/FileSystemSasPermission.java @@ -45,16 +45,16 @@ public FileSystemSasPermission() { * Creates an {@code FileSystemSasPermission} from the specified permissions string. This method will throw an * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. * - * @param permString A {@code String} which represents the {@code FileSystemSasPermission}. + * @param permissionString A {@code String} which represents the {@code FileSystemSasPermission}. * @return A {@code FileSystemSasPermission} generated from the given {@code String}. - * @throws IllegalArgumentException If {@code permString} contains a character other than r, a, c, w, d, l, m, e, + * @throws IllegalArgumentException If {@code permissionString} contains a character other than r, a, c, w, d, l, m, e, * o, or p. */ - public static FileSystemSasPermission parse(String permString) { + public static FileSystemSasPermission parse(String permissionString) { FileSystemSasPermission permissions = new FileSystemSasPermission(); - for (int i = 0; i < permString.length(); i++) { - char c = permString.charAt(i); + for (int i = 0; i < permissionString.length(); i++) { + char c = permissionString.charAt(i); switch (c) { case 'r': permissions.readPermission = true; @@ -89,7 +89,7 @@ public static FileSystemSasPermission parse(String permString) { default: throw new IllegalArgumentException( String.format(Locale.ROOT, Constants.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, - "Permissions", permString, c)); + "Permissions", permissionString, c)); } } return permissions; diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/sas/PathSasPermission.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/sas/PathSasPermission.java index 872907b26c5f..80bd2028d24e 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/sas/PathSasPermission.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/sas/PathSasPermission.java @@ -46,16 +46,16 @@ public PathSasPermission() { * Creates a {@code PathSasPermission} from the specified permissions string. This method will throw an * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. * - * @param permString A {@code String} which represents the {@code PathSasPermission}. + * @param permissionString A {@code String} which represents the {@code PathSasPermission}. * @return A {@code PathSasPermission} generated from the given {@code String}. - * @throws IllegalArgumentException If {@code permString} contains a character other than r, a, c, w, d, l, m, e, + * @throws IllegalArgumentException If {@code permissionString} contains a character other than r, a, c, w, d, l, m, e, * o, or p. */ - public static PathSasPermission parse(String permString) { + public static PathSasPermission parse(String permissionString) { PathSasPermission permissions = new PathSasPermission(); - for (int i = 0; i < permString.length(); i++) { - char c = permString.charAt(i); + for (int i = 0; i < permissionString.length(); i++) { + char c = permissionString.charAt(i); switch (c) { case 'r': permissions.readPermission = true; @@ -90,7 +90,7 @@ public static PathSasPermission parse(String permString) { default: throw new IllegalArgumentException( String.format(Locale.ROOT, Constants.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, - "Permissions", permString, c)); + "Permissions", permissionString, c)); } } return permissions; diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/sas/ShareFileSasPermission.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/sas/ShareFileSasPermission.java index 7f25d1463b4d..094369c02788 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/sas/ShareFileSasPermission.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/sas/ShareFileSasPermission.java @@ -41,15 +41,15 @@ public ShareFileSasPermission() { * Creates an {@code ShareFileSasPermission} from the specified permissions string. This method will throw an * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. * - * @param permString A {@code String} which represents the {@code ShareFileSasPermission}. + * @param permissionString A {@code String} which represents the {@code ShareFileSasPermission}. * @return A {@code ShareFileSasPermission} generated from the given {@code String}. - * @throws IllegalArgumentException If {@code permString} contains a character other than r, c, w, or d. + * @throws IllegalArgumentException If {@code permissionString} contains a character other than r, c, w, or d. */ - public static ShareFileSasPermission parse(String permString) { + public static ShareFileSasPermission parse(String permissionString) { ShareFileSasPermission permissions = new ShareFileSasPermission(); - for (int i = 0; i < permString.length(); i++) { - char c = permString.charAt(i); + for (int i = 0; i < permissionString.length(); i++) { + char c = permissionString.charAt(i); switch (c) { case 'r': permissions.readPermission = true; @@ -66,7 +66,7 @@ public static ShareFileSasPermission parse(String permString) { default: throw new IllegalArgumentException( String.format(Locale.ROOT, Constants.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, - "Permissions", permString, c)); + "Permissions", permissionString, c)); } } return permissions; diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/sas/ShareSasPermission.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/sas/ShareSasPermission.java index f667664909ad..89b7bf4dceb6 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/sas/ShareSasPermission.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/sas/ShareSasPermission.java @@ -37,7 +37,7 @@ public ShareSasPermission() { * * @param permissionString A {@code String} which represents the {@code ShareSasPermission}. * @return A {@code ShareSasPermission} generated from the given {@code String}. - * @throws IllegalArgumentException If {@code permString} contains a character other than r, c, w, d, or l. + * @throws IllegalArgumentException If {@code permissionString} contains a character other than r, c, w, d, or l. */ public static ShareSasPermission parse(String permissionString) { ShareSasPermission permissions = new ShareSasPermission(); diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/sas/QueueSasPermission.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/sas/QueueSasPermission.java index 5ef5fadf34c3..994aca5dce9c 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/sas/QueueSasPermission.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/sas/QueueSasPermission.java @@ -42,15 +42,15 @@ public QueueSasPermission() { * Creates a {@link QueueSasPermission} from the specified permissions string. This method will throw an * {@link IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. * - * @param permString A {@code String} which represents the {@code QueueSasPermission}. + * @param permissionString A {@code String} which represents the {@code QueueSasPermission}. * @return A {@code QueueSasPermission} generated from the given {@code String}. - * @throws IllegalArgumentException If {@code permString} contains a character other than r, a, u, or p. + * @throws IllegalArgumentException If {@code permissionString} contains a character other than r, a, u, or p. */ - public static QueueSasPermission parse(String permString) { + public static QueueSasPermission parse(String permissionString) { QueueSasPermission permissions = new QueueSasPermission(); - for (int i = 0; i < permString.length(); i++) { - char c = permString.charAt(i); + for (int i = 0; i < permissionString.length(); i++) { + char c = permissionString.charAt(i); switch (c) { case 'r': permissions.readPermission = true; @@ -67,7 +67,7 @@ public static QueueSasPermission parse(String permString) { default: throw new IllegalArgumentException( String.format(Locale.ROOT, Constants.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, - "Permissions", permString, c)); + "Permissions", permissionString, c)); } } return permissions; diff --git a/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AccountSASPermission.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AccountSASPermission.java index 6740b0bbfe9c..d1415c7edd58 100644 --- a/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AccountSASPermission.java +++ b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AccountSASPermission.java @@ -40,16 +40,16 @@ public AccountSASPermission() { * Creates an {@code AccountSASPermission} from the specified permissions string. This method will throw an * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. * - * @param permString + * @param permissionString * A {@code String} which represents the {@code SharedAccessAccountPermissions}. * * @return An {@code AccountSASPermission} object generated from the given {@code String}. */ - public static AccountSASPermission parse(String permString) { + public static AccountSASPermission parse(String permissionString) { AccountSASPermission permissions = new AccountSASPermission(); - for (int i = 0; i < permString.length(); i++) { - char c = permString.charAt(i); + for (int i = 0; i < permissionString.length(); i++) { + char c = permissionString.charAt(i); switch (c) { case 'r': permissions.read = true; @@ -77,7 +77,7 @@ public static AccountSASPermission parse(String permString) { break; default: throw new IllegalArgumentException( - String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Permissions", permString, c)); + String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Permissions", permissionString, c)); } } return permissions; diff --git a/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobSASPermission.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobSASPermission.java index a3188ddf8604..4fdf6ed31385 100644 --- a/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobSASPermission.java +++ b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobSASPermission.java @@ -34,16 +34,16 @@ public BlobSASPermission() { * Creates a {@code BlobSASPermission} from the specified permissions string. This method will throw an * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. * - * @param permString + * @param permissionString * A {@code String} which represents the {@code BlobSASPermission}. * * @return A {@code BlobSASPermission} generated from the given {@code String}. */ - public static BlobSASPermission parse(String permString) { + public static BlobSASPermission parse(String permissionString) { BlobSASPermission permissions = new BlobSASPermission(); - for (int i = 0; i < permString.length(); i++) { - char c = permString.charAt(i); + for (int i = 0; i < permissionString.length(); i++) { + char c = permissionString.charAt(i); switch (c) { case 'r': permissions.read = true; @@ -62,7 +62,7 @@ public static BlobSASPermission parse(String permString) { break; default: throw new IllegalArgumentException( - String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Permissions", permString, c)); + String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Permissions", permissionString, c)); } } return permissions; diff --git a/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ContainerSASPermission.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ContainerSASPermission.java index 2875a042f05d..9aebc7ecc04e 100644 --- a/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ContainerSASPermission.java +++ b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ContainerSASPermission.java @@ -36,16 +36,16 @@ public ContainerSASPermission() { * Creates an {@code ContainerSASPermission} from the specified permissions string. This method will throw an * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. * - * @param permString + * @param permissionString * A {@code String} which represents the {@code ContainerSASPermission}. * * @return A {@code ContainerSASPermission} generated from the given {@code String}. */ - public static ContainerSASPermission parse(String permString) { + public static ContainerSASPermission parse(String permissionString) { ContainerSASPermission permissions = new ContainerSASPermission(); - for (int i = 0; i < permString.length(); i++) { - char c = permString.charAt(i); + for (int i = 0; i < permissionString.length(); i++) { + char c = permissionString.charAt(i); switch (c) { case 'r': permissions.read = true; @@ -67,7 +67,7 @@ public static ContainerSASPermission parse(String permString) { break; default: throw new IllegalArgumentException( - String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Permissions", permString, c)); + String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Permissions", permissionString, c)); } } return permissions; From 19b1dde032ff7279ace387f6339681819ed308d9 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Fri, 4 Jun 2021 10:23:41 -0700 Subject: [PATCH 40/53] Metrics Advisor SDK APIs aligning with most recent swagger updates (#21936) * Adding more doc to FeedType types and correcting typo in addFeedback API name * Using the name Sql, MongoDb, InfluxDb * Initial impl of credential entities and its integration with data feed * Apply Fluent, Immutable as appropriate * Updating listMetricEnrichedSeriesData signature to take detectionId as first argument * Renaming listAnomaliesForAlert and listAnomaliesForDetectionConfig to listAnomalies * Adding ClientOptions * Renaming listIncidentsForAlert and listIncidentsForDetectionConfig to listIncidents * Adding DimensionKey::get(..) and renaming TOPN enum-value to TOP_N * Add options overload API's * revert DataFeedIngestionOption changes * Updating BoundaryDirection, DataFeedRollupType, DataFeedSourceType and SingleBoundaryDirection to ExpandableStringEnum * Adding doc for DataFeedSource abstract type, renaming AzureCosmosDataFeedSource to AzureCosmosDbDataFeedSource, deleting unused ElasticsearchDataFeedSource and HttpRequestDataFeedSource * Removing setSubscriptionKey() and setApiKey(), instead adding an update method to atomically update the keys * MA Credentials: Removing Entity suffix and adding DataSource prefix * Rename ErrorCode to MetricsAdvisorErrorCode * update listDataFeedIngestionStatus * Addressing feedback for the last commit (Fixingspotbug and checkstyle) * consider datasource prefix for credential as one word (archfeedback) * Renaming DataSourceCredentialType to DatasourceCredentialType * Adding tests for Data Source Credentials. Rename userfacing type DataSourceAuthenticationType to DatasourceAuthenticationType (Datasource as one word) * Adding junit tests for data source cred async apis * Adding sync tests for Data Source Credentials and recordings * Adding samples and code snippets for Credential Entity API * Adding test skeleton for associating cred to datafeed * Use single word datasource for DataSourceDataLakeGen2SharedKey * Removing unsupported value 'Secondly' from Granularity * Hiding clientSecret getter from AzureLogAnalyticsDataFeedSource * Finishing Cred association with DataFeedSources * Completing tests for Cred association with DataFeedSources * Adding test recordings for Cred to DataFeedSource association * Adding cred association to AzureLogAnalytics DataFeed * Add valid cred for log analytics * rename to updateKey * rename env vars * Moving admin models to admininstration.models package * Removing equality assert on LogAna ids * Update Changelog (#7) * Fix pipeline error - export admin models (#8) * Moving MetricsAdvisorServiceVersion to root package * Override setDimensionFilter in Feedback types to ensure fluent chain * Adding addFeedbackWithResponse in sync client * Use the param name credentialId consistently, removing unsupported connectionstring cred from data-explorer * Rename DATA_LAKE_GEN2SHARED_KEY enum-val to DATA_LAKE_GEN2_SHARED_KEY, use DataFeedRollupSettings::rollupIdentificationValue param name consiistently * Use from prefix (instead of using prefix) for all factory methods to create data-source with credentials * Introduced MetricsAdvisorKeys that composes subscription and api key * Renaming error types to MetricsAdvisorError and MetricsAdvisorResponseException * update module info and add final Co-authored-by: samvaity Co-authored-by: Sameeksha Vaity --- .../perf/AnomaliesListTest.java | 4 +- .../perf/IncidentsListTest.java | 11 +- .../azure-ai-metricsadvisor/CHANGELOG.md | 15 +- .../MetricsAdvisorAsyncClient.java | 240 +++++- .../metricsadvisor/MetricsAdvisorClient.java | 111 +-- .../MetricsAdvisorClientBuilder.java | 36 +- .../MetricsAdvisorServiceVersion.java | 2 +- ...tricsAdvisorAdministrationAsyncClient.java | 393 +++++++++- .../MetricsAdvisorAdministrationClient.java | 205 ++++- ...icsAdvisorAdministrationClientBuilder.java | 56 +- .../models/AnomalyAlertConfiguration.java | 28 +- .../models/AnomalyDetectionConfiguration.java | 5 +- .../models/AnomalyDetectorDirection.java | 2 +- .../models/AnomalySeverity.java | 2 +- .../AzureAppInsightsDataFeedSource.java | 2 +- .../models/AzureBlobDataFeedSource.java | 125 +++ .../models/AzureCosmosDbDataFeedSource.java} | 37 +- .../AzureDataExplorerDataFeedSource.java | 157 ++++ ...zureDataLakeStorageGen2DataFeedSource.java | 243 ++++++ .../models/AzureEventHubsDataFeedSource.java | 26 +- .../AzureLogAnalyticsDataFeedSource.java | 209 +++++ .../models/AzureTableDataFeedSource.java | 26 +- .../models/BoundaryDirection.java | 44 ++ .../models/ChangeThresholdCondition.java | 2 +- .../{ => administration}/models/DataFeed.java | 2 +- .../models/DataFeedAccessMode.java | 2 +- .../models/DataFeedAutoRollUpMethod.java | 2 +- .../models/DataFeedDimension.java | 2 +- .../models/DataFeedGranularity.java | 2 +- .../models/DataFeedGranularityType.java | 7 +- .../models/DataFeedIngestionProgress.java | 2 +- .../models/DataFeedIngestionSettings.java | 2 +- .../models/DataFeedIngestionStatus.java | 2 +- .../models/DataFeedMetric.java | 2 +- .../DataFeedMissingDataPointFillSettings.java | 2 +- .../DataFeedMissingDataPointFillType.java | 2 +- .../models/DataFeedOptions.java | 2 +- .../models/DataFeedRollupSettings.java | 8 +- .../models/DataFeedRollupType.java | 46 ++ .../models/DataFeedSchema.java | 2 +- .../administration/models/DataFeedSource.java | 29 + .../models/DataFeedSourceType.java | 97 +++ .../models/DataFeedStatus.java | 2 +- .../models/DatasourceAuthenticationType.java | 47 ++ .../models/DatasourceCredentialEntity.java | 34 + .../DatasourceDataLakeGen2SharedKey.java | 100 +++ .../models/DatasourceServicePrincipal.java | 146 ++++ .../DatasourceServicePrincipalInKeyVault.java | 178 +++++ .../DatasourceSqlServerConnectionString.java | 100 +++ .../models/DetectionConditionsOperator.java | 2 +- .../models/EmailNotificationHook.java | 5 +- .../models/HardThresholdCondition.java | 2 +- .../models/IngestionStatusType.java | 2 +- .../ListAnomalyAlertConfigsOptions.java | 2 +- .../models/ListCredentialEntityOptions.java | 59 ++ .../models/ListDataFeedFilter.java | 2 +- .../models/ListDataFeedIngestionOptions.java | 5 +- .../models/ListDataFeedOptions.java | 2 +- .../models/ListHookOptions.java | 5 +- ...tMetricAnomalyDetectionConfigsOptions.java | 2 +- .../models/MetricAnomalyAlertConditions.java | 5 +- .../MetricAnomalyAlertConfiguration.java | 2 +- ...ricAnomalyAlertConfigurationsOperator.java | 2 +- .../models/MetricAnomalyAlertScope.java | 5 +- .../models/MetricAnomalyAlertScopeType.java | 4 +- .../MetricAnomalyAlertSnoozeCondition.java | 2 +- .../models/MetricBoundaryCondition.java | 4 +- .../MetricSeriesGroupDetectionCondition.java | 3 +- .../MetricSingleSeriesDetectionCondition.java | 3 +- .../MetricWholeSeriesDetectionCondition.java | 2 +- .../models/MongoDbDataFeedSource.java} | 34 +- .../models/MySqlDataFeedSource.java | 26 +- .../models/NotificationHook.java | 2 +- .../models/PostgreSqlDataFeedSource.java | 26 +- .../models/SeverityCondition.java | 2 +- .../models/SingleBoundaryDirection.java | 40 + .../models/SmartDetectionCondition.java | 2 +- .../models/SnoozeScope.java | 2 +- .../models/SqlServerDataFeedSource.java | 173 ++++ .../models/SuppressCondition.java | 2 +- .../models/TopNGroupScope.java | 2 +- .../models/WebNotificationHook.java | 4 +- .../administration/models/package-info.java | 8 + ...iceMetricsAdvisorRestAPIOpenAPIV2Impl.java | 738 +++++++++--------- .../models/AnomalyProperty.java | 2 +- .../models/ChangeThresholdConditionPatch.java | 2 +- .../implementation/models/DataFeedDetail.java | 4 +- .../models/DimensionGroupConfiguration.java | 6 +- .../implementation/models/Granularity.java | 3 - .../models/HardThresholdConditionPatch.java | 2 +- .../models/IncidentProperty.java | 2 +- .../models/IngestionStatusList.java | 2 +- .../models/MetricAlertingConfiguration.java | 6 +- .../models/SeriesConfiguration.java | 6 +- .../models/SeverityFilterCondition.java | 2 +- .../models/SmartDetectionConditionPatch.java | 2 +- .../models/WholeMetricConfiguration.java | 6 +- .../util/AlertConfigurationTransforms.java | 40 +- .../util/AnomalyAlertConfigurationHelper.java | 2 +- .../AnomalyDetectionConfigurationHelper.java | 2 +- .../implementation/util/AnomalyHelper.java | 2 +- .../util/AnomalyTransforms.java | 2 +- .../util/AzureBlobDataFeedSourceAccessor.java | 35 + .../AzureCosmosDbDataFeedSourceAccessor.java | 34 + ...ureDataExplorerDataFeedSourceAccessor.java | 34 + ...LakeStorageGen2DataFeedSourceAccessor.java | 35 + .../AzureEventHubsDataFeedSourceAccessor.java | 35 + ...ureLogAnalyticsDataFeedSourceAccessor.java | 35 + .../AzureTableDataFeedSourceAccessor.java | 35 + .../implementation/util/DataFeedHelper.java | 6 +- .../util/DataFeedTransforms.java | 380 ++++++--- .../DataSourceCredentialEntityTransforms.java | 215 +++++ ...taSourceDataLakeGen2SharedKeyAccessor.java | 39 + .../DataSourceServicePrincipalAccessor.java | 39 + ...rceServicePrincipalInKeyVaultAccessor.java | 39 + ...urceSqlServerConnectionStringAccessor.java | 39 + .../DetectionConfigurationTransforms.java | 22 +- .../implementation/util/HookHelper.java | 2 +- .../implementation/util/HookTransforms.java | 6 +- .../implementation/util/IncidentHelper.java | 2 +- .../util/InfluxDbDataFeedSourceAccessor.java | 35 + .../util/MetricAnomalyFeedbackHelper.java | 2 +- .../util/MetricBoundaryConditionHelper.java | 4 +- .../util/MongoDbDataFeedSourceAccessor.java | 34 + .../util/MySqlDataFeedSourceAccessor.java | 35 + .../PostgreSqlDataFeedSourceAccessor.java | 34 + .../util/SqlServerDataFeedSourceAccessor.java | 34 + .../models/AnomalyIncident.java | 25 +- .../models/AzureBlobDataFeedSource.java | 71 -- .../AzureDataExplorerDataFeedSource.java | 53 -- ...zureDataLakeStorageGen2DataFeedSource.java | 100 --- .../AzureLogAnalyticsDataFeedSource.java | 104 --- .../models/BoundaryDirection.java | 22 - .../models/DataFeedRollupType.java | 56 -- .../metricsadvisor/models/DataFeedSource.java | 9 - .../models/DataFeedSourceType.java | 116 --- .../models/DataPointAnomaly.java | 1 + .../metricsadvisor/models/DimensionKey.java | 12 + .../models/ElasticsearchDataFeedSource.java | 84 -- .../models/HttpRequestDataFeedSource.java | 101 --- ...ource.java => InfluxDbDataFeedSource.java} | 39 +- .../models/ListAlertOptions.java | 3 + .../models/ListAnomaliesAlertedOptions.java | 3 + .../models/ListAnomaliesDetectedFilter.java | 4 + .../models/ListAnomaliesDetectedOptions.java | 3 + .../ListAnomalyDimensionValuesOptions.java | 3 + .../models/ListIncidentsAlertedOptions.java | 3 + .../models/ListIncidentsDetectedOptions.java | 3 + .../models/MetricAnomalyFeedback.java | 16 +- .../models/MetricChangePointFeedback.java | 20 +- .../models/MetricCommentFeedback.java | 20 +- .../metricsadvisor/models/MetricFeedback.java | 12 +- .../models/MetricPeriodFeedback.java | 20 +- ...rrorCode.java => MetricsAdvisorError.java} | 12 +- .../models/MetricsAdvisorKeyCredential.java | 54 +- .../models/MetricsAdvisorKeys.java | 40 + ...a => MetricsAdvisorResponseException.java} | 14 +- .../models/SQLServerDataFeedSource.java | 54 -- .../models/SingleBoundaryDirection.java | 18 - .../src/main/java/module-info.java | 2 + .../ListEnrichedSeriesAsyncSample.java | 4 +- .../ListEnrichedSeriesSample.java | 4 +- .../ListIncidentsAlertedAsyncSample.java | 2 +- .../ListIncidentsAlertedSample.java | 6 +- .../ListIncidentsDetectedAsyncSample.java | 2 +- .../ListIncidentsDetectedSample.java | 2 +- .../ListsAnomaliesForAlertsAsyncSample.java | 2 +- .../ListsAnomaliesForAlertsSample.java | 2 +- ...nomaliesForDetectionConfigAsyncSample.java | 4 +- ...istsAnomaliesForDetectionConfigSample.java | 4 +- .../MetricFeedbackAsyncSample.java | 2 +- ...AdvisorAsyncClientJavaDocCodeSnippets.java | 204 ++++- ...tricsAdvisorClientJavaDocCodeSnippets.java | 122 ++- .../ai/metricsadvisor/ReadmeSamples.java | 66 +- ...malyDetectionConfigurationAsyncSample.java | 22 +- .../AnomalyDetectionConfigurationSample.java | 24 +- .../DataFeedIngestionAsyncSample.java | 2 +- .../DataFeedIngestionSample.java | 6 +- .../administration/DatafeedAsyncSample.java | 20 +- .../administration/DatafeedSample.java | 20 +- .../DatasourceCredentialAsyncSample.java | 136 ++++ .../DatasourceCredentialSample.java | 109 +++ .../administration/HookAsyncSample.java | 6 +- .../administration/HookSample.java | 6 +- ...trationAsyncClientJavaDocCodeSnippets.java | 359 ++++++++- ...ministrationClientJavaDocCodeSnippets.java | 371 +++++++-- ...omalyAlertConfigOperationsAsyncSample.java | 16 +- ...icsAnomalyAlertConfigOperationsSample.java | 16 +- .../ai/metricsadvisor/AlertAsyncTest.java | 1 - .../azure/ai/metricsadvisor/AlertTest.java | 1 - .../ai/metricsadvisor/AlertTestBase.java | 1 - .../metricsadvisor/AnomalyAlertAsyncTest.java | 17 +- .../ai/metricsadvisor/AnomalyAlertTest.java | 19 +- .../metricsadvisor/AnomalyAlertTestBase.java | 12 +- .../AnomalyDimensionValuesAsyncTest.java | 1 - .../AnomalyDimensionValuesTest.java | 1 - .../AnomalyDimensionValuesTestBase.java | 1 - .../AnomalyForAlertTestBase.java | 1 - .../AnomalyForDetectionConfigTestBase.java | 3 +- .../AnomalyIncidentDetectedAsyncTest.java | 3 +- .../AnomalyIncidentDetectedTest.java | 3 +- .../AnomalyIncidentForAlertAsyncTest.java | 3 +- .../AnomalyIncidentForAlertTest.java | 7 +- .../AnomalyIncidentRootCauseAsyncTest.java | 1 - .../AnomalyIncidentRootCauseTest.java | 1 - .../ai/metricsadvisor/CredentialsTests.java | 20 +- .../DataFeedAsyncClientTest.java | 53 +- .../ai/metricsadvisor/DataFeedClientTest.java | 65 +- .../DataFeedIngestionOperationAsyncTest.java | 5 +- .../DataFeedIngestionOperationTest.java | 5 +- .../DataFeedIngestionOperationTestBase.java | 7 +- .../ai/metricsadvisor/DataFeedTestBase.java | 393 +++++----- .../DataFeedWithCredentialsAsyncTest.java | 493 ++++++++++++ .../DataFeedWithCredentialsTest.java | 382 +++++++++ .../DataFeedWithCredentialsTestBase.java | 162 ++++ .../DatasourceCredentialAsyncTest.java | 187 +++++ .../DatasourceCredentialTest.java | 156 ++++ .../DatasourceCredentialTestBase.java | 142 ++++ .../DetectionConfigurationAsyncTest.java | 9 +- .../DetectionConfigurationTest.java | 10 +- .../DetectionConfigurationTestBase.java | 40 +- .../ai/metricsadvisor/FeedbackAsyncTest.java | 17 +- .../azure/ai/metricsadvisor/FeedbackTest.java | 1 - .../ai/metricsadvisor/FeedbackTestBase.java | 1 - .../IncidentDetectedTestBase.java | 1 - .../IncidentForAlertTestBase.java | 1 - .../MetricEnrichedSeriesDataAsyncTest.java | 4 +- .../MetricEnrichedSeriesDataTest.java | 4 +- .../MetricEnrichedSeriesDataTestBase.java | 1 - .../MetricsAdvisorAdminClientBuilderTest.java | 1 - ...csAdvisorAdministrationClientTestBase.java | 15 +- .../MetricsAdvisorClientBuilderTest.java | 1 - .../MetricsAdvisorClientTestBase.java | 1 - .../MetricsSeriesAsyncTest.java | 1 - .../ai/metricsadvisor/MetricsSeriesTest.java | 1 - .../NotificationHookAsyncTest.java | 5 +- .../metricsadvisor/NotificationHookTest.java | 5 +- .../NotificationHookTestBase.java | 7 +- .../azure/ai/metricsadvisor/TestUtils.java | 45 +- ...entTest.createLogAnalyticsDataFeed[1].json | 40 +- ...entTest.createLogAnalyticsDataFeed[1].json | 40 +- ...edentialsAsyncTest.testBlobStorage[1].json | 108 +++ ...dentialsAsyncTest.testDataExplorer[1].json | 316 ++++++++ ...dentialsAsyncTest.testDataLakeGen2[1].json | 377 +++++++++ ...CredentialsAsyncTest.testSqlServer[1].json | 420 ++++++++++ ...ithCredentialsTest.testBlobStorage[1].json | 108 +++ ...thCredentialsTest.testDataExplorer[1].json | 316 ++++++++ ...thCredentialsTest.testDataLakeGen2[1].json | 377 +++++++++ ...dWithCredentialsTest.testSqlServer[1].json | 420 ++++++++++ ...ncTest.createDataLakeGen2SharedKey[1].json | 65 ++ ...yncTest.createServicePrincipalInKV[1].json | 65 ++ ...alAsyncTest.createServicePrincipal[1].json | 65 ++ ...syncTest.createSqlConnectionString[1].json | 65 ++ ...Test.testListDataSourceCredentials[1].json | 147 ++++ ...alTest.createDataLakeGen2SharedKey[1].json | 65 ++ ...dentialTest.createServicePrincipal[1].json | 65 ++ ...tialTest.createSqlConnectionString[1].json | 65 ++ ...Test.testListDataSourceCredentials[1].json | 147 ++++ .../azure-ai-metricsadvisor/swagger/README.md | 26 +- sdk/metricsadvisor/tests.yml | 5 +- 260 files changed, 10995 insertions(+), 2545 deletions(-) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{models => }/MetricsAdvisorServiceVersion.java (94%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/AnomalyAlertConfiguration.java (86%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/AnomalyDetectionConfiguration.java (97%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/AnomalyDetectorDirection.java (95%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/AnomalySeverity.java (95%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/AzureAppInsightsDataFeedSource.java (96%) create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureBlobDataFeedSource.java rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{models/AzureCosmosDataFeedSource.java => administration/models/AzureCosmosDbDataFeedSource.java} (60%) create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataExplorerDataFeedSource.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataLakeStorageGen2DataFeedSource.java rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/AzureEventHubsDataFeedSource.java (66%) create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureLogAnalyticsDataFeedSource.java rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/AzureTableDataFeedSource.java (71%) create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/BoundaryDirection.java rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/ChangeThresholdCondition.java (98%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeed.java (99%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedAccessMode.java (94%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedAutoRollUpMethod.java (96%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedDimension.java (96%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedGranularity.java (96%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedGranularityType.java (90%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedIngestionProgress.java (96%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedIngestionSettings.java (98%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedIngestionStatus.java (96%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedMetric.java (97%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedMissingDataPointFillSettings.java (96%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedMissingDataPointFillType.java (95%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedOptions.java (98%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedRollupSettings.java (92%) create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedRollupType.java rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedSchema.java (97%) create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSource.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSourceType.java rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DataFeedStatus.java (95%) create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceAuthenticationType.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceCredentialEntity.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceDataLakeGen2SharedKey.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipal.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipalInKeyVault.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceSqlServerConnectionString.java rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/DetectionConditionsOperator.java (95%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/EmailNotificationHook.java (97%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/HardThresholdCondition.java (98%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/IngestionStatusType.java (97%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/ListAnomalyAlertConfigsOptions.java (96%) create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListCredentialEntityOptions.java rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/ListDataFeedFilter.java (98%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/ListDataFeedIngestionOptions.java (95%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/ListDataFeedOptions.java (97%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/ListHookOptions.java (94%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/ListMetricAnomalyDetectionConfigsOptions.java (96%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/MetricAnomalyAlertConditions.java (95%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/MetricAnomalyAlertConfiguration.java (98%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/MetricAnomalyAlertConfigurationsOperator.java (97%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/MetricAnomalyAlertScope.java (96%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/MetricAnomalyAlertScopeType.java (91%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/MetricAnomalyAlertSnoozeCondition.java (97%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/MetricBoundaryCondition.java (98%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/MetricSeriesGroupDetectionCondition.java (98%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/MetricSingleSeriesDetectionCondition.java (97%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/MetricWholeSeriesDetectionCondition.java (98%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{models/MongoDBDataFeedSource.java => administration/models/MongoDbDataFeedSource.java} (60%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/MySqlDataFeedSource.java (65%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/NotificationHook.java (96%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/PostgreSqlDataFeedSource.java (64%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/SeverityCondition.java (96%) create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SingleBoundaryDirection.java rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/SmartDetectionCondition.java (97%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/SnoozeScope.java (94%) create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SqlServerDataFeedSource.java rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/SuppressCondition.java (96%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/TopNGroupScope.java (97%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/{ => administration}/models/WebNotificationHook.java (97%) create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/package-info.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureBlobDataFeedSourceAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureCosmosDbDataFeedSourceAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataExplorerDataFeedSourceAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataLakeStorageGen2DataFeedSourceAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureEventHubsDataFeedSourceAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureLogAnalyticsDataFeedSourceAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureTableDataFeedSourceAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceCredentialEntityTransforms.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceDataLakeGen2SharedKeyAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalInKeyVaultAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceSqlServerConnectionStringAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/InfluxDbDataFeedSourceAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MongoDbDataFeedSourceAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MySqlDataFeedSourceAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/PostgreSqlDataFeedSourceAccessor.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/SqlServerDataFeedSourceAccessor.java delete mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureBlobDataFeedSource.java delete mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataExplorerDataFeedSource.java delete mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataLakeStorageGen2DataFeedSource.java delete mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureLogAnalyticsDataFeedSource.java delete mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/BoundaryDirection.java delete mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedRollupType.java delete mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSource.java delete mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSourceType.java delete mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ElasticsearchDataFeedSource.java delete mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/HttpRequestDataFeedSource.java rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/{InfluxDBDataFeedSource.java => InfluxDbDataFeedSource.java} (69%) rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/{ErrorCode.java => MetricsAdvisorError.java} (80%) create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeys.java rename sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/{ErrorCodeException.java => MetricsAdvisorResponseException.java} (61%) delete mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SQLServerDataFeedSource.java delete mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SingleBoundaryDirection.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialAsyncSample.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialSample.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsAsyncTest.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTest.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTestBase.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialAsyncTest.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTest.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTestBase.java create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testBlobStorage[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testDataExplorer[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testDataLakeGen2[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testSqlServer[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testBlobStorage[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataExplorer[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataLakeGen2[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testSqlServer[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createDataLakeGen2SharedKey[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipalInKV[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipal[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createSqlConnectionString[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.testListDataSourceCredentials[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createDataLakeGen2SharedKey[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createServicePrincipal[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createSqlConnectionString[1].json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.testListDataSourceCredentials[1].json diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/AnomaliesListTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/AnomaliesListTest.java index 0115262eb776..0fc2f72629e2 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/AnomaliesListTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/AnomaliesListTest.java @@ -25,7 +25,7 @@ public AnomaliesListTest(PerfStressOptions options) { @Override public void run() { super.metricsAdvisorClient - .listAnomaliesForAlert(super.alertConfigId, + .listAnomalies(super.alertConfigId, super.alertId, new ListAnomaliesAlertedOptions(), Context.NONE) @@ -38,7 +38,7 @@ public void run() { @Override public Mono runAsync() { return super.metricsAdvisorAsyncClient - .listAnomaliesForAlert(super.alertConfigId, + .listAnomalies(super.alertConfigId, super.alertId, new ListAnomaliesAlertedOptions()) .take(super.maxListElements) diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/IncidentsListTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/IncidentsListTest.java index c7f0b7369b57..0c2395636c5b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/IncidentsListTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor-perf/src/main/java/com/azure/ai/metricsadvisor/perf/IncidentsListTest.java @@ -3,7 +3,6 @@ package com.azure.ai.metricsadvisor.perf; -import com.azure.ai.metricsadvisor.models.ListIncidentsAlertedOptions; import com.azure.ai.metricsadvisor.perf.core.ServiceTest; import com.azure.perf.test.core.PerfStressOptions; import reactor.core.publisher.Mono; @@ -24,9 +23,8 @@ public IncidentsListTest(PerfStressOptions options) { @Override public void run() { super.metricsAdvisorClient - .listIncidentsForAlert(super.alertConfigId, - super.alertId, - new ListIncidentsAlertedOptions()) + .listIncidents(super.alertConfigId, + super.alertId) .stream() .limit(super.maxListElements) .forEach(incident -> { @@ -36,9 +34,8 @@ public void run() { @Override public Mono runAsync() { return super.metricsAdvisorAsyncClient - .listIncidentsForAlert(super.alertConfigId, - super.alertId, - new ListIncidentsAlertedOptions()) + .listIncidents(super.alertConfigId, + super.alertId) .take(super.maxListElements) .then(); } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md b/sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md index a9e105181d07..70a0a0e8ab0c 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md @@ -3,11 +3,18 @@ ## 1.0.0-beta.4 (Unreleased) ### Features added -- Added support for Azure Log Analytics DataFeed source. +- Added support for Azure Log Analytics DataFeed source +- Added data source credential API support to client +- Added authentication type support for data feed +- Added property `splitAlertByDimensions` to AnomalyAlertConfiguration model ### Breaking changes +- Replaced updateSubscriptionKey and updateApiKey into one method updateKey +- Deprecated support for HttpRequestDataFeed and ElasticsearchDataFeed source type +- Renamed `value` and `expectedValue` to `valueOfRootNode` and `expectedValueOfRootNode` - Renamed `top` parameter to `maxPageSize` - +- Removed granularity type DataFeedGranularityType.PerSecond as it's not supported by the service anymore. + ## 1.0.0-beta.3 (2021-02-09) - Support Azure Active Directory (AAD) authentication for Metrics Advisor clients. - Renamed method `listDimensionValuesWithAnomalies` and `ListDimensionValuesWithAnomaliesOptions`. @@ -32,7 +39,9 @@ - Renamed Data feed ingestion granularity type to `"PerMinute"` and `"PerSecond"` instead of `"Minutely"` and `"Secondly"`. - Renamed Feedback api's from `createMetricFeedback`, `getMetricFeedback` and `listMetricFeedbacks` to `addFeedback`, `getFeedback` and `listFeedback` respectively. - +- Removed `getSubscriptionKey` and `getApiKey` from `MetricsAdvisorKeyCredential` and introduced `MetricsAdvisorKeys`. +- Renamed model `ErrorCode` to `MetricsAdvisorError` and `ErrorCodeException` +to `MetricsAdvisorResponseException` ## 1.0.0-beta.1 (2020-10-07) Version 1.0.0-beta.1 is a preview of our efforts in creating a Azure Metrics Advisor client library that is developer-friendly and idiomatic to the Java ecosystem. The principles that guide diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClient.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClient.java index 24dc394539fa..c63acc3e317e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClient.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClient.java @@ -41,7 +41,7 @@ import com.azure.ai.metricsadvisor.models.DataPointAnomaly; import com.azure.ai.metricsadvisor.models.DimensionKey; import com.azure.ai.metricsadvisor.models.EnrichmentStatus; -import com.azure.ai.metricsadvisor.models.ErrorCodeException; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; import com.azure.ai.metricsadvisor.models.IncidentRootCause; import com.azure.ai.metricsadvisor.models.ListAlertOptions; import com.azure.ai.metricsadvisor.models.ListAnomaliesAlertedOptions; @@ -61,7 +61,6 @@ import com.azure.ai.metricsadvisor.models.MetricPeriodFeedback; import com.azure.ai.metricsadvisor.models.MetricSeriesData; import com.azure.ai.metricsadvisor.models.MetricSeriesDefinition; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; @@ -99,7 +98,7 @@ * @see MetricsAdvisorClientBuilder */ @ServiceClient(builder = MetricsAdvisorClientBuilder.class, isAsync = true) -public class MetricsAdvisorAsyncClient { +public final class MetricsAdvisorAsyncClient { private static final String METRICS_ADVISOR_TRACING_NAMESPACE_VALUE = "Microsoft.CognitiveServices"; final ClientLogger logger = new ClientLogger(MetricsAdvisorAsyncClient.class); @@ -117,6 +116,28 @@ public class MetricsAdvisorAsyncClient { this.service = service; } + /** + * List series definition for a metric. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricSeriesDefinitions#String-OffsetDateTime} + * + * @param metricId metric unique id. + * @param activeSince the start time for querying series ingested after this time. + * + * @return A {@link PagedFlux} of the {@link MetricSeriesDefinition metric series definitions}. + * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. + * @throws NullPointerException thrown if the {@code metricId} or {@code activeSince} + * is null. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listMetricSeriesDefinitions( + String metricId, + OffsetDateTime activeSince) { + return listMetricSeriesDefinitions(metricId, activeSince, null); + } + /** * List series definition for a metric. * @@ -129,7 +150,7 @@ public class MetricsAdvisorAsyncClient { * * @return A {@link PagedFlux} of the {@link MetricSeriesDefinition metric series definitions}. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code metricId} or {@code activeSince} * is null. */ @@ -219,7 +240,7 @@ private Mono> listMetricSeriesDefinitionNe * * @return A {@link PagedFlux} of the {@link MetricSeriesData metric series data points}. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code metricId}, {@code startTime} or {@code endTime} * is null. */ @@ -275,7 +296,7 @@ private Mono> listMetricSeriesDataInternal(Strin * * @return the {@link PagedFlux} of the dimension values for that metric. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code metricId} or {@code dimensionName} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -297,7 +318,7 @@ public PagedFlux listMetricDimensionValues( * * @return the {@link PagedFlux} of the dimension values for that metric. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code metricId} or {@code dimensionName} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -375,6 +396,29 @@ private Mono> listMetricDimensionValuesNextPageAsync(Strin null)); } + /** + * List the enrichment status for a metric. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichmentStatus#String-OffsetDateTime-OffsetDateTime} + * + * @param metricId metric unique id. + * @param startTime The start time for querying the time series data. + * @param endTime The end time for querying the time series data. + * + * @return the list of enrichment status's for the specified metric. + * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. + * @throws NullPointerException thrown if {@code metricId}, {@code startTime} and {@code endTime} + * is null. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listMetricEnrichmentStatus( + String metricId, + OffsetDateTime startTime, OffsetDateTime endTime) { + return listMetricEnrichmentStatus(metricId, startTime, endTime, null); + } + /** * List the enrichment status for a metric. * @@ -388,7 +432,7 @@ private Mono> listMetricDimensionValuesNextPageAsync(Strin * * @return the list of enrichment status's for the specified metric. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if {@code metricId}, {@code startTime} and {@code endTime} * is null. */ @@ -481,11 +525,11 @@ private Mono> listMetricEnrichmentStatusNextPage * a detection configuration. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime} * - * @param seriesKeys The time series key list, each key identifies a specific time series. * @param detectionConfigurationId The id of the configuration used to enrich the time series * identified by the keys in {@code seriesKeys}. + * @param seriesKeys The time series key list, each key identifies a specific time series. * @param startTime The start time of the time range within which the enriched data is returned. * @param endTime The end time of the time range within which the enriched data is returned. * @return The enriched time series. @@ -495,31 +539,33 @@ private Mono> listMetricEnrichmentStatusNextPage * or {@code startTime} or {@code endTime} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listMetricEnrichedSeriesData(List seriesKeys, - String detectionConfigurationId, + public PagedFlux listMetricEnrichedSeriesData(String detectionConfigurationId, + List seriesKeys, OffsetDateTime startTime, OffsetDateTime endTime) { try { - return new PagedFlux<>(() -> withContext(context -> listMetricEnrichedSeriesDataInternal(seriesKeys, - detectionConfigurationId, startTime, endTime, context)), null); + return new PagedFlux<>(() -> withContext(context -> listMetricEnrichedSeriesDataInternal( + detectionConfigurationId, + seriesKeys, + startTime, endTime, context)), null); } catch (RuntimeException e) { return new PagedFlux<>(() -> monoError(logger, e)); } } - PagedFlux listMetricEnrichedSeriesData(List seriesKeys, - String detectionConfigurationId, + PagedFlux listMetricEnrichedSeriesData(String detectionConfigurationId, + List seriesKeys, OffsetDateTime startTime, OffsetDateTime endTime, Context context) { - return new PagedFlux<>(() -> listMetricEnrichedSeriesDataInternal(seriesKeys, - detectionConfigurationId, + return new PagedFlux<>(() -> listMetricEnrichedSeriesDataInternal(detectionConfigurationId, + seriesKeys, startTime, endTime, context), null); } private Mono> - listMetricEnrichedSeriesDataInternal(List seriesKeys, - String detectionConfigurationId, + listMetricEnrichedSeriesDataInternal(String detectionConfigurationId, + List seriesKeys, OffsetDateTime startTime, OffsetDateTime endTime, Context context) { @@ -564,7 +610,31 @@ PagedFlux listMetricEnrichedSeriesData(ListCode sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-OffsetDateTime-OffsetDateTime} + * + * @param detectionConfigurationId The anomaly detection configuration id. + * @param startTime The start time of the time range within which the anomalies were detected. + * @param endTime The end time of the time range within which the anomalies were detected. + * + * @return The anomalies. + * @throws IllegalArgumentException thrown if {@code detectionConfigurationId} does not conform + * to the UUID format specification + * or {@code options.filter} is used to set severity but either min or max severity is missing. + * @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code options} + * or {@code startTime} or {@code endTime} is null. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAnomalies( + String detectionConfigurationId, + OffsetDateTime startTime, OffsetDateTime endTime) { + return listAnomalies(detectionConfigurationId, startTime, endTime, null); + } + + /** + * Fetch the anomalies identified by an anomaly detection configuration. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions} * * @param detectionConfigurationId The anomaly detection configuration id. * @param startTime The start time of the time range within which the anomalies were detected. @@ -579,7 +649,7 @@ PagedFlux listMetricEnrichedSeriesData(List listAnomaliesForDetectionConfig( + public PagedFlux listAnomalies( String detectionConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime, ListAnomaliesDetectedOptions options) { try { @@ -595,7 +665,7 @@ public PagedFlux listAnomaliesForDetectionConfig( } } - PagedFlux listAnomaliesForDetectionConfig( + PagedFlux listAnomalies( String detectionConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime, ListAnomaliesDetectedOptions options, Context context) { return new PagedFlux<>(() -> @@ -683,7 +753,29 @@ private Mono> listAnomaliesForDetectionConfigNex * Fetch the incidents identified by an anomaly detection configuration. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-OffsetDateTime-OffsetDateTime} + * + * @param detectionConfigurationId The anomaly detection configuration id. + * @param startTime The start time of the time range within which the incidents were detected. + * @param endTime The end time of the time range within which the incidents were detected. + * @return The incidents. + * @throws IllegalArgumentException thrown if {@code detectionConfigurationId} does not conform + * to the UUID format specification. + * @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code options} + * or {@code startTime} or {@code endTime} is null. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listIncidents( + String detectionConfigurationId, + OffsetDateTime startTime, OffsetDateTime endTime) { + return listIncidents(detectionConfigurationId, startTime, endTime, null); + } + + /** + * Fetch the incidents identified by an anomaly detection configuration. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions} * * @param detectionConfigurationId The anomaly detection configuration id. * @param startTime The start time of the time range within which the incidents were detected. @@ -696,7 +788,7 @@ private Mono> listAnomaliesForDetectionConfigNex * or {@code startTime} or {@code endTime} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listIncidentsForDetectionConfig( + public PagedFlux listIncidents( String detectionConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime, ListIncidentsDetectedOptions options) { try { @@ -713,7 +805,7 @@ public PagedFlux listIncidentsForDetectionConfig( } } - PagedFlux listIncidentsForDetectionConfig( + PagedFlux listIncidents( String detectionConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime, ListIncidentsDetectedOptions options, Context context) { return new PagedFlux<>(() -> @@ -788,7 +880,7 @@ private Mono> listIncidentsForDetectionConfigNext * * @return the list of root causes for that incident. * @throws IllegalArgumentException thrown if {@code detectionConfigurationId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code incidentId} is null. **/ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -831,7 +923,7 @@ PagedFlux listIncidentRootCauses( * * @return the list of root causes for that anomalyIncident. * @throws IllegalArgumentException thrown if {@code detectionConfigurationId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code incidentId} is null. **/ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -869,6 +961,30 @@ private Mono> listIncidentRootCausesInternal(An .map(res -> IncidentRootCauseTransforms.fromInnerResponse(res)); } + /** + * Fetch dimension values that have anomalies. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalyDimensionValues#String-String-OffsetDateTime-OffsetDateTime} + * + * @param detectionConfigurationId Identifies the configuration used to detect the anomalies. + * @param dimensionName The dimension name to retrieve the values for. + * @param startTime The start time of the time range within which the anomalies were identified. + * @param endTime The end time of the time range within which the anomalies were identified. + * @return The dimension values with anomalies. + * @throws IllegalArgumentException thrown if {@code detectionConfigurationId} does not conform + * to the UUID format specification. + * @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code dimensionName} + * or {@code options} or {@code startTime} or {@code endTime} is null. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAnomalyDimensionValues( + String detectionConfigurationId, + String dimensionName, + OffsetDateTime startTime, OffsetDateTime endTime) { + return listAnomalyDimensionValues(detectionConfigurationId, dimensionName, startTime, endTime, null); + } + /** * Fetch dimension values that have anomalies. * @@ -995,6 +1111,27 @@ private Mono> listAnomalyDimensionValuesNextPageAsync( error)); } + /** + * Fetch the alerts triggered by an anomaly alert configuration. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAlerts#String-OffsetDateTime-OffsetDateTime} + * + * @param alertConfigurationId The anomaly alert configuration id. + * @param startTime The start time of the time range within which the alerts were triggered. + * @param endTime The end time of the time range within which the alerts were triggered. + * @return The alerts. + * @throws IllegalArgumentException thrown if {@code alertConfigurationId} does not conform + * to the UUID format specification. + * @throws NullPointerException thrown if the {@code alertConfigurationId} + * or {@code startTime} or {@code endTime} is null. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAlerts( + String alertConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime) { + return listAlerts(alertConfigurationId, startTime, endTime, null); + } + /** * Fetch the alerts triggered by an anomaly alert configuration. * @@ -1093,7 +1230,7 @@ private Mono> listAlertsNextPageAsync( * Fetch the anomalies in an alert. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForAlert#String-String} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-String} * * @param alertConfigurationId The anomaly alert configuration id. * @param alertId The alert id. @@ -1104,17 +1241,17 @@ private Mono> listAlertsNextPageAsync( * @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listAnomaliesForAlert( + public PagedFlux listAnomalies( String alertConfigurationId, String alertId) { - return listAnomaliesForAlert(alertConfigurationId, alertId, null); + return listAnomalies(alertConfigurationId, alertId, null); } /** * Fetch the anomalies in an alert. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForAlert#String-String-ListAnomaliesAlertedOptions} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-String-ListAnomaliesAlertedOptions} * * @param alertConfigurationId The anomaly alert configuration id. * @param alertId The alert id. @@ -1126,7 +1263,7 @@ public PagedFlux listAnomaliesForAlert( * @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listAnomaliesForAlert( + public PagedFlux listAnomalies( String alertConfigurationId, String alertId, ListAnomaliesAlertedOptions options) { @@ -1142,7 +1279,7 @@ public PagedFlux listAnomaliesForAlert( } } - PagedFlux listAnomaliesForAlert( + PagedFlux listAnomalies( String alertConfigurationId, String alertId, ListAnomaliesAlertedOptions options, @@ -1192,11 +1329,32 @@ private Mono> listAnomaliesForAlertNextPageAsync .map(response -> AnomalyTransforms.fromInnerPagedResponse(response)); } + + /** + * Fetch the incidents in an alert. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-String-ListIncidentsAlertedOptions} + * + * @param alertConfigurationId The anomaly alert configuration id. + * @param alertId The alert id. + * @return The incidents. + * @throws IllegalArgumentException thrown if {@code alertConfigurationId} or {@code alertId} does not + * conform to the UUID format specification. + * @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listIncidents( + String alertConfigurationId, + String alertId) { + return listIncidents(alertConfigurationId, alertId, null); + } + /** * Fetch the incidents in an alert. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-String-ListIncidentsAlertedOptions} * * @param alertConfigurationId The anomaly alert configuration id. * @param alertId The alert id. @@ -1207,7 +1365,7 @@ private Mono> listAnomaliesForAlertNextPageAsync * @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listIncidentsForAlert( + public PagedFlux listIncidents( String alertConfigurationId, String alertId, ListIncidentsAlertedOptions options) { @@ -1223,7 +1381,7 @@ public PagedFlux listIncidentsForAlert( } } - PagedFlux listIncidentsForAlert( + PagedFlux listIncidents( String alertConfigurationId, String alertId, ListIncidentsAlertedOptions options, Context context) { @@ -1273,7 +1431,7 @@ private Mono> listIncidentsForAlertNextPageAsync( * Create a new metric feedback. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeeddback#String-MetricFeedback} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeedback#String-MetricFeedback} * * @param metricId the unique id for which the feedback needs to be submitted. * @param metricFeedback the actual metric feedback. @@ -1282,7 +1440,7 @@ private Mono> listIncidentsForAlertNextPageAsync( * @throws NullPointerException If {@code metricId}, {@code metricFeedback.dimensionFilter} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono addFeeddback(String metricId, MetricFeedback metricFeedback) { + public Mono addFeedback(String metricId, MetricFeedback metricFeedback) { return addFeedbackWithResponse(metricId, metricFeedback).flatMap(FluxUtil::toMono); } @@ -1448,7 +1606,7 @@ Mono> getFeedbackWithResponse(String feedbackId, Contex * @return A {@link PagedFlux} containing information of all the {@link MetricFeedback metric feedbacks} * in the account. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code metricId} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -1469,7 +1627,7 @@ public PagedFlux listFeedback(String metricId) { * @return A {@link PagedFlux} containing information of all the {@link MetricFeedback metric feedbacks} in * the account. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code metricId} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClient.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClient.java index ceab653f34b4..8dc26b07eb40 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClient.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClient.java @@ -9,7 +9,7 @@ import com.azure.ai.metricsadvisor.models.DataPointAnomaly; import com.azure.ai.metricsadvisor.models.DimensionKey; import com.azure.ai.metricsadvisor.models.EnrichmentStatus; -import com.azure.ai.metricsadvisor.models.ErrorCodeException; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; import com.azure.ai.metricsadvisor.models.IncidentRootCause; import com.azure.ai.metricsadvisor.models.ListAlertOptions; import com.azure.ai.metricsadvisor.models.ListAnomaliesAlertedOptions; @@ -44,7 +44,7 @@ * @see MetricsAdvisorClientBuilder */ @ServiceClient(builder = MetricsAdvisorClientBuilder.class) -public class MetricsAdvisorClient { +public final class MetricsAdvisorClient { private final MetricsAdvisorAsyncClient client; @@ -70,7 +70,7 @@ public class MetricsAdvisorClient { * @param activeSince the start time for querying series ingested after this time. * @return A {@link PagedIterable} of the {@link MetricSeriesDefinition metric series definitions}. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code metricId} or {@code activeSince} * is null. */ @@ -93,7 +93,7 @@ public PagedIterable listMetricSeriesDefinitions( * * @return A {@link PagedIterable} of the {@link MetricSeriesDefinition metric series definitions}. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code metricId} or {@code activeSince} * is null. */ @@ -169,7 +169,7 @@ public PagedIterable listMetricSeriesData(String metricId, Lis * @param endTime The end time for querying the time series data. * @return the list of enrichment status's for the specified metric. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if {@code metricId}, {@code startTime} and {@code endTime} * is null. */ @@ -193,7 +193,7 @@ public PagedIterable listMetricEnrichmentStatus( * * @return the list of enrichment status's for the specified metric. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if {@code metricId}, {@code startTime} and {@code endTime} * is null. */ @@ -210,11 +210,11 @@ public PagedIterable listMetricEnrichmentStatus( * a detection configuration. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime} * - * @param seriesKeys The time series key list, each key identifies a specific time series. * @param detectionConfigurationId The id of the configuration used to enrich the time series * identified by the keys in {@code seriesKeys}. + * @param seriesKeys The time series key list, each key identifies a specific time series. * @param startTime The start time. * @param endTime The end time. * @return The enriched time series. @@ -224,12 +224,12 @@ public PagedIterable listMetricEnrichmentStatus( * or {@code startTime} or {@code endTime} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listMetricEnrichedSeriesData(List seriesKeys, - String detectionConfigurationId, + public PagedIterable listMetricEnrichedSeriesData(String detectionConfigurationId, + List seriesKeys, OffsetDateTime startTime, OffsetDateTime endTime) { - return listMetricEnrichedSeriesData(seriesKeys, - detectionConfigurationId, + return listMetricEnrichedSeriesData(detectionConfigurationId, + seriesKeys, startTime, endTime, Context.NONE); @@ -240,11 +240,11 @@ public PagedIterable listMetricEnrichedSeriesData(List * a detection configuration. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime-Context} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime-Context} * - * @param seriesKeys The time series key list, each key identifies a specific time series. * @param detectionConfigurationId The id of the configuration used to enrich the time series * identified by the keys in {@code seriesKeys}. + * @param seriesKeys The time series key list, each key identifies a specific time series. * @param startTime The start time of the time range within which the enriched data is returned. * @param endTime The end time of the time range within which the enriched data is returned. * @param context Additional context that is passed through the Http pipeline during the service call. @@ -256,13 +256,13 @@ public PagedIterable listMetricEnrichedSeriesData(List */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listMetricEnrichedSeriesData( - List seriesKeys, String detectionConfigurationId, + List seriesKeys, OffsetDateTime startTime, OffsetDateTime endTime, Context context) { - return new PagedIterable<>(client.listMetricEnrichedSeriesData(seriesKeys, - detectionConfigurationId, + return new PagedIterable<>(client.listMetricEnrichedSeriesData(detectionConfigurationId, + seriesKeys, startTime, endTime, context == null ? Context.NONE : context)); @@ -272,7 +272,7 @@ public PagedIterable listMetricEnrichedSeriesData( * Fetch the anomalies identified by an anomaly detection configuration. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-OffsetDateTime-OffsetDateTime} * * @param detectionConfigurationId The anomaly detection configuration id. * @param startTime The start time of the time range within which the anomalies were detected. @@ -285,16 +285,16 @@ public PagedIterable listMetricEnrichedSeriesData( * {@code startTime} or {@code endTime} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listAnomaliesForDetectionConfig( + public PagedIterable listAnomalies( String detectionConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime) { - return listAnomaliesForDetectionConfig(detectionConfigurationId, startTime, endTime, null, Context.NONE); + return listAnomalies(detectionConfigurationId, startTime, endTime, null, Context.NONE); } /** * Fetch the anomalies identified by an anomaly detection configuration. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions-Context} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions-Context} * * @param detectionConfigurationId The anomaly detection configuration id. * @param startTime The start time of the time range within which the anomalies were detected. @@ -309,10 +309,10 @@ public PagedIterable listAnomaliesForDetectionConfig( * {@code endTime} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listAnomaliesForDetectionConfig( + public PagedIterable listAnomalies( String detectionConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime, ListAnomaliesDetectedOptions options, Context context) { - return new PagedIterable<>(client.listAnomaliesForDetectionConfig(detectionConfigurationId, + return new PagedIterable<>(client.listAnomalies(detectionConfigurationId, startTime, endTime, options, @@ -323,7 +323,7 @@ public PagedIterable listAnomaliesForDetectionConfig( * Fetch the incidents identified by an anomaly detection configuration. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-OffsetDateTime-OffsetDateTime} * * @param detectionConfigurationId The anomaly detection configuration id. * @param startTime The start time of the time range within which the incidents were detected. @@ -335,16 +335,16 @@ public PagedIterable listAnomaliesForDetectionConfig( * or {@code startTime} or {@code endTime} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listIncidentsForDetectionConfig( + public PagedIterable listIncidents( String detectionConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime) { - return listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime, null, Context.NONE); + return listIncidents(detectionConfigurationId, startTime, endTime, null, Context.NONE); } /** * Fetch the incidents identified by an anomaly detection configuration. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions-Context} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions-Context} * * @param detectionConfigurationId The anomaly detection configuration id. * @param startTime The start time of the time range within which the incidents were detected. @@ -358,10 +358,10 @@ public PagedIterable listIncidentsForDetectionConfig( * {@code endTime} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listIncidentsForDetectionConfig( + public PagedIterable listIncidents( String detectionConfigurationId, OffsetDateTime startTime, OffsetDateTime endTime, ListIncidentsDetectedOptions options, Context context) { - return new PagedIterable<>(client.listIncidentsForDetectionConfig(detectionConfigurationId, + return new PagedIterable<>(client.listIncidents(detectionConfigurationId, startTime, endTime, options, context == null ? Context.NONE : context)); } @@ -377,7 +377,7 @@ public PagedIterable listIncidentsForDetectionConfig( * * @return the list of root causes for that incident. * @throws IllegalArgumentException thrown if {@code detectionConfigurationId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code incidentId} is null. **/ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -399,7 +399,7 @@ public PagedIterable listIncidentRootCauses( * * @return the list of root causes for that incident. * @throws IllegalArgumentException thrown if {@code detectionConfigurationId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code incidentId} is null. **/ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -419,7 +419,7 @@ public PagedIterable listIncidentRootCauses( * * @return the list of root causes for that anomalyIncident. * @throws IllegalArgumentException thrown if {@code detectionConfigurationId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code detectionConfigurationId} or {@code incidentId} is null. **/ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -531,7 +531,7 @@ public PagedIterable listAlerts( * Fetch the anomalies in an alert. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForAlert#String-String} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-String} * * @param alertConfigurationId The anomaly alert configuration id. * @param alertId The alert id. @@ -541,17 +541,17 @@ public PagedIterable listAlerts( * @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listAnomaliesForAlert( + public PagedIterable listAnomalies( String alertConfigurationId, String alertId) { - return listAnomaliesForAlert(alertConfigurationId, alertId, null, Context.NONE); + return listAnomalies(alertConfigurationId, alertId, null, Context.NONE); } /** * Fetch the anomalies in an alert. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForAlert#String-String-ListAnomaliesAlertedOptions-Context} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-String-ListAnomaliesAlertedOptions-Context} * * @param alertConfigurationId The anomaly alert configuration id. * @param alertId The alert id. @@ -564,11 +564,11 @@ public PagedIterable listAnomaliesForAlert( * @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listAnomaliesForAlert( + public PagedIterable listAnomalies( String alertConfigurationId, String alertId, ListAnomaliesAlertedOptions options, Context context) { - return new PagedIterable<>(client.listAnomaliesForAlert(alertConfigurationId, + return new PagedIterable<>(client.listAnomalies(alertConfigurationId, alertId, options, context == null ? Context.NONE : context)); @@ -578,11 +578,10 @@ public PagedIterable listAnomaliesForAlert( * Fetch the incidents in an alert. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-String-ListIncidentsAlertedOptions-Context} * * @param alertConfigurationId The anomaly alert configuration id. * @param alertId The alert id. - * @param options The additional parameters. * * @return The incidents. * @throws IllegalArgumentException thrown if {@code alertConfigurationId} or {@code alertId} does not @@ -590,18 +589,20 @@ public PagedIterable listAnomaliesForAlert( * @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listIncidentsForAlert( + public PagedIterable listIncidents( String alertConfigurationId, - String alertId, - ListIncidentsAlertedOptions options) { - return listIncidentsForAlert(alertConfigurationId, alertId, options, Context.NONE); + String alertId) { + return this.listIncidents(alertConfigurationId, + alertId, + null, + Context.NONE); } /** * Fetch the incidents in an alert. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions-Context} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-String-ListIncidentsAlertedOptions-Context} * * @param alertConfigurationId The anomaly alert configuration id. * @param alertId The alert id. @@ -614,11 +615,11 @@ public PagedIterable listIncidentsForAlert( * @throws NullPointerException thrown if the {@code alertConfigurationId} or {@code alertId} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listIncidentsForAlert( + public PagedIterable listIncidents( String alertConfigurationId, String alertId, ListIncidentsAlertedOptions options, Context context) { - return new PagedIterable<>(client.listIncidentsForAlert(alertConfigurationId, + return new PagedIterable<>(client.listIncidents(alertConfigurationId, alertId, options, context == null ? Context.NONE : context)); @@ -628,7 +629,7 @@ public PagedIterable listIncidentsForAlert( * Create a new metric feedback. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeeddback#String-MetricFeedback} + * {@codesnippet com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeedback#String-MetricFeedback} * * @param metricId the unique id for which the feedback needs to be submitted. * @param metricFeedback the actual metric feedback. @@ -638,7 +639,7 @@ public PagedIterable listIncidentsForAlert( */ @ServiceMethod(returns = ReturnType.SINGLE) public MetricFeedback addFeedback(String metricId, MetricFeedback metricFeedback) { - return createMetricFeedbackWithResponse(metricId, metricFeedback, Context.NONE).getValue(); + return addFeedbackWithResponse(metricId, metricFeedback, Context.NONE).getValue(); } /** @@ -655,8 +656,8 @@ public MetricFeedback addFeedback(String metricId, MetricFeedback metricFeedback * @throws NullPointerException If {@code metricId}, {@code metricFeedback.dimensionFilter} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createMetricFeedbackWithResponse(String metricId, MetricFeedback metricFeedback, - Context context) { + public Response addFeedbackWithResponse(String metricId, MetricFeedback metricFeedback, + Context context) { return client.addFeedbackWithResponse(metricId, metricFeedback, context).block(); } @@ -706,7 +707,7 @@ public Response getFeedbackWithResponse(String feedbackId, Conte * @return A {@link PagedIterable} containing information of all the {@link MetricFeedback metric feedbacks} * in the account. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code metricId} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -729,7 +730,7 @@ public PagedIterable listFeedback( * @return A {@link PagedIterable} containing information of all the {@link MetricFeedback metric feedbacks} * in the account. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code metricId} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -751,7 +752,7 @@ public PagedIterable listFeedback( * * @return the {@link PagedIterable} of the dimension values for that metric. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code metricId} or {@code dimensionName} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -774,7 +775,7 @@ public PagedIterable listMetricDimensionValues( * * @return the {@link PagedIterable} of the dimension values for that metric. * @throws IllegalArgumentException thrown if {@code metricId} fail the UUID format validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws NullPointerException thrown if the {@code metricId} or {@code dimensionName} is null. */ @ServiceMethod(returns = ReturnType.COLLECTION) diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilder.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilder.java index 1d8c038c6820..26b0b78252bd 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilder.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilder.java @@ -6,7 +6,6 @@ import com.azure.ai.metricsadvisor.implementation.AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl; import com.azure.ai.metricsadvisor.implementation.AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2ImplBuilder; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.annotation.ServiceClientBuilder; import com.azure.core.credential.TokenCredential; import com.azure.core.http.ContentType; @@ -19,11 +18,13 @@ import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.HttpPolicyProviders; import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; @@ -79,6 +80,8 @@ public final class MetricsAdvisorClientBuilder { private static final RetryPolicy DEFAULT_RETRY_POLICY = new RetryPolicy("retry-after-ms", ChronoUnit.MILLIS); private static final String DEFAULT_SCOPE = "https://cognitiveservices.azure.com/.default"; + private static final HttpLogOptions DEFAULT_LOG_OPTIONS = new HttpLogOptions(); + private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions(); private final ClientLogger logger = new ClientLogger(MetricsAdvisorClientBuilder.class); private final List policies; @@ -91,6 +94,7 @@ public final class MetricsAdvisorClientBuilder { private TokenCredential tokenCredential; private HttpClient httpClient; private HttpLogOptions httpLogOptions; + private ClientOptions clientOptions; private HttpPipeline httpPipeline; private Configuration configuration; private RetryPolicy retryPolicy; @@ -111,8 +115,8 @@ public MetricsAdvisorClientBuilder() { clientVersion = properties.getOrDefault(VERSION, "UnknownVersion"); headers = new HttpHeaders() - .put(ECHO_REQUEST_ID_HEADER, "true") - .put(ACCEPT_HEADER, CONTENT_TYPE_HEADER_VALUE); + .set(ECHO_REQUEST_ID_HEADER, "true") + .set(ACCEPT_HEADER, CONTENT_TYPE_HEADER_VALUE); } /** @@ -183,17 +187,21 @@ private HttpPipeline getDefaultHttpPipeline(Configuration buildConfiguration) { // Authentications if (tokenCredential != null) { policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPE)); - } else if (!CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getSubscriptionKey()) - || !CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getApiKey())) { - headers.put(OCP_APIM_SUBSCRIPTION_KEY, metricsAdvisorKeyCredential.getSubscriptionKey()); - headers.put(API_KEY, metricsAdvisorKeyCredential.getApiKey()); + } else if (!CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getKeys().getSubscriptionKey()) + || !CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getKeys().getApiKey())) { + headers.set(OCP_APIM_SUBSCRIPTION_KEY, metricsAdvisorKeyCredential.getKeys().getSubscriptionKey()); + headers.set(API_KEY, metricsAdvisorKeyCredential.getKeys().getApiKey()); } else { // Throw exception that credential cannot be null throw logger.logExceptionAsError( new IllegalArgumentException("Missing credential information while building a client.")); } - policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion, + ClientOptions buildClientOptions = this.clientOptions == null ? DEFAULT_CLIENT_OPTIONS : this.clientOptions; + HttpLogOptions buildLogOptions = this.httpLogOptions == null ? DEFAULT_LOG_OPTIONS : this.httpLogOptions; + final String applicationId = CoreUtils.getApplicationId(buildClientOptions, buildLogOptions); + + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); policies.add(new RequestIdPolicy()); policies.add(new AddHeadersPolicy(headers)); @@ -201,6 +209,7 @@ private HttpPipeline getDefaultHttpPipeline(Configuration buildConfiguration) { HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy == null ? DEFAULT_RETRY_POLICY : retryPolicy); policies.add(new AddDatePolicy()); + policies.add(new HttpLoggingPolicy(httpLogOptions)); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); @@ -280,6 +289,17 @@ public MetricsAdvisorClientBuilder httpLogOptions(HttpLogOptions logOptions) { return this; } + /** + * Sets the client options such as application ID and custom headers to set on a request. + * + * @param clientOptions The client options. + * @return The updated MetricsAdvisorClientBuilder object. + */ + public MetricsAdvisorClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + /** * Adds a policy to the set of existing policies that are executed after required policies. * diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorServiceVersion.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorServiceVersion.java similarity index 94% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorServiceVersion.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorServiceVersion.java index 4253863f068e..b606d4d06c63 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorServiceVersion.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/MetricsAdvisorServiceVersion.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor; import com.azure.core.util.ServiceVersion; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClient.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClient.java index e6c3de02bb5b..510b4a7dc7e4 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClient.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClient.java @@ -4,7 +4,10 @@ package com.azure.ai.metricsadvisor.administration; import com.azure.ai.metricsadvisor.implementation.AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl; +import com.azure.ai.metricsadvisor.implementation.models.DataSourceCredential; +import com.azure.ai.metricsadvisor.implementation.models.DataSourceCredentialPatch; import com.azure.ai.metricsadvisor.implementation.models.RollUpMethod; +import com.azure.ai.metricsadvisor.implementation.util.DataSourceCredentialEntityTransforms; import com.azure.ai.metricsadvisor.implementation.util.DataFeedTransforms; import com.azure.ai.metricsadvisor.implementation.util.DetectionConfigurationTransforms; import com.azure.ai.metricsadvisor.implementation.models.AnomalyDetectionConfigurationPatch; @@ -21,26 +24,28 @@ import com.azure.ai.metricsadvisor.implementation.models.ViewMode; import com.azure.ai.metricsadvisor.implementation.util.Utility; import com.azure.ai.metricsadvisor.implementation.util.AlertConfigurationTransforms; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; -import com.azure.ai.metricsadvisor.models.DataFeedMissingDataPointFillSettings; -import com.azure.ai.metricsadvisor.models.DataFeedMissingDataPointFillType; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedRollupSettings; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions; -import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions; -import com.azure.ai.metricsadvisor.models.NotificationHook; -import com.azure.ai.metricsadvisor.models.ListDataFeedFilter; -import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions; -import com.azure.ai.metricsadvisor.models.ListDataFeedOptions; -import com.azure.ai.metricsadvisor.models.ListHookOptions; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMissingDataPointFillSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMissingDataPointFillType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.ListCredentialEntityOptions; +import com.azure.ai.metricsadvisor.administration.models.ListMetricAnomalyDetectionConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedFilter; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.ListHookOptions; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.MetricsAdvisorServiceVersion; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; @@ -63,7 +68,7 @@ import java.util.stream.Collectors; import static com.azure.ai.metricsadvisor.implementation.util.Utility.parseOperationId; -import static com.azure.ai.metricsadvisor.models.DataFeedGranularityType.CUSTOM; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType.CUSTOM; import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.FluxUtil.withContext; import static com.azure.core.util.tracing.Tracer.AZ_TRACING_NAMESPACE_KEY; @@ -76,7 +81,7 @@ * @see MetricsAdvisorAdministrationClientBuilder */ @ServiceClient(builder = MetricsAdvisorAdministrationClientBuilder.class, isAsync = true) -public class MetricsAdvisorAdministrationAsyncClient { +public final class MetricsAdvisorAdministrationAsyncClient { private static final String METRICS_ADVISOR_TRACING_NAMESPACE_VALUE = "Microsoft.CognitiveServices"; private final ClientLogger logger = new ClientLogger(MetricsAdvisorAdministrationAsyncClient.class); private final AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl service; @@ -325,28 +330,28 @@ Mono> updateDataFeedWithResponse(DataFeed dataFeed, Context c ? null : dataFeedIngestionSettings.getIngestionRetryDelay().getSeconds()) .setNeedRollup( dataFeedRollupSettings.getRollupType() != null - ? NeedRollupEnum.fromString(dataFeedRollupSettings.getRollupType().toString()) - : null) + ? NeedRollupEnum.fromString(dataFeedRollupSettings.getRollupType().toString()) + : null) .setRollUpColumns(dataFeedRollupSettings.getAutoRollupGroupByColumnNames()) .setRollUpMethod( dataFeedRollupSettings.getDataFeedAutoRollUpMethod() != null - ? RollUpMethod.fromString( + ? RollUpMethod.fromString( dataFeedRollupSettings.getDataFeedAutoRollUpMethod().toString()) : null) .setAllUpIdentification(dataFeedRollupSettings.getRollupIdentificationValue()) .setFillMissingPointType( dataFeedMissingDataPointFillSettings.getFillType() != null - ? FillMissingPointType.fromString( + ? FillMissingPointType.fromString( dataFeedMissingDataPointFillSettings.getFillType().toString()) : null) .setFillMissingPointValue( // For PATCH send 'fill-custom-value' over wire only for 'fill-custom-type'. dataFeedMissingDataPointFillSettings.getFillType() == DataFeedMissingDataPointFillType.CUSTOM_VALUE - ? dataFeedMissingDataPointFillSettings.getCustomFillValue() + ? dataFeedMissingDataPointFillSettings.getCustomFillValue() : null) .setViewMode( dataFeedOptions.getAccessMode() != null - ? ViewMode.fromString(dataFeedOptions.getAccessMode().toString()) + ? ViewMode.fromString(dataFeedOptions.getAccessMode().toString()) : null) .setViewers(dataFeedOptions.getViewerEmails()) .setAdmins(dataFeedOptions.getAdminEmails()) @@ -697,7 +702,7 @@ public Mono> getDataFeedIngestionProgressWit } Mono> getDataFeedIngestionProgressWithResponse(String dataFeedId, - Context context) { + Context context) { Objects.requireNonNull(dataFeedId, "'dataFeedId' is required."); return service.getIngestionProgressWithResponseAsync(UUID.fromString(dataFeedId), context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE)) @@ -970,7 +975,7 @@ public Mono> deleteMetricAnomalyDetectionConfigWithResponse( } Mono> deleteMetricAnomalyDetectionConfigWithResponse(String detectionConfigurationId, - Context context) { + Context context) { Objects.requireNonNull(detectionConfigurationId, "detectionConfigurationId is required."); return service.deleteHookWithResponseAsync(UUID.fromString(detectionConfigurationId), context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE)) @@ -979,6 +984,23 @@ Mono> deleteMetricAnomalyDetectionConfigWithResponse(String detec .doOnError(error -> logger.warning("Failed to delete MetricAnomalyDetectionConfiguration", error)); } + /** + * Given a metric id, retrieve all anomaly detection configurations applied to it. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listMetricAnomalyDetectionConfigs#String} + * + * @param metricId The metric id. + * @return The anomaly detection configurations. + * @throws NullPointerException thrown if the {@code metricId} is null. + * @throws IllegalArgumentException If {@code metricId} does not conform to the UUID format specification. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listMetricAnomalyDetectionConfigs( + String metricId) { + return listMetricAnomalyDetectionConfigs(metricId, null); + } + /** * Given a metric id, retrieve all anomaly detection configurations applied to it. * @@ -1659,4 +1681,315 @@ private Mono> listAnomalyAlertConfigsNe error)) .map(response -> AlertConfigurationTransforms.fromInnerPagedResponse(response)); } + + /** + * Create a data source credential entity. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.createDatasourceCredential#DatasourceCredentialEntity} + * + * @param datasourceCredential The credential entity. + * @return A {@link Mono} containing the created {@link DatasourceCredentialEntity}. + * @throws NullPointerException thrown if the {@code credentialEntity} is null + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createDatasourceCredential( + DatasourceCredentialEntity datasourceCredential) { + return createDatasourceCredentialWithResponse(datasourceCredential) + .map(Response::getValue); + } + + /** + * Create a data source credential entity with REST response. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.createDatasourceCredentialWithResponse#DatasourceCredentialEntity} + * + * @param datasourceCredential The credential entity. + * @return A {@link Mono} containing the created {@link DatasourceCredentialEntity}. + * @throws NullPointerException thrown if the {@code credentialEntity} is null + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createDatasourceCredentialWithResponse( + DatasourceCredentialEntity datasourceCredential) { + try { + return withContext(context -> createDatasourceCredentialWithResponse(datasourceCredential, + context)); + } catch (RuntimeException e) { + return FluxUtil.monoError(logger, e); + } + } + + Mono> createDatasourceCredentialWithResponse( + DatasourceCredentialEntity datasourceCredential, + Context context) { + Objects.requireNonNull(datasourceCredential, "datasourceCredential is required"); + + final DataSourceCredential + innerDataSourceCredential = DataSourceCredentialEntityTransforms.toInnerForCreate(datasourceCredential); + return service.createCredentialWithResponseAsync(innerDataSourceCredential, + context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE)) + .doOnSubscribe(ignoredValue -> logger.info("Creating DataSourceCredentialEntity")) + .doOnSuccess(response -> logger.info("Created DataSourceCredentialEntity")) + .doOnError(error -> logger.warning("Failed to create DataSourceCredentialEntity", error)) + .flatMap(response -> { + final String credentialId + = Utility.parseOperationId(response.getDeserializedHeaders().getLocation()); + return this.getDatasourceCredentialWithResponse(credentialId, context) + .map(configurationResponse -> new ResponseBase( + response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + configurationResponse.getValue(), + null)); + }); + } + + /** + * Update a data source credential entity. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.updateDatasourceCredential#DatasourceCredentialEntity} + * + * @param datasourceCredential The credential entity. + * @return A {@link Mono} containing the updated {@link DatasourceCredentialEntity}. + * @throws NullPointerException thrown if the {@code credentialEntity} is null + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateDatasourceCredential( + DatasourceCredentialEntity datasourceCredential) { + return updateDatasourceCredentialWithResponse(datasourceCredential) + .map(Response::getValue); + } + + /** + * Update a data source credential entity with REST response. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.updateDatasourceCredentialWithResponse#DatasourceCredentialEntity} + * + * @param datasourceCredential The credential entity. + * @return A {@link Mono} containing the updated {@link DatasourceCredentialEntity}. + * @throws NullPointerException thrown if the {@code credentialEntity} is null + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateDatasourceCredentialWithResponse( + DatasourceCredentialEntity datasourceCredential) { + try { + return withContext(context -> updateDatasourceCredentialWithResponse(datasourceCredential, + context)); + } catch (RuntimeException e) { + return FluxUtil.monoError(logger, e); + } + } + + Mono> updateDatasourceCredentialWithResponse( + DatasourceCredentialEntity datasourceCredential, + Context context) { + Objects.requireNonNull(datasourceCredential, "datasourceCredential is required"); + + final DataSourceCredentialPatch + innerDataSourceCredential = DataSourceCredentialEntityTransforms.toInnerForUpdate(datasourceCredential); + return service.updateCredentialWithResponseAsync(UUID.fromString(datasourceCredential.getId()), + innerDataSourceCredential, + context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE)) + .doOnSubscribe(ignoredValue -> logger.info("Updating DataSourceCredentialEntity")) + .doOnSuccess(response -> logger.info("Updated DataSourceCredentialEntity")) + .doOnError(error -> logger.warning("Failed to update DataSourceCredentialEntity", error)) + .flatMap(response -> { + return this.getDatasourceCredentialWithResponse(datasourceCredential.getId(), context) + .map(configurationResponse -> new ResponseBase( + response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + configurationResponse.getValue(), + null)); + }); + } + + /** + * Get a data source credential entity by its id. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getDatasourceCredential#String} + * + * @param credentialId The data source credential entity unique id. + * + * @return The data source credential entity for the provided id. + * @throws IllegalArgumentException If {@code credentialId} does not conform to the UUID format specification. + * @throws NullPointerException thrown if the {@code credentialId} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDatasourceCredential(String credentialId) { + return getDatasourceCredentialWithResponse(credentialId).flatMap(FluxUtil::toMono); + } + + /** + * Get a data source credential entity by its id with REST response. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getDatasourceCredentialWithResponse#String} + * + * @param credentialId The data source credential entity unique id. + * + * @return The data source credential entity for the provided id. + * @throws IllegalArgumentException If {@code credentialId} does not conform to the UUID format specification. + * @throws NullPointerException thrown if the {@code credentialId} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDatasourceCredentialWithResponse( + String credentialId) { + try { + return withContext(context -> getDatasourceCredentialWithResponse(credentialId, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + Mono> getDatasourceCredentialWithResponse(String credentialId, + Context context) { + Objects.requireNonNull(credentialId, "'credentialId' cannot be null."); + + return service.getCredentialWithResponseAsync(UUID.fromString(credentialId), context) + .map(response -> new SimpleResponse<>(response, + DataSourceCredentialEntityTransforms.fromInner(response.getValue()))); + } + + /** + * Deletes the data source credential entity identified by {@code credentialId}. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.deleteDatasourceCredential#String} + * + * @param credentialId The data source credential entity id. + * + * @return An empty Mono. + * @throws IllegalArgumentException If {@code credentialId} does not conform to the + * UUID format specification. + * @throws NullPointerException thrown if the {@code credentialId} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteDatasourceCredential(String credentialId) { + return deleteDatasourceCredentialWithResponse(credentialId).flatMap(FluxUtil::toMono); + } + + /** + * Deletes the data source credential entity identified by {@code credentialId}. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.deleteDatasourceCredentialWithResponse#String} + * + * @param credentialId The data source credential entity id. + * + * @return A response containing status code and headers returned after the operation. + * @throws IllegalArgumentException If {@code credentialId} does not conform to the + * UUID format specification. + * @throws NullPointerException thrown if the {@code credentialId} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteDatasourceCredentialWithResponse(String credentialId) { + try { + return withContext(context -> deleteDatasourceCredentialWithResponse(credentialId, context)); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + Mono> deleteDatasourceCredentialWithResponse(String credentialId, Context context) { + Objects.requireNonNull(credentialId, "'credentialId' is required."); + final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE); + + return service.deleteCredentialWithResponseAsync(UUID.fromString(credentialId), + withTracing) + .doOnSubscribe(ignoredValue -> logger.info("Deleting deleteDataSourceCredentialEntity - {}", + credentialId)) + .doOnSuccess(response -> logger.info("Deleted deleteDataSourceCredentialEntity - {}", response)) + .doOnError(error -> logger.warning("Failed to delete deleteDataSourceCredentialEntity - {}", + credentialId, error)); + } + + /** + * List information of all data source credential entities on the metrics advisor account. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDatasourceCredentials} + * + * @return A {@link PagedFlux} containing information of all the {@link DatasourceCredentialEntity data feeds} + * in the account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listDatasourceCredentials() { + return listDatasourceCredentials(new ListCredentialEntityOptions()); + } + + /** + * List information of all data source credential entities on the metrics advisor account. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDatasourceCredentials#ListCredentialEntityOptions} + * + * @param options The configurable {@link ListCredentialEntityOptions options} to pass for filtering + * the output result. + * + * @return A {@link PagedFlux} containing information of all the {@link DatasourceCredentialEntity data feeds} + * in the account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listDatasourceCredentials(ListCredentialEntityOptions options) { + try { + return new PagedFlux<>(() -> + withContext(context -> + listCredentialEntitiesSinglePageAsync(options, context)), + continuationToken -> + withContext(context -> listCredentialEntitiesSNextPageAsync(continuationToken, context))); + } catch (RuntimeException ex) { + return new PagedFlux<>(() -> monoError(logger, ex)); + } + } + + PagedFlux listDatasourceCredentials(ListCredentialEntityOptions options, + Context context) { + return new PagedFlux<>(() -> + listCredentialEntitiesSinglePageAsync(options, context), + continuationToken -> + listCredentialEntitiesSNextPageAsync(continuationToken, context)); + } + + private Mono> listCredentialEntitiesSinglePageAsync( + ListCredentialEntityOptions options, Context context) { + options = options != null ? options : new ListCredentialEntityOptions(); + final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, METRICS_ADVISOR_TRACING_NAMESPACE_VALUE); + return service.listCredentialsSinglePageAsync(options.getSkip(), options.getMaxPageSize(), withTracing) + .doOnRequest(ignoredValue -> logger.info("Listing information for all data source credentials")) + .doOnSuccess(response -> logger.info("Listed data source credentials {}", response)) + .doOnError(error -> logger.warning("Failed to list all data source credential information - {}", error)) + .map(res -> new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().stream() + .map(DataSourceCredentialEntityTransforms::fromInner).collect(Collectors.toList()), + res.getContinuationToken(), + null)); + } + + private Mono> listCredentialEntitiesSNextPageAsync( + String nextPageLink, Context context) { + if (CoreUtils.isNullOrEmpty(nextPageLink)) { + return Mono.empty(); + } + return service.listCredentialsNextSinglePageAsync(nextPageLink, context) + .doOnSubscribe(ignoredValue -> logger.info("Retrieving the next listing page - Page {}", nextPageLink)) + .doOnSuccess(response -> logger.info("Retrieved the next listing page - Page {}", nextPageLink)) + .doOnError(error -> logger.warning("Failed to retrieve the next listing page - Page {}", nextPageLink, + error)) + .map(res -> new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().stream() + .map(DataSourceCredentialEntityTransforms::fromInner).collect(Collectors.toList()), + res.getContinuationToken(), + null)); + } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClient.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClient.java index 0a12dd44b6d8..c506f6d632ae 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClient.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClient.java @@ -3,17 +3,19 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; -import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions; -import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions; -import com.azure.ai.metricsadvisor.models.ListDataFeedOptions; -import com.azure.ai.metricsadvisor.models.ListHookOptions; -import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions; -import com.azure.ai.metricsadvisor.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.ListCredentialEntityOptions; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.ListHookOptions; +import com.azure.ai.metricsadvisor.administration.models.ListMetricAnomalyDetectionConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; @@ -223,8 +225,7 @@ public PagedIterable listDataFeeds(ListDataFeedOptions options, Contex */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listDataFeedIngestionStatus( - String dataFeedId, - ListDataFeedIngestionOptions options) { + String dataFeedId, ListDataFeedIngestionOptions options) { return listDataFeedIngestionStatus(dataFeedId, options, Context.NONE); } @@ -517,19 +518,17 @@ public Response deleteMetricAnomalyDetectionConfigWithResponse( * Given a metric id, retrieve all anomaly detection configurations applied to it. * *

Code sample

- * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listMetricAnomalyDetectionConfigs#String-ListMetricAnomalyDetectionConfigsOptions} + * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listMetricAnomalyDetectionConfigs#String} * * @param metricId The metric id. - * @param options th e additional configurable options to specify when querying the result. * @return The anomaly detection configurations. * @throws NullPointerException thrown if the {@code metricId} is null. * @throws IllegalArgumentException If {@code metricId} does not conform to the UUID format specification. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listMetricAnomalyDetectionConfigs( - String metricId, - ListMetricAnomalyDetectionConfigsOptions options) { - return new PagedIterable<>(client.listMetricAnomalyDetectionConfigs(metricId, options, + String metricId) { + return new PagedIterable<>(client.listMetricAnomalyDetectionConfigs(metricId, null, Context.NONE)); } @@ -914,4 +913,174 @@ public PagedIterable listAnomalyAlertConfigs( return new PagedIterable<>(client.listAnomalyAlertConfigs(detectionConfigurationId, options, context == null ? Context.NONE : context)); } + + /** + * Create a data source credential entity. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createDatasourceCredential#DatasourceCredentialEntity} + * + * @param datasourceCredential The credential entity. + * @return The created {@link DatasourceCredentialEntity}. + * @throws NullPointerException thrown if the {@code credentialEntity} is null + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatasourceCredentialEntity createDatasourceCredential(DatasourceCredentialEntity datasourceCredential) { + return createDatasourceCredentialWithResponse(datasourceCredential, Context.NONE).getValue(); + } + + /** + * Create a data source credential entity with REST response. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createDatasourceCredentialWithResponse#DatasourceCredentialEntity-Context} + * + * @param datasourceCredential The credential entity. + * @param context Additional context that is passed through the HTTP pipeline during the service call. + * + * @return A {@link Response} containing the created {@link DatasourceCredentialEntity}. + * @throws NullPointerException thrown if the {@code credentialEntity} is null + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createDatasourceCredentialWithResponse( + DatasourceCredentialEntity datasourceCredential, Context context) { + return client.createDatasourceCredentialWithResponse(datasourceCredential, context).block(); + } + + /** + * Get a data source credential entity by its id. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getDatasourceCredential#String} + * + * @param credentialId The data source credential entity unique id. + * + * @return The data source credential entity for the provided id. + * @throws IllegalArgumentException If {@code credentialId} does not conform to the UUID format specification. + * @throws NullPointerException thrown if the {@code credentialId} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatasourceCredentialEntity getDatasourceCredential(String credentialId) { + return getDatasourceCredentialWithResponse(credentialId, Context.NONE).getValue(); + } + + /** + * Get a data source credential entity by its id with REST response. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getDatasourceCredentialWithResponse#String-Context} + * + * @param credentialId The data source credential entity unique id. + * @param context Additional context that is passed through the HTTP pipeline during the service call. + * + * @return The data feed for the provided id. + * @throws IllegalArgumentException If {@code dataFeedId} does not conform to the UUID format specification. + * @throws NullPointerException thrown if the {@code dataFeedId} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDatasourceCredentialWithResponse(String credentialId, + Context context) { + return client.getDatasourceCredentialWithResponse(credentialId, context).block(); + } + + /** + * Update a data source credential entity. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateDatasourceCredential#DatasourceCredentialEntity} + * + * @param datasourceCredential The credential entity. + * + * @return The updated {@link DatasourceCredentialEntity}. + * @throws NullPointerException thrown if the {@code credentialEntity} is null + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatasourceCredentialEntity updateDatasourceCredential(DatasourceCredentialEntity datasourceCredential) { + return updateDatasourceCredentialWithResponse(datasourceCredential, Context.NONE).getValue(); + } + + /** + * Update a data source credential entity. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateDatasourceCredentialWithResponse#DatasourceCredentialEntity-Context} + * + * @param datasourceCredential The credential entity. + * @param context Additional context that is passed through the HTTP pipeline during the service call. + * + * @return A {@link Response} containing the updated {@link DatasourceCredentialEntity}. + * @throws NullPointerException thrown if the {@code credentialEntity} is null + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateDatasourceCredentialWithResponse( + DatasourceCredentialEntity datasourceCredential, Context context) { + return client.updateDatasourceCredentialWithResponse(datasourceCredential, context).block(); + } + + /** + * Delete a data source credential entity. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteDatasourceCredential#String} + * + * @param credentialId The data source credential entity unique id. + * + * @throws IllegalArgumentException If {@code credentialId} does not conform to the UUID format specification. + * @throws NullPointerException thrown if the {@code credentialId} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteDatasourceCredential(String credentialId) { + deleteDatasourceCredentialWithResponse(credentialId, Context.NONE); + } + + /** + * Delete a data source credential entity with REST response. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteDatasourceCredentialWithResponse#String-Context} + * + * @param credentialId The data source credential entity unique id. + * @param context Additional context that is passed through the HTTP pipeline during the service call. + * + * @return a REST Response. + * @throws IllegalArgumentException If {@code dataFeedId} does not conform to the UUID format specification. + * @throws NullPointerException thrown if the {@code dataFeedId} is null. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteDatasourceCredentialWithResponse(String credentialId, Context context) { + return client.deleteDataFeedWithResponse(credentialId, context).block(); + } + + /** + * List information of all data source credential entities on the metrics advisor account. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listDatasourceCredentials} + * + * @return A {@link PagedIterable} containing information of all the {@link DatasourceCredentialEntity} + * in the account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDatasourceCredentials() { + return listDatasourceCredentials(null, Context.NONE); + } + + /** + * List information of all data source credential entities on the metrics advisor account. + * + *

Code sample

+ * {@codesnippet com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listDatasourceCredentials#ListCredentialEntityOptions-Context} + * + * @param options The configurable {@link ListCredentialEntityOptions options} to pass for filtering the output + * result. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link PagedIterable} containing information of all the {@link DatasourceCredentialEntity} + * in the account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDatasourceCredentials( + ListCredentialEntityOptions options, Context context) { + return new PagedIterable<>(client.listDatasourceCredentials(options, context)); + } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientBuilder.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientBuilder.java index 9a129a83e5ae..b317b9a42985 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientBuilder.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientBuilder.java @@ -6,7 +6,7 @@ import com.azure.ai.metricsadvisor.implementation.AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl; import com.azure.ai.metricsadvisor.implementation.AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2ImplBuilder; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.MetricsAdvisorServiceVersion; import com.azure.core.annotation.ServiceClientBuilder; import com.azure.core.credential.TokenCredential; import com.azure.core.http.ContentType; @@ -19,11 +19,13 @@ import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.HttpPolicyProviders; import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; @@ -82,6 +84,8 @@ public final class MetricsAdvisorAdministrationClientBuilder { private static final RetryPolicy DEFAULT_RETRY_POLICY = new RetryPolicy("retry-after-ms", ChronoUnit.MILLIS); private static final String DEFAULT_SCOPE = "https://cognitiveservices.azure.com/.default"; + private static final HttpLogOptions DEFAULT_LOG_OPTIONS = new HttpLogOptions(); + private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions(); private final ClientLogger logger = new ClientLogger(MetricsAdvisorAdministrationClientBuilder.class); private final List policies; @@ -94,6 +98,7 @@ public final class MetricsAdvisorAdministrationClientBuilder { private MetricsAdvisorKeyCredential metricsAdvisorKeyCredential; private HttpClient httpClient; private HttpLogOptions httpLogOptions; + private ClientOptions clientOptions; private HttpPipeline httpPipeline; private Configuration configuration; private RetryPolicy retryPolicy; @@ -114,8 +119,8 @@ public MetricsAdvisorAdministrationClientBuilder() { clientVersion = properties.getOrDefault(VERSION, "UnknownVersion"); headers = new HttpHeaders() - .put(ECHO_REQUEST_ID_HEADER, "true") - .put(ACCEPT_HEADER, CONTENT_TYPE_HEADER_VALUE); + .set(ECHO_REQUEST_ID_HEADER, "true") + .set(ACCEPT_HEADER, CONTENT_TYPE_HEADER_VALUE); } /** @@ -183,28 +188,33 @@ private HttpPipeline getDefaultHttpPipeline(Configuration buildConfiguration) { // Closest to API goes first, closest to wire goes last. final List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion, - buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersPolicy(headers)); - - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy == null ? DEFAULT_RETRY_POLICY : retryPolicy); - policies.add(new AddDatePolicy()); - // Authentications if (tokenCredential != null) { policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPE)); - } else if (!CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getSubscriptionKey()) - || !CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getApiKey())) { - headers.put(OCP_APIM_SUBSCRIPTION_KEY, metricsAdvisorKeyCredential.getSubscriptionKey()); - headers.put(API_KEY, metricsAdvisorKeyCredential.getApiKey()); + } else if (!CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getKeys().getSubscriptionKey()) + || !CoreUtils.isNullOrEmpty(metricsAdvisorKeyCredential.getKeys().getApiKey())) { + headers.set(OCP_APIM_SUBSCRIPTION_KEY, metricsAdvisorKeyCredential.getKeys().getSubscriptionKey()); + headers.set(API_KEY, metricsAdvisorKeyCredential.getKeys().getApiKey()); } else { - // Throw exception that credential and tokenCredential cannot be null + // Throw exception that credential cannot be null throw logger.logExceptionAsError( new IllegalArgumentException("Missing credential information while building a client.")); } + ClientOptions buildClientOptions = this.clientOptions == null ? DEFAULT_CLIENT_OPTIONS : this.clientOptions; + HttpLogOptions buildLogOptions = this.httpLogOptions == null ? DEFAULT_LOG_OPTIONS : this.httpLogOptions; + final String applicationId = CoreUtils.getApplicationId(buildClientOptions, buildLogOptions); + + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, + buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersPolicy(headers)); + + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? DEFAULT_RETRY_POLICY : retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); @@ -284,6 +294,18 @@ public MetricsAdvisorAdministrationClientBuilder httpLogOptions(HttpLogOptions l return this; } + /** + * Sets the client options such as application ID and custom headers to set on a request. + * + * @param clientOptions The client options. + * @return The updated MetricsAdvisorAdministrationClientBuilder object. + */ + public MetricsAdvisorAdministrationClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /** * Adds a policy to the set of existing policies that are executed after required policies. * diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyAlertConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyAlertConfiguration.java similarity index 86% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyAlertConfiguration.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyAlertConfiguration.java index 086de32e93e4..45dbf467d951 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyAlertConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyAlertConfiguration.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.ai.metricsadvisor.implementation.util.AnomalyAlertConfigurationHelper; import com.azure.core.annotation.Fluent; @@ -21,6 +21,7 @@ public final class AnomalyAlertConfiguration { private MetricAnomalyAlertConfigurationsOperator crossMetricsOperator; private List metricAnomalyAlertConfigurations; private List hookIds; + private List splitAlertByDimensions; static { AnomalyAlertConfigurationHelper.setAccessor((configuration, id) -> { @@ -106,6 +107,15 @@ public List getIdOfHooksToAlert() { return Collections.unmodifiableList(this.hookIds); } + /** + * Gets dimensions that receives alerts triggered by this configuration. + * + * @return The hook ids. + */ + public List getDimensionsToAlert() { + return Collections.unmodifiableList(this.splitAlertByDimensions); + } + /** * Sets the description for the configuration. * @@ -200,6 +210,22 @@ public AnomalyAlertConfiguration setIdOfHooksToAlert(List hookIds) { return this; } + /** + * Sets the dimensionsToAlert to receives alerts triggered by this configuration. + * + * @param dimensionsToAlert The hook ids. + * + * @return The AnomalyAlertConfiguration object itself. + */ + public AnomalyAlertConfiguration setDimensionsToAlert(List dimensionsToAlert) { + if (splitAlertByDimensions == null) { + this.splitAlertByDimensions = new ArrayList<>(); + } else { + this.splitAlertByDimensions = dimensionsToAlert; + } + return this; + } + void setId(String id) { this.id = id; } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyDetectionConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyDetectionConfiguration.java similarity index 97% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyDetectionConfiguration.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyDetectionConfiguration.java index c4e8ab1a95bd..94d93d0fdbd7 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyDetectionConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyDetectionConfiguration.java @@ -1,9 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.ai.metricsadvisor.implementation.util.AnomalyDetectionConfigurationHelper; +import com.azure.ai.metricsadvisor.models.DimensionKey; +import com.azure.core.annotation.Fluent; import java.util.ArrayList; import java.util.Collections; @@ -12,6 +14,7 @@ /** * Configuration to detect anomalies in metric time series. */ +@Fluent public final class AnomalyDetectionConfiguration { private String id; private String metricId; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyDetectorDirection.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyDetectorDirection.java similarity index 95% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyDetectorDirection.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyDetectorDirection.java index afe39fc41913..7f8fca4c90fc 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyDetectorDirection.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalyDetectorDirection.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalySeverity.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalySeverity.java similarity index 95% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalySeverity.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalySeverity.java index 515fbae35bcc..2b061067e0ce 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalySeverity.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AnomalySeverity.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureAppInsightsDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureAppInsightsDataFeedSource.java similarity index 96% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureAppInsightsDataFeedSource.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureAppInsightsDataFeedSource.java index 8f567c6a70c7..c92c8c174a39 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureAppInsightsDataFeedSource.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureAppInsightsDataFeedSource.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Immutable; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureBlobDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureBlobDataFeedSource.java new file mode 100644 index 000000000000..c209877adda8 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureBlobDataFeedSource.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.ai.metricsadvisor.implementation.util.AzureBlobDataFeedSourceAccessor; +import com.azure.core.annotation.Immutable; + +/** + * The AzureBlobDataFeedSource model. + */ +@Immutable +public final class AzureBlobDataFeedSource extends DataFeedSource { + /* + * Azure Blob connection string + */ + private final String connectionString; + + /* + * Container + */ + private final String container; + + /* + * Blob Template + */ + private final String blobTemplate; + + /* + * The authentication type to access the data source. + */ + private final DatasourceAuthenticationType authType; + + static { + AzureBlobDataFeedSourceAccessor.setAccessor( + new AzureBlobDataFeedSourceAccessor.Accessor() { + @Override + public String getConnectionString(AzureBlobDataFeedSource feedSource) { + return feedSource.getConnectionString(); + } + }); + } + + /** + * Create a AzureBlobDataFeedSource instance. + * + * @param connectionString the Azure Blob connection string + * @param container the container name + * @param blobTemplate the blob template name + */ + private AzureBlobDataFeedSource(final String connectionString, + final String container, + final String blobTemplate, + final DatasourceAuthenticationType authType) { + this.connectionString = connectionString; + this.container = container; + this.blobTemplate = blobTemplate; + this.authType = authType; + } + + /** + * Create a AzureBlobDataFeedSource with credential included in the {@code connectionString} as plain text. + * + * @param connectionString the Azure Blob connection string + * @param container the container name + * @param blobTemplate the blob template name + * + * @return The AzureBlobDataFeedSource. + */ + public static AzureBlobDataFeedSource fromBasicCredential(final String connectionString, + final String container, + final String blobTemplate) { + return new AzureBlobDataFeedSource(connectionString, container, blobTemplate, DatasourceAuthenticationType.BASIC); + } + + /** + * Create a SQLServerDataFeedSource with the {@code connectionString} containing the resource + * id of the SQL server on which metrics advisor has MSI access. + * + * @param connectionString the Azure Blob connection string + * @param container the container name + * @param blobTemplate the blob template name + * + * @return The AzureBlobDataFeedSource. + */ + public static AzureBlobDataFeedSource fromManagedIdentityCredential(final String connectionString, + final String container, + final String blobTemplate) { + return new AzureBlobDataFeedSource(connectionString, + container, + blobTemplate, + DatasourceAuthenticationType.MANAGED_IDENTITY); + } + + /** + * Get the container name. + * + * @return the container value. + */ + public String getContainer() { + return this.container; + } + + /** + * Get the blob template name. + * + * @return the blobTemplate value. + */ + public String getBlobTemplate() { + return this.blobTemplate; + } + + /** + * Gets the authentication type to access the data source. + * + * @return The authentication type. + */ + public DatasourceAuthenticationType getAuthenticationType() { + return this.authType; + } + + private String getConnectionString() { + return this.connectionString; + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureCosmosDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureCosmosDbDataFeedSource.java similarity index 60% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureCosmosDataFeedSource.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureCosmosDbDataFeedSource.java index cd63921a7239..b8ce7f0cff18 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureCosmosDataFeedSource.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureCosmosDbDataFeedSource.java @@ -1,15 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; +import com.azure.ai.metricsadvisor.implementation.util.AzureCosmosDbDataFeedSourceAccessor; import com.azure.core.annotation.Immutable; /** - * The AzureCosmosDataFeedSource model. + * The AzureCosmosDbDataFeedSource model. */ @Immutable -public final class AzureCosmosDataFeedSource extends DataFeedSource { +public final class AzureCosmosDbDataFeedSource extends DataFeedSource { /* * Azure CosmosDB connection string */ @@ -30,31 +31,34 @@ public final class AzureCosmosDataFeedSource extends DataFeedSource { */ private final String collectionId; + static { + AzureCosmosDbDataFeedSourceAccessor.setAccessor( + new AzureCosmosDbDataFeedSourceAccessor.Accessor() { + @Override + public String getConnectionString(AzureCosmosDbDataFeedSource feedSource) { + return feedSource.getConnectionString(); + } + }); + } + /** - * Create a AzureCosmosDataFeedSource instance + * Create a AzureCosmosDataFeedSource. * * @param connectionString the Azure CosmosDB connection string. * @param sqlQuery the query script. * @param database the database name. * @param collectionId the collection Id value. */ - public AzureCosmosDataFeedSource(final String connectionString, final String sqlQuery, final String database, - final String collectionId) { + public AzureCosmosDbDataFeedSource(final String connectionString, + final String sqlQuery, + final String database, + final String collectionId) { this.connectionString = connectionString; this.sqlQuery = sqlQuery; this.database = database; this.collectionId = collectionId; } - /** - * Get the connectionString property: Azure CosmosDB connection string. - * - * @return the connectionString value. - */ - public String getConnectionString() { - return this.connectionString; - } - /** * Get the sqlQuery property: Query script. * @@ -84,4 +88,7 @@ public String getCollectionId() { return this.collectionId; } + private String getConnectionString() { + return this.connectionString; + } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataExplorerDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataExplorerDataFeedSource.java new file mode 100644 index 000000000000..79c4bfe9fd1d --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataExplorerDataFeedSource.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.ai.metricsadvisor.implementation.util.AzureDataExplorerDataFeedSourceAccessor; +import com.azure.core.annotation.Immutable; + +/** + * The AzureDataExplorerDataFeedSource model. + */ +@Immutable +public final class AzureDataExplorerDataFeedSource extends DataFeedSource { + /* + * Database connection string + */ + private final String connectionString; + + /* + * Query script + */ + private final String query; + + /* + * The id of the credential resource to authenticate the data source. + */ + private final String credentialId; + + /* + * The authentication type to access the data source. + */ + private final DatasourceAuthenticationType authType; + + static { + AzureDataExplorerDataFeedSourceAccessor.setAccessor( + new AzureDataExplorerDataFeedSourceAccessor.Accessor() { + @Override + public String getConnectionString(AzureDataExplorerDataFeedSource feedSource) { + return feedSource.getConnectionString(); + } + }); + } + + private AzureDataExplorerDataFeedSource(final String connectionString, + final String query, + final String credentialId, + final DatasourceAuthenticationType authType) { + this.connectionString = connectionString; + this.query = query; + this.credentialId = credentialId; + this.authType = authType; + } + + /** + * Create a AzureDataExplorerDataFeedSource with credential included in the {@code connectionString} as plain text. + * + * @param connectionString The connection string. + * @param query The query that retrieves the values to be analyzed for anomalies. + * + * @return The AzureDataExplorerDataFeedSource. + */ + public static AzureDataExplorerDataFeedSource fromBasicCredential(final String connectionString, + final String query) { + return new AzureDataExplorerDataFeedSource(connectionString, query, null, DatasourceAuthenticationType.BASIC); + } + + /** + * Create a AzureDataExplorerDataFeedSource with the {@code connectionString} containing the resource + * id of the SQL server on which metrics advisor has MSI access. + * + * @param connectionString The connection string. + * @param query The query that retrieves the values to be analyzed for anomalies. + * + * @return The AzureDataExplorerDataFeedSource. + */ + public static AzureDataExplorerDataFeedSource fromManagedIdentityCredential(final String connectionString, + final String query) { + return new AzureDataExplorerDataFeedSource(connectionString, + query, + null, + DatasourceAuthenticationType.MANAGED_IDENTITY); + } + + /** + * Create a AzureDataExplorerDataFeedSource with the {@code credentialId} identifying a credential + * entity of type {@link DatasourceServicePrincipal}, the entity contains + * Service Principal to access the SQL Server. + * + * @param connectionString The connection string. + * @param query The query that retrieves the values to be analyzed for anomalies. + * @param credentialId The unique id of a credential entity of type + * {@link DatasourceServicePrincipal}. + * + * @return The SQLServerDataFeedSource. + */ + public static AzureDataExplorerDataFeedSource fromServicePrincipalCredential(final String connectionString, + final String query, + final String credentialId) { + return new AzureDataExplorerDataFeedSource(connectionString, + query, + credentialId, + DatasourceAuthenticationType.SERVICE_PRINCIPAL); + } + + /** + * Create a AzureDataExplorerDataFeedSource with the {@code credentialId} identifying a credential + * entity of type {@link DatasourceServicePrincipalInKeyVault}, the entity contains + * details of the KeyVault holding the Service Principal to access the SQL Server. + * + * @param connectionString The connection string. + * @param query The query that retrieves the values to be analyzed for anomalies. + * @param credentialId The unique id of a credential entity of type + * {@link DatasourceServicePrincipalInKeyVault}. + * + * @return The AzureDataExplorerDataFeedSource. + */ + public static AzureDataExplorerDataFeedSource fromServicePrincipalInKeyVaultCredential( + final String connectionString, + final String query, + final String credentialId) { + return new AzureDataExplorerDataFeedSource(connectionString, + query, + credentialId, + DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); + } + + /** + * Get the query property: Query script. + * + * @return the query value. + */ + public String getQuery() { + return this.query; + } + + /** + * Gets the id of the {@link DatasourceCredentialEntity credential resource} to authenticate the data source. + * + * @return The credential resource id. + */ + public String getCredentialId() { + return this.credentialId; + } + + /** + * Gets the authentication type to access the data source. + * + * @return The authentication type. + */ + public DatasourceAuthenticationType getAuthenticationType() { + return this.authType; + } + + private String getConnectionString() { + return this.connectionString; + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataLakeStorageGen2DataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataLakeStorageGen2DataFeedSource.java new file mode 100644 index 000000000000..46935d2bbfd7 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureDataLakeStorageGen2DataFeedSource.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.ai.metricsadvisor.implementation.util.AzureDataLakeStorageGen2DataFeedSourceAccessor; +import com.azure.core.annotation.Immutable; + +/** + * The AzureDataLakeStorageGen2DataFeedSource model. + */ +@Immutable +public final class AzureDataLakeStorageGen2DataFeedSource extends DataFeedSource { + /* + * Account name + */ + private final String accountName; + + /* + * Account key + */ + private final String accountKey; + + /* + * File system name (Container) + */ + private final String fileSystemName; + + /* + * Directory template + */ + private final String directoryTemplate; + + /* + * File template + */ + private final String fileTemplate; + + /* + * The id of the credential resource to authenticate the data source. + */ + private final String credentialId; + + /* + * The authentication type to access the data source. + */ + private final DatasourceAuthenticationType authType; + + static { + AzureDataLakeStorageGen2DataFeedSourceAccessor.setAccessor( + new AzureDataLakeStorageGen2DataFeedSourceAccessor.Accessor() { + @Override + public String getAccountKey(AzureDataLakeStorageGen2DataFeedSource feedSource) { + return feedSource.getAccountKey(); + } + }); + } + + private AzureDataLakeStorageGen2DataFeedSource(final String accountName, + final String accountKey, + final String fileSystemName, + final String directoryTemplate, + final String fileTemplate, + final String credentialId, + final DatasourceAuthenticationType authType) { + this.accountName = accountName; + this.accountKey = accountKey; + this.fileSystemName = fileSystemName; + this.directoryTemplate = directoryTemplate; + this.fileTemplate = fileTemplate; + this.credentialId = credentialId; + this.authType = authType; + } + + /** + * Create a AzureDataLakeStorageGen2DataFeedSource with the given {@code accountKey} for authentication. + * + * @param accountName the name of the storage account. + * @param accountKey the key of the storage account. + * @param fileSystemName the file system name. + * @param directoryTemplate the directory template of the storage account. + * @param fileTemplate the file template. + * + * @return The AzureDataLakeStorageGen2DataFeedSource. + */ + public static AzureDataLakeStorageGen2DataFeedSource fromBasicCredential(final String accountName, + final String accountKey, + final String fileSystemName, + final String directoryTemplate, + final String fileTemplate) { + return new AzureDataLakeStorageGen2DataFeedSource(accountName, + accountKey, + fileSystemName, + directoryTemplate, + fileTemplate, + null, + DatasourceAuthenticationType.BASIC); + } + + /** + * Create a AzureDataLakeStorageGen2DataFeedSource with the {@code credentialId} identifying + * a credential entity of type {@link DatasourceSqlServerConnectionString} that contains + * the shared access key. + * + * @param accountName the name of the storage account. + * @param fileSystemName the file system name. + * @param directoryTemplate the directory template of the storage account. + * @param fileTemplate the file template. + * @param credentialId The unique id of a credential entity of type + * {@link DatasourceDataLakeGen2SharedKey}. + * + * @return The AzureDataLakeStorageGen2DataFeedSource. + */ + public static AzureDataLakeStorageGen2DataFeedSource fromSharedKeyCredential( + final String accountName, + final String fileSystemName, + final String directoryTemplate, + final String fileTemplate, + final String credentialId) { + return new AzureDataLakeStorageGen2DataFeedSource(accountName, + null, + fileSystemName, + directoryTemplate, + fileTemplate, + credentialId, + DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); + } + + /** + * Create a AzureDataLakeStorageGen2DataFeedSource with the {@code credentialId} + * identifying a credential entity of type {@link DatasourceServicePrincipal}, + * the entity contains Service Principal to access the Data Lake storage. + * + * @param accountName the name of the storage account. + * @param fileSystemName the file system name. + * @param directoryTemplate the directory template of the storage account. + * @param fileTemplate the file template. + * @param credentialId The unique id of a credential entity of type + * {@link DatasourceServicePrincipal}. + * + * @return The AzureDataLakeStorageGen2DataFeedSource. + */ + public static AzureDataLakeStorageGen2DataFeedSource fromServicePrincipalCredential(final String accountName, + final String fileSystemName, + final String directoryTemplate, + final String fileTemplate, + final String credentialId) { + return new AzureDataLakeStorageGen2DataFeedSource(accountName, + null, + fileSystemName, + directoryTemplate, + fileTemplate, + credentialId, + DatasourceAuthenticationType.SERVICE_PRINCIPAL); + } + + /** + * Create a AzureDataLakeStorageGen2DataFeedSource with the {@code credentialId} identifying + * a credential entity of type {@link DatasourceServicePrincipalInKeyVault}, the entity + * contains details of the KeyVault holding the Service Principal to access the Data Lake storage. + * + * @param accountName the name of the storage account. + * @param fileSystemName the file system name. + * @param directoryTemplate the directory template of the storage account. + * @param fileTemplate the file template. + * @param credentialId The unique id of a credential entity of type + * {@link DatasourceServicePrincipalInKeyVault} + * + * @return The AzureDataLakeStorageGen2DataFeedSource. + */ + public static AzureDataLakeStorageGen2DataFeedSource fromServicePrincipalInKeyVaultCredential( + final String accountName, + final String fileSystemName, + final String directoryTemplate, + final String fileTemplate, + final String credentialId) { + return new AzureDataLakeStorageGen2DataFeedSource(accountName, + null, + fileSystemName, + directoryTemplate, + fileTemplate, + credentialId, + DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); + } + + /** + * Get the the account name for the AzureDataLakeStorageGen2DataFeedSource. + * + * @return the accountName value. + */ + public String getAccountName() { + return this.accountName; + } + + /** + * Get the file system name or the container name. + * + * @return the fileSystemName value. + */ + public String getFileSystemName() { + return this.fileSystemName; + } + + /** + * Get the directory template. + * + * @return the directoryTemplate value. + */ + public String getDirectoryTemplate() { + return this.directoryTemplate; + } + + /** + * Get the file template. + * + * @return the fileTemplate value. + */ + public String getFileTemplate() { + return this.fileTemplate; + } + + /** + * Gets the id of the {@link DatasourceCredentialEntity credential resource} to authenticate the data source. + * + * @return The credential resource id. + */ + public String getCredentialId() { + return this.credentialId; + } + + /** + * Gets the authentication type to access the data source. + * + * @return The authentication type. + */ + public DatasourceAuthenticationType getAuthenticationType() { + return this.authType; + } + + private String getAccountKey() { + return this.accountKey; + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureEventHubsDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureEventHubsDataFeedSource.java similarity index 66% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureEventHubsDataFeedSource.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureEventHubsDataFeedSource.java index 6db59ca5d855..41c0822f837e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureEventHubsDataFeedSource.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureEventHubsDataFeedSource.java @@ -1,8 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; +import com.azure.ai.metricsadvisor.implementation.util.AzureEventHubsDataFeedSourceAccessor; import com.azure.core.annotation.Immutable; /** @@ -19,6 +20,16 @@ public final class AzureEventHubsDataFeedSource extends DataFeedSource { */ private final String consumerGroup; + static { + AzureEventHubsDataFeedSourceAccessor.setAccessor( + new AzureEventHubsDataFeedSourceAccessor.Accessor() { + @Override + public String getConnectionString(AzureEventHubsDataFeedSource feedSource) { + return feedSource.getConnectionString(); + } + }); + } + /** * Create a AzureEventHubsDataFeedSource instance * @@ -30,15 +41,6 @@ public AzureEventHubsDataFeedSource(final String connectionString, final String this.consumerGroup = consumerGroup; } - /** - * Gets the Azure EventHub connection string. - * - * @return the connectionString value. - */ - public String getConnectionString() { - return this.connectionString; - } - /** * Gets the Azure EventHub consumer group. * @@ -47,4 +49,8 @@ public String getConnectionString() { public String getConsumerGroup() { return this.consumerGroup; } + + private String getConnectionString() { + return this.connectionString; + } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureLogAnalyticsDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureLogAnalyticsDataFeedSource.java new file mode 100644 index 000000000000..2fafb3b63f26 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureLogAnalyticsDataFeedSource.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.ai.metricsadvisor.implementation.util.AzureLogAnalyticsDataFeedSourceAccessor; +import com.azure.core.annotation.Immutable; + +/** The AzureLogAnalyticsDataFeedSource model. */ +@Immutable +public final class AzureLogAnalyticsDataFeedSource extends DataFeedSource { + /* + * The tenant id of service principal that have access to this Log + * Analytics + */ + private final String tenantId; + + /* + * The client id of service principal that have access to this Log + * Analytics + */ + private final String clientId; + + /* + * The client secret of service principal that have access to this Log + * Analytics + */ + private final String clientSecret; + + /* + * The workspace id of this Log Analytics + */ + private final String workspaceId; + + /* + * The KQL (Kusto Query Language) query to fetch data from this Log + * Analytics + */ + private final String query; + + /* + * The id of the credential resource to authenticate the data source. + */ + private final String credentialId; + + /* + * The authentication type to access the data source. + */ + private final DatasourceAuthenticationType authType; + + static { + AzureLogAnalyticsDataFeedSourceAccessor.setAccessor( + new AzureLogAnalyticsDataFeedSourceAccessor.Accessor() { + @Override + public String getClientSecret(AzureLogAnalyticsDataFeedSource feedSource) { + return feedSource.getClientSecret(); + } + }); + } + + private AzureLogAnalyticsDataFeedSource(final String tenantId, + final String clientId, + final String clientSecret, + final String workspaceId, + final String query, + final String credentialId, + final DatasourceAuthenticationType authType) { + this.tenantId = tenantId; + this.clientId = clientId; + this.clientSecret = clientSecret; + this.workspaceId = workspaceId; + this.query = query; + this.credentialId = credentialId; + this.authType = authType; + } + + /** + * Create a AzureLogAnalyticsDataFeedSource with the given {@code tenantId}, {@code clientId} and + * {@code clientSecret} for authentication. + * + * @param tenantId The tenant id of service principal that have access to this Log Analytics. + * @param clientId The client id of service principal that have access to this Log Analytics. + * @param clientSecret The client secret of service principal that have access to this Log Analytics. + * @param workspaceId the query script. + * @param query the KQL (Kusto Query Language) query to fetch data from this Log + * Analytics. + * + * @return The AzureLogAnalyticsDataFeedSource. + */ + public static AzureLogAnalyticsDataFeedSource fromBasicCredential(final String tenantId, + final String clientId, + final String clientSecret, + final String workspaceId, + final String query) { + return new AzureLogAnalyticsDataFeedSource(tenantId, + clientId, + clientSecret, + workspaceId, + query, + null, + DatasourceAuthenticationType.BASIC); + } + + /** + * Create a AzureLogAnalyticsDataFeedSource with the {@code credentialId} identifying + * a credential entity of type {@link DatasourceServicePrincipal}, the entity + * contains details of the KeyVault holding the Service Principal to access the Data Lake storage. + * + * @param workspaceId the query script. + * @param query the KQL (Kusto Query Language) query to fetch data from this Log Analytics. + * @param credentialId The unique id of a credential entity of type + * + * @return The AzureLogAnalyticsDataFeedSource. + */ + public static AzureLogAnalyticsDataFeedSource fromServicePrincipalCredential(final String workspaceId, + final String query, + final String credentialId) { + return new AzureLogAnalyticsDataFeedSource(null, + null, + null, + workspaceId, + query, + credentialId, + DatasourceAuthenticationType.SERVICE_PRINCIPAL); + } + + /** + * Create a AzureLogAnalyticsDataFeedSource with the {@code credentialId} identifying + * a credential entity of type {@link DatasourceServicePrincipalInKeyVault}, the entity + * contains details of the KeyVault holding the Service Principal to access the Data Lake storage. + * + * @param workspaceId the query script. + * @param query the KQL (Kusto Query Language) query to fetch data from this Log Analytics. + * @param credentialId The unique id of a credential entity of type + * + * @return The AzureLogAnalyticsDataFeedSource. + */ + public static AzureLogAnalyticsDataFeedSource fromServicePrincipalInKeyVaultCredential( + final String workspaceId, + final String query, + final String credentialId) { + return new AzureLogAnalyticsDataFeedSource(null, + null, + null, + workspaceId, + query, + credentialId, + DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); + } + + /** + * Get the tenantId property: The tenant id of service principal that have access to this Log Analytics. + * + * @return the tenantId value. + */ + public String getTenantId() { + return this.tenantId; + } + + /** + * Get the clientId property: The client id of service principal that have access to this Log Analytics. + * + * @return the clientId value. + */ + public String getClientId() { + return this.clientId; + } + + /** + * Get the workspaceId property: The workspace id of this Log Analytics. + * + * @return the workspaceId value. + */ + public String getWorkspaceId() { + return this.workspaceId; + } + + /** + * Get the query property: The KQL (Kusto Query Language) query to fetch data from this Log Analytics. + * + * @return the query value. + */ + public String getQuery() { + return this.query; + } + + /** + * Gets the id of the {@link DatasourceCredentialEntity credential resource} to authenticate the data source. + * + * @return The credential resource id. + */ + public String getCredentialId() { + return this.credentialId; + } + + /** + * Gets the authentication type to access the data source. + * + * @return The authentication type. + */ + public DatasourceAuthenticationType getAuthenticationType() { + return this.authType; + } + + private String getClientSecret() { + return this.clientSecret; + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureTableDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureTableDataFeedSource.java similarity index 71% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureTableDataFeedSource.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureTableDataFeedSource.java index 33a942675588..639f76f58d0d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureTableDataFeedSource.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/AzureTableDataFeedSource.java @@ -1,8 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; +import com.azure.ai.metricsadvisor.implementation.util.AzureTableDataFeedSourceAccessor; import com.azure.core.annotation.Immutable; /** @@ -25,6 +26,16 @@ public final class AzureTableDataFeedSource extends DataFeedSource { */ private final String table; + static { + AzureTableDataFeedSourceAccessor.setAccessor( + new AzureTableDataFeedSourceAccessor.Accessor() { + @Override + public String getConnectionString(AzureTableDataFeedSource feedSource) { + return feedSource.getConnectionString(); + } + }); + } + /** * Create a AzureTableDataFeedSource instance. * @@ -38,15 +49,6 @@ public AzureTableDataFeedSource(final String connectionString, final String scri this.table = table; } - /** - * Get the connectionString property: Azure Table connection string. - * - * @return the connectionString value. - */ - public String getConnectionString() { - return this.connectionString; - } - /** * Get the script property: Query script. * @@ -64,4 +66,8 @@ public String getQueryScript() { public String getTableName() { return this.table; } + + private String getConnectionString() { + return this.connectionString; + } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/BoundaryDirection.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/BoundaryDirection.java new file mode 100644 index 000000000000..cbfe1341058b --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/BoundaryDirection.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.core.util.ExpandableStringEnum; + +import java.util.Collection; + +/** + * Describes the direction of boundary used in anomaly boundary conditions. + */ +public final class BoundaryDirection extends ExpandableStringEnum { + /** + * Defines the lower boundary in a boundary condition. + */ + public static final BoundaryDirection LOWER = fromString("LOWER"); + /** + * Defines the upper boundary in a boundary condition. + */ + public static final BoundaryDirection UPPER = fromString("UPPER"); + /** + * Defines both lower and upper boundary in a boundary condition. + */ + public static final BoundaryDirection BOTH = fromString("BOTH"); + + /** + * Creates or finds a BoundaryDirection from its string representation. + * + * @param name a name to look for. + * + * @return the corresponding BoundaryDirection. + */ + public static BoundaryDirection fromString(String name) { + return fromString(name, BoundaryDirection.class); + } + + /** + * @return known BoundaryDirection values. + */ + public static Collection values() { + return values(BoundaryDirection.class); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ChangeThresholdCondition.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ChangeThresholdCondition.java similarity index 98% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ChangeThresholdCondition.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ChangeThresholdCondition.java index de42c851a7a4..766adb156073 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ChangeThresholdCondition.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ChangeThresholdCondition.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeed.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeed.java similarity index 99% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeed.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeed.java index b1366e6f7c61..dea6bac5a1a6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeed.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeed.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.ai.metricsadvisor.implementation.util.DataFeedHelper; import com.azure.core.annotation.Fluent; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedAccessMode.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedAccessMode.java similarity index 94% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedAccessMode.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedAccessMode.java index d9e10b2899cb..5385fd33c2a0 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedAccessMode.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedAccessMode.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.util.ExpandableStringEnum; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedAutoRollUpMethod.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedAutoRollUpMethod.java similarity index 96% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedAutoRollUpMethod.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedAutoRollUpMethod.java index 30ab0ecea82e..01d37db24d5e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedAutoRollUpMethod.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedAutoRollUpMethod.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.util.ExpandableStringEnum; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedDimension.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedDimension.java similarity index 96% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedDimension.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedDimension.java index 99352e1de42c..5888a5b7600a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedDimension.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedDimension.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedGranularity.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedGranularity.java similarity index 96% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedGranularity.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedGranularity.java index ac094cb255d6..7ede4aaebff2 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedGranularity.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedGranularity.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Fluent; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedGranularityType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedGranularityType.java similarity index 90% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedGranularityType.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedGranularityType.java index 8e285f3d89a2..717f8e04897d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedGranularityType.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedGranularityType.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.util.ExpandableStringEnum; @@ -41,11 +41,6 @@ public final class DataFeedGranularityType extends ExpandableStringEnum { + /** + * Enum value NoRollup. + */ + public static final DataFeedRollupType NO_ROLLUP = fromString("NoRollup"); + + /** + * Enum value NeedRollup. + */ + public static final DataFeedRollupType AUTO_ROLLUP = fromString("NeedRollup"); + + /** + * Enum value AlreadyRollup. + */ + public static final DataFeedRollupType ALREADY_ROLLUP = fromString("AlreadyRollup"); + + /** + * Creates or finds a DataFeedRollupType from its string representation. + * + * @param name a name to look for. + * + * @return the corresponding DataFeedRollupType. + */ + public static DataFeedRollupType fromString(String name) { + return fromString(name, DataFeedRollupType.class); + } + + /** + * @return known DataFeedRollupType values. + */ + public static Collection values() { + return values(DataFeedRollupType.class); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSchema.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSchema.java similarity index 97% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSchema.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSchema.java index 107b4b132a82..e7d1b3851cef 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSchema.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSchema.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Fluent; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSource.java new file mode 100644 index 000000000000..03ef40cb5b76 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSource.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.ai.metricsadvisor.models.InfluxDbDataFeedSource; + +/** + * The {@link DataFeedSource} represents the base type for different + * types of data sources that service can ingest data and perform + * anomaly detection. + * + * @see AzureAppInsightsDataFeedSource + * @see AzureBlobDataFeedSource + * @see AzureCosmosDbDataFeedSource + * @see AzureDataExplorerDataFeedSource + * @see AzureDataLakeStorageGen2DataFeedSource + * @see AzureEventHubsDataFeedSource + * @see AzureLogAnalyticsDataFeedSource + * @see AzureTableDataFeedSource + * @see InfluxDbDataFeedSource + * @see MongoDbDataFeedSource + * @see MySqlDataFeedSource + * @see PostgreSqlDataFeedSource + * @see SqlServerDataFeedSource + */ +public abstract class DataFeedSource { + // No common properties, used only as discriminator type. +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSourceType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSourceType.java new file mode 100644 index 000000000000..45c6b7ce23a3 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedSourceType.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.core.util.ExpandableStringEnum; + +import java.util.Collection; + +/** + * Defines values for all supported data sources types. + */ +public final class DataFeedSourceType extends ExpandableStringEnum { + + /** + * Static value AzureApplicationInsights for DataFeedSourceType. + */ + public static final DataFeedSourceType AZURE_APP_INSIGHTS = fromString("AzureApplicationInsights"); + + /** + * Static value AzureBlob for DataFeedSourceType. + */ + public static final DataFeedSourceType AZURE_BLOB = fromString("AzureBlob"); + + /** + * Static value AzureDataExplorer for DataFeedSourceType.. + */ + public static final DataFeedSourceType AZURE_DATA_EXPLORER = fromString("AzureDataExplorer"); + + /** + * Static value AzureEventHubs for DataFeedSourceType.. + */ + public static final DataFeedSourceType AZURE_EVENT_HUBS = fromString("AzureEventHubs"); + + /** + * Static value AzureTable for DataFeedSourceType.. + */ + public static final DataFeedSourceType AZURE_TABLE = fromString("AzureTable"); + + /** + * Static value InfluxDB for DataFeedSourceType.. + */ + public static final DataFeedSourceType INFLUX_DB = fromString("InfluxDB"); + + /** + * Static value MongoDB for DataFeedSourceType.. + */ + public static final DataFeedSourceType MONGO_DB = fromString("MongoDB"); + + /** + * Static value MySql for DataFeedSourceType.. + */ + public static final DataFeedSourceType MYSQL_DB = fromString("MySql"); + + /** + * Static value PostgreSql for DataFeedSourceType.. + */ + public static final DataFeedSourceType POSTGRE_SQL_DB = fromString("PostgreSql"); + + /** + * Static value SqlServer. + */ + public static final DataFeedSourceType SQL_SERVER_DB = fromString("SqlServer"); + + /** + * Static value AzureCosmosDB for DataFeedSourceType.. + */ + public static final DataFeedSourceType AZURE_COSMOS_DB = fromString("AzureCosmosDB"); + + /** + * Enum value AzureDataLakeStorageGen2 for DataFeedSourceType.. + */ + public static final DataFeedSourceType AZURE_DATA_LAKE_STORAGE_GEN2 = fromString("AzureDataLakeStorageGen2"); + + /** + * Enum value AzureLogAnalytics for DataFeedSourceType.. + */ + public static final DataFeedSourceType AZURE_LOG_ANALYTICS = fromString("AzureLogAnalytics"); + + /** + * Creates or finds a DataFeedSourceType from its string representation. + * + * @param name a name to look for. + * + * @return the corresponding DataFeedSourceType. + */ + public static DataFeedSourceType fromString(String name) { + return fromString(name, DataFeedSourceType.class); + } + + /** + * @return known DataFeedSourceType values. + */ + public static Collection values() { + return values(DataFeedSourceType.class); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedStatus.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedStatus.java similarity index 95% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedStatus.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedStatus.java index ba1e977b3902..61e636577054 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedStatus.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DataFeedStatus.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceAuthenticationType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceAuthenticationType.java new file mode 100644 index 000000000000..537f8c700f60 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceAuthenticationType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; + +import java.util.Collection; + +/** Defines values for DataSourceAuthenticationType. */ +public final class DatasourceAuthenticationType extends ExpandableStringEnum { + /** Static value Basic for DataSourceAuthenticationType. */ + public static final DatasourceAuthenticationType BASIC = fromString("Basic"); + + /** Static value ManagedIdentity for DataSourceAuthenticationType. */ + public static final DatasourceAuthenticationType MANAGED_IDENTITY = fromString("ManagedIdentity"); + + /** Static value AzureSQLConnectionString for DataSourceAuthenticationType. */ + public static final DatasourceAuthenticationType AZURE_SQL_CONNECTION_STRING + = fromString("AzureSQLConnectionString"); + + /** Static value DataLakeGen2SharedKey for DataSourceAuthenticationType. */ + public static final DatasourceAuthenticationType DATA_LAKE_GEN2_SHARED_KEY = fromString("DataLakeGen2SharedKey"); + + /** Static value ServicePrincipal for DataSourceAuthenticationType. */ + public static final DatasourceAuthenticationType SERVICE_PRINCIPAL = fromString("ServicePrincipal"); + + /** Static value ServicePrincipalInKV for DataSourceAuthenticationType. */ + public static final DatasourceAuthenticationType SERVICE_PRINCIPAL_IN_KV = fromString("ServicePrincipalInKV"); + + /** + * Creates or finds a AuthenticationTypeEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthenticationTypeEnum. + */ + @JsonCreator + public static DatasourceAuthenticationType fromString(String name) { + return fromString(name, DatasourceAuthenticationType.class); + } + + /** @return known AuthenticationTypeEnum values. */ + public static Collection values() { + return values(DatasourceAuthenticationType.class); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceCredentialEntity.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceCredentialEntity.java new file mode 100644 index 000000000000..a998b7c73c5e --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceCredentialEntity.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +/** + * The base credential type for different types of authentication + * that service uses to access the data sources {@link DataFeedSource}. + * + * @see DatasourceDataLakeGen2SharedKey + * @see DatasourceServicePrincipal + * @see DatasourceServicePrincipalInKeyVault + * @see DatasourceSqlServerConnectionString + */ +public abstract class DatasourceCredentialEntity { + /** + * Gets the credential id. + * + * @return The credential id. + */ + public abstract String getId(); + /** + * Gets the credential name. + * + * @return The credential name. + */ + public abstract String getName(); + /** + * Gets the credential description. + * + * @return The credential description. + */ + public abstract String getDescription(); +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceDataLakeGen2SharedKey.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceDataLakeGen2SharedKey.java new file mode 100644 index 000000000000..4b8cb5e11edf --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceDataLakeGen2SharedKey.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.ai.metricsadvisor.implementation.util.DataSourceDataLakeGen2SharedKeyAccessor; +import com.azure.core.annotation.Fluent; + +/** + * The shared key credential entity for DataLakeGen2. + */ +@Fluent +public final class DatasourceDataLakeGen2SharedKey extends DatasourceCredentialEntity { + private String id; + private String name; + private String description; + private String sharedKey; + + static { + DataSourceDataLakeGen2SharedKeyAccessor.setAccessor( + new DataSourceDataLakeGen2SharedKeyAccessor.Accessor() { + @Override + public void setId(DatasourceDataLakeGen2SharedKey entity, String id) { + entity.setId(id); + } + + @Override + public String getSharedKey(DatasourceDataLakeGen2SharedKey entity) { + return entity.getSharedKey(); + } + }); + } + + @Override + public String getId() { + return this.id; + } + + @Override + public String getName() { + return this.name; + } + + @Override + public String getDescription() { + return this.description; + } + + /** + * Creates DataSourceDataLakeGen2SharedKey. + * + * @param name The name + * @param sharedKey The shared key + */ + public DatasourceDataLakeGen2SharedKey(String name, String sharedKey) { + this.name = name; + this.sharedKey = sharedKey; + } + + /** + * Sets the name. + * + * @param name The name + * @return an updated object with name set + */ + public DatasourceDataLakeGen2SharedKey setName(String name) { + this.name = name; + return this; + } + + /** + * Sets the shared key. + * + * @param sharedKey The shared key + * @return an updated object with shared key set + */ + public DatasourceDataLakeGen2SharedKey setSharedKey(String sharedKey) { + this.sharedKey = sharedKey; + return this; + } + + /** + * Sets the description. + * + * @param description The description. + * @return an updated object with description set + */ + public DatasourceDataLakeGen2SharedKey setDescription(String description) { + this.description = description; + return this; + } + + private void setId(String id) { + this.id = id; + } + + private String getSharedKey() { + return this.sharedKey; + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipal.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipal.java new file mode 100644 index 000000000000..3f219a02b27e --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipal.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.ai.metricsadvisor.implementation.util.DataSourceServicePrincipalAccessor; +import com.azure.core.annotation.Fluent; + +/** + * The service principal credential entity for data source.. + */ +@Fluent +public final class DatasourceServicePrincipal extends DatasourceCredentialEntity { + private String id; + private String name; + private String description; + private String clientId; + private String tenantId; + private String clientSecret; + + static { + DataSourceServicePrincipalAccessor.setAccessor( + new DataSourceServicePrincipalAccessor.Accessor() { + @Override + public void setId(DatasourceServicePrincipal entity, String id) { + entity.setId(id); + } + + @Override + public String getClientSecret(DatasourceServicePrincipal entity) { + return entity.getClientSecret(); + } + }); + } + + @Override + public String getId() { + return this.id; + } + + @Override + public String getName() { + return this.name; + } + + @Override + public String getDescription() { + return this.description; + } + + /** + * Gets the client id. + * + * @return The client id. + */ + public String getClientId() { + return this.clientId; + } + + /** + * Gets the tenant id. + * + * @return The tenant id. + */ + public String getTenantId() { + return this.tenantId; + } + + /** + * Creates DataSourceServicePrincipal. + * + * @param name The name. + * @param clientId The client id. + * @param clientSecret The client secret. + * @param tenantId The tenant id. + */ + public DatasourceServicePrincipal(String name, String clientId, String tenantId, String clientSecret) { + this.name = name; + this.clientId = clientId; + this.tenantId = tenantId; + this.clientSecret = clientSecret; + } + + /** + * Sets the name. + * + * @param name The name + * @return an updated object with name set + */ + public DatasourceServicePrincipal setName(String name) { + this.name = name; + return this; + } + + /** + * Sets the client id. + * + * @param clientId The client id + * @return an updated object with client id set + */ + public DatasourceServicePrincipal setClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Sets the client secret. + * + * @param clientSecret The client secret + * @return an updated object with client secret set + */ + public DatasourceServicePrincipal setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Sets the tenant id. + * + * @param tenantId The tenant id + * @return an updated object with client teant id set + */ + public DatasourceServicePrincipal setTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Sets the description. + * + * @param description The description + * @return an updated object with description set + */ + public DatasourceServicePrincipal setDescription(String description) { + this.description = description; + return this; + } + + private void setId(String id) { + this.id = id; + } + + private String getClientSecret() { + return this.clientSecret; + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipalInKeyVault.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipalInKeyVault.java new file mode 100644 index 000000000000..339beb303d04 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceServicePrincipalInKeyVault.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.ai.metricsadvisor.implementation.util.DataSourceServicePrincipalInKeyVaultAccessor; +import com.azure.core.annotation.Fluent; + +/** + * The service principal stored in a key vault representing the credential entity for a data source. + */ +@Fluent +public final class DatasourceServicePrincipalInKeyVault extends DatasourceCredentialEntity { + private String id; + private String name; + private String description; + private String keyVaultEndpoint; + private String keyVaultClientId; + private String keyVaultClientSecret; + private String clientIdSecretName; + private String clientSecretName; + private String tenantId; + + static { + DataSourceServicePrincipalInKeyVaultAccessor.setAccessor( + new DataSourceServicePrincipalInKeyVaultAccessor.Accessor() { + @Override + public void setId(DatasourceServicePrincipalInKeyVault entity, String id) { + entity.setId(id); + } + + @Override + public String getKeyVaultClientSecret(DatasourceServicePrincipalInKeyVault entity) { + return entity.getKeyVaultClientSecret(); + } + }); + } + + @Override + public String getId() { + return this.id; + } + + @Override + public String getName() { + return this.name; + } + + @Override + public String getDescription() { + return this.description; + } + + /** + * Gets the endpoint to the KeyVault storing service principal. + * + * @return The KeyVault endpoint. + */ + public String getKeyVaultEndpoint() { + return this.keyVaultEndpoint; + } + + /** + * Gets the client id to access the KeyVault storing service principal. + * + * @return The client id to access the KeyVault. + */ + public String getKeyVaultClientId() { + return this.keyVaultClientId; + } + + /** + * Gets the tenant id of the service principal. + * + * @return The tenant id. + */ + public String getTenantId() { + return this.tenantId; + } + + /** + * Gets the name of the KeyVault secret holding client secret. + * + * @return The name of the KeyVault secret holding client secret + */ + public String getSecretNameForDatasourceClientId() { + return this.clientIdSecretName; + } + + /** + * Gets the name of the KeyVault secret holding client secret. + * + * @return The name of the KeyVault secret holding client secret + */ + public String getSecretNameForDatasourceClientSecret() { + return this.clientSecretName; + } + + /** + * Sets the name. + * + * @param name The name + * @return an updated object with name set + */ + public DatasourceServicePrincipalInKeyVault setName(String name) { + this.name = name; + return this; + } + + /** + * Sets the keyVault containing the data source secrets. + * + * @param keyVaultEndpoint The keyVault endpoint + * @param keyVaultClientId The client id to access the keyVault + * @param keyVaultClientSecret The client secret to access the keyVault + * @return an updated object + */ + public DatasourceServicePrincipalInKeyVault setKeyVaultForDatasourceSecrets(String keyVaultEndpoint, + String keyVaultClientId, + String keyVaultClientSecret) { + this.keyVaultEndpoint = keyVaultEndpoint; + this.keyVaultClientId = keyVaultClientId; + this.keyVaultClientSecret = keyVaultClientSecret; + return this; + } + + /** + * Sets the name of the keyvault secret holding client id. + * + * @param clientIdSecretName The secret name + * @return an updated object with client id secret name set + */ + public DatasourceServicePrincipalInKeyVault setSecretNameForDatasourceClientId(String clientIdSecretName) { + this.clientIdSecretName = clientIdSecretName; + return this; + } + + /** + * Sets the name of the keyvault secret holding client secret. + * + * @param clientSecretName The secret name + * @return an updated object with client secret name set + */ + public DatasourceServicePrincipalInKeyVault setSecretNameForDatasourceClientSecret(String clientSecretName) { + this.clientSecretName = clientSecretName; + return this; + } + + /** + * Sets the tenant id. + * + * @param tenantId The tenant id + * @return an updated object with client tenant id set + */ + public DatasourceServicePrincipalInKeyVault setTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Sets the description. + * + * @param description The description + * @return an updated object with description set + */ + public DatasourceServicePrincipalInKeyVault setDescription(String description) { + this.description = description; + return this; + } + + private void setId(String id) { + this.id = id; + } + + private String getKeyVaultClientSecret() { + return this.keyVaultClientSecret; + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceSqlServerConnectionString.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceSqlServerConnectionString.java new file mode 100644 index 000000000000..17270b34fece --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DatasourceSqlServerConnectionString.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.ai.metricsadvisor.implementation.util.DataSourceSqlServerConnectionStringAccessor; +import com.azure.core.annotation.Fluent; + +/** + * The connection credential entity for SQLServer. + */ +@Fluent +public final class DatasourceSqlServerConnectionString extends DatasourceCredentialEntity { + private String id; + private String name; + private String description; + private String connectionString; + + static { + DataSourceSqlServerConnectionStringAccessor.setAccessor( + new DataSourceSqlServerConnectionStringAccessor.Accessor() { + @Override + public void setId(DatasourceSqlServerConnectionString entity, String id) { + entity.setId(id); + } + + @Override + public String getConnectionString(DatasourceSqlServerConnectionString entity) { + return entity.getConnectionString(); + } + }); + } + + @Override + public String getId() { + return this.id; + } + + @Override + public String getName() { + return this.name; + } + + @Override + public String getDescription() { + return this.description; + } + + /** + * Creates DataSourceSqlServerConnectionString. + * + * @param name The name + * @param connectionString The connection string + */ + public DatasourceSqlServerConnectionString(String name, String connectionString) { + this.name = name; + this.connectionString = connectionString; + } + + /** + * Sets the name. + * + * @param name The name + * @return an updated object with name set + */ + public DatasourceSqlServerConnectionString setName(String name) { + this.name = name; + return this; + } + + /** + * Sets the connection string. + * + * @param connectionString The connection string + * @return an updated object with connection string set + */ + public DatasourceSqlServerConnectionString setConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Sets the description. + * + * @param description The description. + * @return an updated object with description set + */ + public DatasourceSqlServerConnectionString setDescription(String description) { + this .description = description; + return this; + } + + private void setId(String id) { + this.id = id; + } + + private String getConnectionString() { + return this.connectionString; + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DetectionConditionsOperator.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DetectionConditionsOperator.java similarity index 95% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DetectionConditionsOperator.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DetectionConditionsOperator.java index d51aa7232ea7..0cfbe84da790 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DetectionConditionsOperator.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/DetectionConditionsOperator.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.util.ExpandableStringEnum; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/EmailNotificationHook.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/EmailNotificationHook.java similarity index 97% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/EmailNotificationHook.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/EmailNotificationHook.java index fc54e0cf400d..0f96ef356811 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/EmailNotificationHook.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/EmailNotificationHook.java @@ -1,7 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.core.annotation.Fluent; import java.util.ArrayList; import java.util.Collections; @@ -12,6 +14,7 @@ /** * A hook that describes email based incident alerts notification. */ +@Fluent public final class EmailNotificationHook extends NotificationHook { private String name; private String description; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/HardThresholdCondition.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/HardThresholdCondition.java similarity index 98% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/HardThresholdCondition.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/HardThresholdCondition.java index 297ffac0fb40..6c6070f4eb3f 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/HardThresholdCondition.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/HardThresholdCondition.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/IngestionStatusType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/IngestionStatusType.java similarity index 97% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/IngestionStatusType.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/IngestionStatusType.java index 790e64861595..ffc4fcfffefd 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/IngestionStatusType.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/IngestionStatusType.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyAlertConfigsOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListAnomalyAlertConfigsOptions.java similarity index 96% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyAlertConfigsOptions.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListAnomalyAlertConfigsOptions.java index a064d801eb41..8845caa5e0e3 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyAlertConfigsOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListAnomalyAlertConfigsOptions.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Fluent; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListCredentialEntityOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListCredentialEntityOptions.java new file mode 100644 index 000000000000..b795c8c12aee --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListCredentialEntityOptions.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.core.annotation.Fluent; + +/** + * Additional properties for filtering results on the listCredentialEntities operation. + */ +@Fluent +public final class ListCredentialEntityOptions { + private Integer maxPageSize; + private Integer skip; + + /** + * Gets limit indicating the number of items that will be included in a service returned page. + * + * @return The maxPageSize value. + */ + public Integer getMaxPageSize() { + return this.maxPageSize; + } + + /** + * Sets limit indicating the number of items to be included in a service returned page. + * + * @param maxPageSize The maxPageSize value. + * + * @return The ListCredentialEntityOptions object itself. + */ + public ListCredentialEntityOptions setMaxPageSize(final int maxPageSize) { + this.maxPageSize = maxPageSize; + return this; + } + + /** + * Gets the number of items in the queried collection that will be skipped and not included + * in the returned result. + * + * @return The skip value. + */ + public Integer getSkip() { + return this.skip; + } + + /** + * Sets the number of items in the queried collection that are to be skipped and not included + * in the returned result. + * + * @param skip The skip value. + * + * @return ListCredentialEntityOptions itself. + */ + public ListCredentialEntityOptions setSkip(final int skip) { + this.skip = skip; + return this; + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedFilter.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedFilter.java similarity index 98% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedFilter.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedFilter.java index ccdb0beef75b..3afcf9bfe3ca 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedFilter.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedFilter.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Fluent; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedIngestionOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedIngestionOptions.java similarity index 95% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedIngestionOptions.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedIngestionOptions.java index 321be1d53129..57e8c832c55f 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedIngestionOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedIngestionOptions.java @@ -1,13 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.core.annotation.Fluent; import java.time.OffsetDateTime; /** * Describes the additional parameters for the API to list data feed ingestion status. */ +@Fluent public final class ListDataFeedIngestionOptions { private final OffsetDateTime startTime; private final OffsetDateTime endTime; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedOptions.java similarity index 97% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedOptions.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedOptions.java index 7b6f50c4376a..191c7aa74434 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListDataFeedOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListDataFeedOptions.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Fluent; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListHookOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListHookOptions.java similarity index 94% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListHookOptions.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListHookOptions.java index 16264221bc2d..3f8425f6bb9d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListHookOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListHookOptions.java @@ -1,11 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.core.annotation.Fluent; /** * Describes the additional parameters for the API to list hooks. */ +@Fluent public final class ListHookOptions { private String hookNameFilter; private Integer maxPageSize; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListMetricAnomalyDetectionConfigsOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListMetricAnomalyDetectionConfigsOptions.java similarity index 96% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListMetricAnomalyDetectionConfigsOptions.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListMetricAnomalyDetectionConfigsOptions.java index 58a3cdf233cb..d8bab4f9ec9a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListMetricAnomalyDetectionConfigsOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/ListMetricAnomalyDetectionConfigsOptions.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Fluent; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConditions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConditions.java similarity index 95% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConditions.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConditions.java index ee7c30ee81d8..66acbec15bc4 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConditions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConditions.java @@ -1,12 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.core.annotation.Fluent; /** * Defines conditions to decide whether the detected anomalies should be * included in an alert or not. */ +@Fluent public final class MetricAnomalyAlertConditions { private MetricBoundaryCondition boundaryCondition; private SeverityCondition severityCondition; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConfiguration.java similarity index 98% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConfiguration.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConfiguration.java index 55d788a84e0e..4b7a7f968574 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConfiguration.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Fluent; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConfigurationsOperator.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConfigurationsOperator.java similarity index 97% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConfigurationsOperator.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConfigurationsOperator.java index 0ae4fcee6e04..4d0c66eff364 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertConfigurationsOperator.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertConfigurationsOperator.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.util.ExpandableStringEnum; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertScope.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertScope.java similarity index 96% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertScope.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertScope.java index 071c8a96cdf6..5225731a580b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertScope.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertScope.java @@ -1,8 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; +import com.azure.ai.metricsadvisor.models.DimensionKey; import com.azure.core.annotation.Immutable; /** @@ -29,7 +30,7 @@ private MetricAnomalyAlertScope(DimensionKey seriesGroupId) { } private MetricAnomalyAlertScope(TopNGroupScope topNGroup) { - this.scopeType = MetricAnomalyAlertScopeType.TOPN; + this.scopeType = MetricAnomalyAlertScopeType.TOP_N; this.topNGroup = topNGroup; this.seriesGroupId = null; } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertScopeType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertScopeType.java similarity index 91% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertScopeType.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertScopeType.java index 600bde8f4e09..d4824834b513 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyAlertScopeType.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/MetricAnomalyAlertScopeType.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.util.ExpandableStringEnum; @@ -22,7 +22,7 @@ public final class MetricAnomalyAlertScopeType extends ExpandableStringEnum { + /** + * Defines the lower boundary in a boundary condition. + */ + public static final SingleBoundaryDirection LOWER = fromString("LOWER"); + /** + * Defines the upper boundary in a boundary condition. + */ + public static final SingleBoundaryDirection UPPER = fromString("UPPER"); + + /** + * Creates or finds a BoundaryDirection from its string representation. + * + * @param name a name to look for. + * + * @return the corresponding BoundaryDirection. + */ + public static SingleBoundaryDirection fromString(String name) { + return fromString(name, SingleBoundaryDirection.class); + } + + /** + * @return known BoundaryDirection values. + */ + public static Collection values() { + return values(SingleBoundaryDirection.class); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SmartDetectionCondition.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SmartDetectionCondition.java similarity index 97% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SmartDetectionCondition.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SmartDetectionCondition.java index 239cee3bfee6..790b5af113d1 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SmartDetectionCondition.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SmartDetectionCondition.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SnoozeScope.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SnoozeScope.java similarity index 94% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SnoozeScope.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SnoozeScope.java index 62a30fd96b4f..5e225b4d0135 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SnoozeScope.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SnoozeScope.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SqlServerDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SqlServerDataFeedSource.java new file mode 100644 index 000000000000..e2097b7fd617 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SqlServerDataFeedSource.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration.models; + +import com.azure.ai.metricsadvisor.implementation.util.SqlServerDataFeedSourceAccessor; +import com.azure.core.annotation.Immutable; + +/** + * The SQLServerDataFeedSource model. + */ +@Immutable +public final class SqlServerDataFeedSource extends DataFeedSource { + /* + * SQL Server database connection string + */ + private final String connectionString; + + /* + * Get the query that retrieves the values to be analyzed for anomalies. + */ + private final String query; + + /* + * The id of the credential resource to authenticate the data source. + */ + private final String credentialId; + + /* + * The authentication type to access the data source. + */ + private final DatasourceAuthenticationType authType; + + static { + SqlServerDataFeedSourceAccessor.setAccessor( + new SqlServerDataFeedSourceAccessor.Accessor() { + @Override + public String getConnectionString(SqlServerDataFeedSource feedSource) { + return feedSource.getConnectionString(); + } + }); + } + + private SqlServerDataFeedSource(final String connectionString, + final String query, + final String credentialId, + final DatasourceAuthenticationType authType) { + this.connectionString = connectionString; + this.query = query; + this.credentialId = credentialId; + this.authType = authType; + } + + /** + * Create a SQLServerDataFeedSource with credential included in the {@code connectionString} as plain text. + * + * @param connectionString The SQL server connection string. + * @param query The query that retrieves the values to be analyzed for anomalies. + * + * @return The SQLServerDataFeedSource. + */ + public static SqlServerDataFeedSource fromBasicCredential(final String connectionString, + final String query) { + return new SqlServerDataFeedSource(connectionString, query, null, DatasourceAuthenticationType.BASIC); + } + + /** + * Create a SQLServerDataFeedSource with the {@code connectionString} containing the resource + * id of the SQL server on which metrics advisor has MSI access. + * + * @param connectionString The SQL server connection string. + * @param query The query that retrieves the values to be analyzed for anomalies. + * @return The SQLServerDataFeedSource. + */ + public static SqlServerDataFeedSource fromManagedIdentityCredential(final String connectionString, + final String query) { + return new SqlServerDataFeedSource(connectionString, + query, + null, + DatasourceAuthenticationType.MANAGED_IDENTITY); + } + + /** + * Create a SQLServerDataFeedSource with the {@code credentialId} identifying a credential + * entity of type {@link DatasourceSqlServerConnectionString} that contains the SQL + * connection string. + * + * @param query The query that retrieves the values to be analyzed for anomalies. + * @param credentialId The unique id of a credential entity of type + * {@link DatasourceSqlServerConnectionString}. + * @return The SQLServerDataFeedSource. + */ + public static SqlServerDataFeedSource fromConnectionStringCredential(final String query, + final String credentialId) { + return new SqlServerDataFeedSource(null, + query, + credentialId, + DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); + } + + /** + * Create a SQLServerDataFeedSource with the {@code credentialId} identifying a credential + * entity of type {@link DatasourceServicePrincipal}, the entity contains + * Service Principal to access the SQL Server. + * + * @param connectionString The SQL server connection string. + * @param query The query that retrieves the values to be analyzed for anomalies. + * @param credentialId The unique id of a credential entity of type + * {@link DatasourceServicePrincipal}. + * + * @return The SQLServerDataFeedSource. + */ + public static SqlServerDataFeedSource fromServicePrincipalCredential(final String connectionString, + final String query, + final String credentialId) { + return new SqlServerDataFeedSource(connectionString, + query, + credentialId, + DatasourceAuthenticationType.SERVICE_PRINCIPAL); + } + + /** + * Create a SQLServerDataFeedSource with the {@code credentialId} identifying a credential + * entity of type {@link DatasourceServicePrincipalInKeyVault}, the entity contains + * details of the KeyVault holding the Service Principal to access the SQL Server. + * + * @param connectionString The SQL server connection string. + * @param query The query that retrieves the values to be analyzed for anomalies. + * @param credentialId The unique id of a credential entity of type + * {@link DatasourceServicePrincipalInKeyVault}. + * + * @return The SQLServerDataFeedSource. + */ + public static SqlServerDataFeedSource fromServicePrincipalInKeyVaultCredential(final String connectionString, + final String query, + final String credentialId) { + return new SqlServerDataFeedSource(connectionString, + query, + credentialId, + DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); + } + + /** + * Get the query that retrieves the values to be analyzed for anomalies. + * + * @return the query. + */ + public String getQuery() { + return this.query; + } + + /** + * Gets the id of the {@link DatasourceCredentialEntity credential resource} to authenticate the data source. + * + * @return The credential resource id. + */ + public String getCredentialId() { + return this.credentialId; + } + + /** + * Gets the authentication type to access the data source. + * + * @return The authentication type. + */ + public DatasourceAuthenticationType getAuthenticationType() { + return this.authType; + } + + private String getConnectionString() { + return this.connectionString; + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SuppressCondition.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SuppressCondition.java similarity index 96% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SuppressCondition.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SuppressCondition.java index 8486eefcdbc8..5d8ca839845d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SuppressCondition.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/SuppressCondition.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/TopNGroupScope.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/TopNGroupScope.java similarity index 97% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/TopNGroupScope.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/TopNGroupScope.java index 167397b82955..89d7a572fd20 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/TopNGroupScope.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/TopNGroupScope.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/WebNotificationHook.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/WebNotificationHook.java similarity index 97% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/WebNotificationHook.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/WebNotificationHook.java index 7c8e17eb2945..1167fa6bbc58 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/WebNotificationHook.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/WebNotificationHook.java @@ -1,13 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.ai.metricsadvisor.models; +package com.azure.ai.metricsadvisor.administration.models; +import com.azure.core.annotation.Fluent; import com.azure.core.http.HttpHeaders; /** * A hook that describes web-hook based incident alerts notification. */ +@Fluent public final class WebNotificationHook extends NotificationHook { private String name; private String description; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/package-info.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/package-info.java new file mode 100644 index 000000000000..d1191adc2e58 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing model types for Metrics Advisor administration operations. + */ +package com.azure.ai.metricsadvisor.administration.models; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl.java index 36e12fc20dba..921b454a846a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl.java @@ -58,10 +58,10 @@ import com.azure.ai.metricsadvisor.implementation.models.SeriesResultList; import com.azure.ai.metricsadvisor.implementation.models.UsageStats; import com.azure.ai.metricsadvisor.models.AnomalyAlert; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; import com.azure.ai.metricsadvisor.models.EnrichmentStatus; -import com.azure.ai.metricsadvisor.models.ErrorCodeException; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.Delete; import com.azure.core.annotation.ExpectedResponses; @@ -195,13 +195,13 @@ public SerializerAdapter getSerializerAdapter() { private interface AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Service { @Get("/stats/latest") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getActiveSeriesCount( @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Get("/alert/anomaly/configurations/{configurationId}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAnomalyAlertingConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -210,7 +210,7 @@ Mono> getAnomalyAlertingConfiguration( @Patch("/alert/anomaly/configurations/{configurationId}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> updateAnomalyAlertingConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -220,7 +220,7 @@ Mono> updateAnomalyAlertingConfiguration( @Delete("/alert/anomaly/configurations/{configurationId}") @ExpectedResponses({204}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> deleteAnomalyAlertingConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -229,7 +229,7 @@ Mono> deleteAnomalyAlertingConfiguration( @Post("/alert/anomaly/configurations") @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono createAnomalyAlertingConfiguration( @HostParam("endpoint") String endpoint, @BodyParam("application/json") AnomalyAlertingConfiguration body, @@ -238,7 +238,7 @@ Mono createAnomalyAlertingConfigurat @Post("/alert/anomaly/configurations/{configurationId}/alerts/query") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAlertsByAnomalyAlertingConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -250,7 +250,7 @@ Mono> getAlertsByAnomalyAlertingConfiguration( @Get("/alert/anomaly/configurations/{configurationId}/alerts/{alertId}/anomalies") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAnomaliesFromAlertByAnomalyAlertingConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -262,7 +262,7 @@ Mono> getAnomaliesFromAlertByAnomalyAlertingConfigur @Get("/alert/anomaly/configurations/{configurationId}/alerts/{alertId}/incidents") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getIncidentsFromAlertByAnomalyAlertingConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -274,7 +274,7 @@ Mono> getIncidentsFromAlertByAnomalyAlertingConfigu @Get("/enrichment/anomalyDetection/configurations/{configurationId}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAnomalyDetectionConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -283,7 +283,7 @@ Mono> getAnomalyDetectionConfiguration( @Patch("/enrichment/anomalyDetection/configurations/{configurationId}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> updateAnomalyDetectionConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -293,7 +293,7 @@ Mono> updateAnomalyDetectionConfiguratio @Delete("/enrichment/anomalyDetection/configurations/{configurationId}") @ExpectedResponses({204}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> deleteAnomalyDetectionConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -302,7 +302,7 @@ Mono> deleteAnomalyDetectionConfiguration( @Post("/enrichment/anomalyDetection/configurations") @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono createAnomalyDetectionConfiguration( @HostParam("endpoint") String endpoint, @BodyParam("application/json") AnomalyDetectionConfiguration body, @@ -311,7 +311,7 @@ Mono createAnomalyDetectionConfigur @Get("/enrichment/anomalyDetection/configurations/{configurationId}/alert/anomaly/configurations") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAnomalyAlertingConfigurationsByAnomalyDetectionConfiguration( @HostParam("endpoint") String endpoint, @@ -323,7 +323,7 @@ Mono createAnomalyDetectionConfigur @Post("/enrichment/anomalyDetection/configurations/{configurationId}/series/query") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getSeriesByAnomalyDetectionConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -333,7 +333,7 @@ Mono> getSeriesByAnomalyDetectionConfiguration( @Post("/enrichment/anomalyDetection/configurations/{configurationId}/anomalies/query") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAnomaliesByAnomalyDetectionConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -345,7 +345,7 @@ Mono> getAnomaliesByAnomalyDetectionConfiguration( @Post("/enrichment/anomalyDetection/configurations/{configurationId}/anomalies/dimension/query") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getDimensionOfAnomaliesByAnomalyDetectionConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -357,7 +357,7 @@ Mono> getDimensionOfAnomaliesByAnomalyDetectionCo @Post("/enrichment/anomalyDetection/configurations/{configurationId}/incidents/query") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getIncidentsByAnomalyDetectionConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -368,7 +368,7 @@ Mono> getIncidentsByAnomalyDetectionConfiguration( @Get("/enrichment/anomalyDetection/configurations/{configurationId}/incidents/query") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getIncidentsByAnomalyDetectionConfigurationNextPages( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -379,7 +379,7 @@ Mono> getIncidentsByAnomalyDetectionConfigurationNe @Get("/enrichment/anomalyDetection/configurations/{configurationId}/incidents/{incidentId}/rootCause") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getRootCauseOfIncidentByAnomalyDetectionConfiguration( @HostParam("endpoint") String endpoint, @PathParam("configurationId") UUID configurationId, @@ -389,7 +389,7 @@ Mono> getRootCauseOfIncidentByAnomalyDetectionConfigurat @Post("/credentials") @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono createCredential( @HostParam("endpoint") String endpoint, @BodyParam("application/json") DataSourceCredential body, @@ -398,7 +398,7 @@ Mono createCredential( @Get("/credentials") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> listCredentials( @HostParam("endpoint") String endpoint, @QueryParam("$skip") Integer skip, @@ -408,7 +408,7 @@ Mono> listCredentials( @Patch("/credentials/{credentialId}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> updateCredential( @HostParam("endpoint") String endpoint, @PathParam("credentialId") UUID credentialId, @@ -418,7 +418,7 @@ Mono> updateCredential( @Delete("/credentials/{credentialId}") @ExpectedResponses({204}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> deleteCredential( @HostParam("endpoint") String endpoint, @PathParam("credentialId") UUID credentialId, @@ -427,7 +427,7 @@ Mono> deleteCredential( @Get("/credentials/{credentialId}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getCredential( @HostParam("endpoint") String endpoint, @PathParam("credentialId") UUID credentialId, @@ -436,7 +436,7 @@ Mono> getCredential( @Get("/dataFeeds") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> listDataFeeds( @HostParam("endpoint") String endpoint, @QueryParam("dataFeedName") String dataFeedName, @@ -451,7 +451,7 @@ Mono> listDataFeeds( @Post("/dataFeeds") @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono createDataFeed( @HostParam("endpoint") String endpoint, @BodyParam("application/json") DataFeedDetail body, @@ -460,7 +460,7 @@ Mono createDataFeed( @Get("/dataFeeds/{dataFeedId}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getDataFeedById( @HostParam("endpoint") String endpoint, @PathParam("dataFeedId") UUID dataFeedId, @@ -469,7 +469,7 @@ Mono> getDataFeedById( @Patch("/dataFeeds/{dataFeedId}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> updateDataFeed( @HostParam("endpoint") String endpoint, @PathParam("dataFeedId") UUID dataFeedId, @@ -479,7 +479,7 @@ Mono> updateDataFeed( @Delete("/dataFeeds/{dataFeedId}") @ExpectedResponses({204}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> deleteDataFeed( @HostParam("endpoint") String endpoint, @PathParam("dataFeedId") UUID dataFeedId, @@ -488,7 +488,7 @@ Mono> deleteDataFeed( @Get("/feedback/metric/{feedbackId}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getMetricFeedback( @HostParam("endpoint") String endpoint, @PathParam("feedbackId") UUID feedbackId, @@ -497,7 +497,7 @@ Mono> getMetricFeedback( @Post("/feedback/metric/query") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> listMetricFeedbacks( @HostParam("endpoint") String endpoint, @QueryParam("$skip") Integer skip, @@ -508,7 +508,7 @@ Mono> listMetricFeedbacks( @Post("/feedback/metric") @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono createMetricFeedback( @HostParam("endpoint") String endpoint, @BodyParam("application/json") MetricFeedback body, @@ -517,7 +517,7 @@ Mono createMetricFeedback( @Get("/hooks") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> listHooks( @HostParam("endpoint") String endpoint, @QueryParam("hookName") String hookName, @@ -528,7 +528,7 @@ Mono> listHooks( @Post("/hooks") @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono createHook( @HostParam("endpoint") String endpoint, @BodyParam("application/json") HookInfo body, @@ -537,7 +537,7 @@ Mono createHook( @Get("/hooks/{hookId}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getHook( @HostParam("endpoint") String endpoint, @PathParam("hookId") UUID hookId, @@ -546,7 +546,7 @@ Mono> getHook( @Patch("/hooks/{hookId}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> updateHook( @HostParam("endpoint") String endpoint, @PathParam("hookId") UUID hookId, @@ -556,7 +556,7 @@ Mono> updateHook( @Delete("/hooks/{hookId}") @ExpectedResponses({204}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> deleteHook( @HostParam("endpoint") String endpoint, @PathParam("hookId") UUID hookId, @@ -565,7 +565,7 @@ Mono> deleteHook( @Post("/dataFeeds/{dataFeedId}/ingestionStatus/query") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getDataFeedIngestionStatus( @HostParam("endpoint") String endpoint, @PathParam("dataFeedId") UUID dataFeedId, @@ -577,7 +577,7 @@ Mono> getDataFeedIngestionStatus( @Post("/dataFeeds/{dataFeedId}/ingestionProgress/reset") @ExpectedResponses({204}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> resetDataFeedIngestionStatus( @HostParam("endpoint") String endpoint, @PathParam("dataFeedId") UUID dataFeedId, @@ -587,7 +587,7 @@ Mono> resetDataFeedIngestionStatus( @Get("/dataFeeds/{dataFeedId}/ingestionProgress") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getIngestionProgress( @HostParam("endpoint") String endpoint, @PathParam("dataFeedId") UUID dataFeedId, @@ -596,7 +596,7 @@ Mono> getIngestionProgress( @Post("/metrics/{metricId}/data/query") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getMetricData( @HostParam("endpoint") String endpoint, @PathParam("metricId") UUID metricId, @@ -606,7 +606,7 @@ Mono> getMetricData( @Post("/metrics/{metricId}/series/query") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getMetricSeries( @HostParam("endpoint") String endpoint, @PathParam("metricId") UUID metricId, @@ -618,7 +618,7 @@ Mono> getMetricSeries( @Post("/metrics/{metricId}/dimension/query") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getMetricDimension( @HostParam("endpoint") String endpoint, @PathParam("metricId") UUID metricId, @@ -630,7 +630,7 @@ Mono> getMetricDimension( @Get("/metrics/{metricId}/enrichment/anomalyDetection/configurations") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAnomalyDetectionConfigurationsByMetric( @HostParam("endpoint") String endpoint, @PathParam("metricId") UUID metricId, @@ -641,7 +641,7 @@ Mono> getAnomalyDetectionConfigurati @Post("/metrics/{metricId}/status/enrichment/anomalyDetection/query") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getEnrichmentStatusByMetric( @HostParam("endpoint") String endpoint, @PathParam("metricId") UUID metricId, @@ -653,7 +653,7 @@ Mono> getEnrichmentStatusByMetric( @Post("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAlertsByAnomalyAlertingConfigurationNext( @HostParam("endpoint") String endpoint, @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -663,7 +663,7 @@ Mono> getAlertsByAnomalyAlertingConfigurationNext( @Post("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAnomaliesByAnomalyDetectionConfigurationNext( @HostParam("endpoint") String endpoint, @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -673,7 +673,7 @@ Mono> getAnomaliesByAnomalyDetectionConfigurationNex @Post("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getDimensionOfAnomaliesByAnomalyDetectionConfigurationNext( @HostParam("endpoint") String endpoint, @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -683,7 +683,7 @@ Mono> getDimensionOfAnomaliesByAnomalyDetectionCo @Post("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> listMetricFeedbacksNext( @HostParam("endpoint") String endpoint, @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -693,7 +693,7 @@ Mono> listMetricFeedbacksNext( @Post("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getDataFeedIngestionStatusNext( @HostParam("endpoint") String endpoint, @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -703,7 +703,7 @@ Mono> getDataFeedIngestionStatusNext( @Post("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getMetricSeriesNext( @HostParam("endpoint") String endpoint, @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -713,7 +713,7 @@ Mono> getMetricSeriesNext( @Post("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getMetricDimensionNext( @HostParam("endpoint") String endpoint, @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -723,7 +723,7 @@ Mono> getMetricDimensionNext( @Post("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getEnrichmentStatusByMetricNext( @HostParam("endpoint") String endpoint, @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -733,7 +733,7 @@ Mono> getEnrichmentStatusByMetricNext( @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAnomaliesFromAlertByAnomalyAlertingConfigurationNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -742,7 +742,7 @@ Mono> getAnomaliesFromAlertByAnomalyAlertingConfigur @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getIncidentsFromAlertByAnomalyAlertingConfigurationNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -751,7 +751,7 @@ Mono> getIncidentsFromAlertByAnomalyAlertingConfigu @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAnomalyAlertingConfigurationsByAnomalyDetectionConfigurationNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @@ -761,7 +761,7 @@ Mono> getIncidentsFromAlertByAnomalyAlertingConfigu @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getIncidentsByAnomalyDetectionConfigurationNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -770,7 +770,7 @@ Mono> getIncidentsByAnomalyDetectionConfigurationNe @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getIncidentsByAnomalyDetectionConfigurationNextPagesNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -779,7 +779,7 @@ Mono> getIncidentsByAnomalyDetectionConfigurationNe @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> listCredentialsNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -788,7 +788,7 @@ Mono> listCredentialsNext( @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> listDataFeedsNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -797,7 +797,7 @@ Mono> listDataFeedsNext( @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> listHooksNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -806,7 +806,7 @@ Mono> listHooksNext( @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorCodeException.class) + @UnexpectedResponseExceptionType(MetricsAdvisorResponseException.class) Mono> getAnomalyDetectionConfigurationsByMetricNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @@ -817,7 +817,7 @@ Mono> getAnomalyDetectionConfigurati /** * Get latest usage stats. * - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return latest usage stats. */ @@ -832,7 +832,7 @@ public Mono> getActiveSeriesCountWithResponseAsync() { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return latest usage stats. */ @@ -845,7 +845,7 @@ public Mono> getActiveSeriesCountWithResponseAsync(Context /** * Get latest usage stats. * - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return latest usage stats. */ @@ -867,7 +867,7 @@ public Mono getActiveSeriesCountAsync() { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return latest usage stats. */ @@ -887,7 +887,7 @@ public Mono getActiveSeriesCountAsync(Context context) { /** * Get latest usage stats. * - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return latest usage stats. */ @@ -901,7 +901,7 @@ public UsageStats getActiveSeriesCount() { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return latest usage stats. */ @@ -915,7 +915,7 @@ public Response getActiveSeriesCountWithResponse(Context context) { * * @param configurationId anomaly alerting configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -934,7 +934,7 @@ public Mono> getAnomalyAlertingConfigurat * @param configurationId anomaly alerting configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -950,7 +950,7 @@ public Mono> getAnomalyAlertingConfigurat * * @param configurationId anomaly alerting configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -973,7 +973,7 @@ public Mono getAnomalyAlertingConfigurationAsync(U * @param configurationId anomaly alerting configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -996,7 +996,7 @@ public Mono getAnomalyAlertingConfigurationAsync( * * @param configurationId anomaly alerting configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1011,7 +1011,7 @@ public AnomalyAlertingConfiguration getAnomalyAlertingConfiguration(UUID configu * @param configurationId anomaly alerting configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1027,7 +1027,7 @@ public Response getAnomalyAlertingConfigurationWit * @param configurationId anomaly alerting configuration unique id. * @param body anomaly alerting configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1048,7 +1048,7 @@ public Mono> updateAnomalyAlertingConfigu * @param body anomaly alerting configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1065,7 +1065,7 @@ public Mono> updateAnomalyAlertingConfigu * @param configurationId anomaly alerting configuration unique id. * @param body anomaly alerting configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1090,7 +1090,7 @@ public Mono updateAnomalyAlertingConfigurationAsyn * @param body anomaly alerting configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1114,7 +1114,7 @@ public Mono updateAnomalyAlertingConfigurationAsyn * @param configurationId anomaly alerting configuration unique id. * @param body anomaly alerting configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1131,7 +1131,7 @@ public AnomalyAlertingConfiguration updateAnomalyAlertingConfiguration( * @param body anomaly alerting configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1146,7 +1146,7 @@ public Response updateAnomalyAlertingConfiguration * * @param configurationId anomaly alerting configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1165,7 +1165,7 @@ public Mono> deleteAnomalyAlertingConfigurationWithResponseAsync( * @param configurationId anomaly alerting configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1181,7 +1181,7 @@ public Mono> deleteAnomalyAlertingConfigurationWithResponseAsync( * * @param configurationId anomaly alerting configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1197,7 +1197,7 @@ public Mono deleteAnomalyAlertingConfigurationAsync(UUID configurationId) * @param configurationId anomaly alerting configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1212,7 +1212,7 @@ public Mono deleteAnomalyAlertingConfigurationAsync(UUID configurationId, * * @param configurationId anomaly alerting configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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) @@ -1226,7 +1226,7 @@ public void deleteAnomalyAlertingConfiguration(UUID configurationId) { * @param configurationId anomaly alerting configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1240,7 +1240,7 @@ public Response deleteAnomalyAlertingConfigurationWithResponse(UUID config * * @param body anomaly alerting configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1258,7 +1258,7 @@ public Mono createAnomalyAlertingCon * @param body anomaly alerting configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1274,7 +1274,7 @@ public Mono createAnomalyAlertingCon * * @param body anomaly alerting configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1290,7 +1290,7 @@ public Mono createAnomalyAlertingConfigurationAsync(AnomalyAlertingConfigu * @param body anomaly alerting configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1305,7 +1305,7 @@ public Mono createAnomalyAlertingConfigurationAsync(AnomalyAlertingConfigu * * @param body anomaly alerting configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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) @@ -1319,7 +1319,7 @@ public void createAnomalyAlertingConfiguration(AnomalyAlertingConfiguration body * @param body anomaly alerting configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1337,7 +1337,7 @@ public Response createAnomalyAlertingConfigurationWithResponse( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1369,7 +1369,7 @@ public Mono> getAlertsByAnomalyAlertingConfiguration * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1398,7 +1398,7 @@ public Mono> getAlertsByAnomalyAlertingConfiguration * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1419,7 +1419,7 @@ public PagedFlux getAlertsByAnomalyAlertingConfigurationAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1441,7 +1441,7 @@ public PagedFlux getAlertsByAnomalyAlertingConfigurationAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1461,7 +1461,7 @@ public PagedIterable getAlertsByAnomalyAlertingConfiguration( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1480,7 +1480,7 @@ public PagedIterable getAlertsByAnomalyAlertingConfiguration( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1518,7 +1518,7 @@ public Mono> getAnomaliesFromAlertByAnomalyAlerting * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1547,7 +1547,7 @@ public Mono> getAnomaliesFromAlertByAnomalyAlerting * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1570,7 +1570,7 @@ public PagedFlux getAnomaliesFromAlertByAnomalyAlertingConfigurat * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1592,7 +1592,7 @@ public PagedFlux getAnomaliesFromAlertByAnomalyAlertingConfigurat * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1612,7 +1612,7 @@ public PagedIterable getAnomaliesFromAlertByAnomalyAlertingConfig * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1632,7 +1632,7 @@ public PagedIterable getAnomaliesFromAlertByAnomalyAlertingConfig * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1670,7 +1670,7 @@ public Mono> getIncidentsFromAlertByAnomalyAlertin * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1699,7 +1699,7 @@ public Mono> getIncidentsFromAlertByAnomalyAlertin * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1722,7 +1722,7 @@ public PagedFlux getIncidentsFromAlertByAnomalyAlertingConfigura * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1744,7 +1744,7 @@ public PagedFlux getIncidentsFromAlertByAnomalyAlertingConfigura * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1764,7 +1764,7 @@ public PagedIterable getIncidentsFromAlertByAnomalyAlertingConfi * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1781,7 +1781,7 @@ public PagedIterable getIncidentsFromAlertByAnomalyAlertingConfi * * @param configurationId anomaly detection configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1800,7 +1800,7 @@ public Mono> getAnomalyDetectionConfigur * @param configurationId anomaly detection configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1816,7 +1816,7 @@ public Mono> getAnomalyDetectionConfigur * * @param configurationId anomaly detection configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1839,7 +1839,7 @@ public Mono getAnomalyDetectionConfigurationAsync * @param configurationId anomaly detection configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1862,7 +1862,7 @@ public Mono getAnomalyDetectionConfigurationAsync * * @param configurationId anomaly detection configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1877,7 +1877,7 @@ public AnomalyDetectionConfiguration getAnomalyDetectionConfiguration(UUID confi * @param configurationId anomaly detection configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1893,7 +1893,7 @@ public Response getAnomalyDetectionConfigurationW * @param configurationId anomaly detection configuration unique id. * @param body anomaly detection configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1914,7 +1914,7 @@ public Mono> updateAnomalyDetectionConfi * @param body anomaly detection configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1931,7 +1931,7 @@ public Mono> updateAnomalyDetectionConfi * @param configurationId anomaly detection configuration unique id. * @param body anomaly detection configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1956,7 +1956,7 @@ public Mono updateAnomalyDetectionConfigurationAs * @param body anomaly detection configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1980,7 +1980,7 @@ public Mono updateAnomalyDetectionConfigurationAs * @param configurationId anomaly detection configuration unique id. * @param body anomaly detection configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -1997,7 +1997,7 @@ public AnomalyDetectionConfiguration updateAnomalyDetectionConfiguration( * @param body anomaly detection configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2012,7 +2012,7 @@ public Response updateAnomalyDetectionConfigurati * * @param configurationId anomaly detection configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2031,7 +2031,7 @@ public Mono> deleteAnomalyDetectionConfigurationWithResponseAsync * @param configurationId anomaly detection configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2047,7 +2047,7 @@ public Mono> deleteAnomalyDetectionConfigurationWithResponseAsync * * @param configurationId anomaly detection configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2063,7 +2063,7 @@ public Mono deleteAnomalyDetectionConfigurationAsync(UUID configurationId) * @param configurationId anomaly detection configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2078,7 +2078,7 @@ public Mono deleteAnomalyDetectionConfigurationAsync(UUID configurationId, * * @param configurationId anomaly detection configuration unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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) @@ -2092,7 +2092,7 @@ public void deleteAnomalyDetectionConfiguration(UUID configurationId) { * @param configurationId anomaly detection configuration unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2106,7 +2106,7 @@ public Response deleteAnomalyDetectionConfigurationWithResponse(UUID confi * * @param body anomaly detection configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2124,7 +2124,7 @@ public Mono createAnomalyDetectionC * @param body anomaly detection configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2140,7 +2140,7 @@ public Mono createAnomalyDetectionC * * @param body anomaly detection configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2156,7 +2156,7 @@ public Mono createAnomalyDetectionConfigurationAsync(AnomalyDetectionConfi * @param body anomaly detection configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -2171,7 +2171,7 @@ public Mono createAnomalyDetectionConfigurationAsync(AnomalyDetectionConfi * * @param body anomaly detection configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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) @@ -2185,7 +2185,7 @@ public void createAnomalyDetectionConfiguration(AnomalyDetectionConfiguration bo * @param body anomaly detection configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2202,7 +2202,7 @@ public Response createAnomalyDetectionConfigurationWithResponse( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2234,7 +2234,7 @@ public Response createAnomalyDetectionConfigurationWithResponse( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2263,7 +2263,7 @@ public Response createAnomalyDetectionConfigurationWithResponse( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2286,7 +2286,7 @@ public PagedFlux getAnomalyAlertingConfigurationsB * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2309,7 +2309,7 @@ public PagedFlux getAnomalyAlertingConfigurationsB * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2329,7 +2329,7 @@ public PagedIterable getAnomalyAlertingConfigurati * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2347,7 +2347,7 @@ public PagedIterable getAnomalyAlertingConfigurati * @param configurationId anomaly detection configuration unique id. * @param body query series detection result request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2368,7 +2368,7 @@ public Mono> getSeriesByAnomalyDetectionConfiguration * @param body query series detection result request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2386,7 +2386,7 @@ public Mono> getSeriesByAnomalyDetectionConfiguration * @param configurationId anomaly detection configuration unique id. * @param body query series detection result request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2411,7 +2411,7 @@ public Mono getSeriesByAnomalyDetectionConfigurationAsync( * @param body query series detection result request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2435,7 +2435,7 @@ public Mono getSeriesByAnomalyDetectionConfigurationAsync( * @param configurationId anomaly detection configuration unique id. * @param body query series detection result request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2451,7 +2451,7 @@ public SeriesResultList getSeriesByAnomalyDetectionConfiguration(UUID configurat * @param body query series detection result request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2469,7 +2469,7 @@ public Response getSeriesByAnomalyDetectionConfigurationWithRe * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2501,7 +2501,7 @@ public Mono> getAnomaliesByAnomalyDetectionConfigur * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2534,7 +2534,7 @@ public Mono> getAnomaliesByAnomalyDetectionConfigur * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2557,7 +2557,7 @@ public PagedFlux getAnomaliesByAnomalyDetectionConfigurationAsync * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2583,7 +2583,7 @@ public PagedFlux getAnomaliesByAnomalyDetectionConfigurationAsync * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2603,7 +2603,7 @@ public PagedIterable getAnomaliesByAnomalyDetectionConfiguration( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2626,7 +2626,7 @@ public PagedIterable getAnomaliesByAnomalyDetectionConfiguration( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2658,7 +2658,7 @@ public Mono> getDimensionOfAnomaliesByAnomalyDetectionConf * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2687,7 +2687,7 @@ public Mono> getDimensionOfAnomaliesByAnomalyDetectionConf * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2710,7 +2710,7 @@ public PagedFlux getDimensionOfAnomaliesByAnomalyDetectionConfigurationA * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2734,7 +2734,7 @@ public PagedFlux getDimensionOfAnomaliesByAnomalyDetectionConfigurationA * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2754,7 +2754,7 @@ public PagedIterable getDimensionOfAnomaliesByAnomalyDetectionConfigurat * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2773,7 +2773,7 @@ public PagedIterable getDimensionOfAnomaliesByAnomalyDetectionConfigurat * @param body query detection incident result request. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2804,7 +2804,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2832,7 +2832,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * @param body query detection incident result request. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2852,7 +2852,7 @@ public PagedFlux getIncidentsByAnomalyDetectionConfigurationAsyn * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2873,7 +2873,7 @@ public PagedFlux getIncidentsByAnomalyDetectionConfigurationAsyn * @param body query detection incident result request. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2892,7 +2892,7 @@ public PagedIterable getIncidentsByAnomalyDetectionConfiguration * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2910,7 +2910,7 @@ public PagedIterable getIncidentsByAnomalyDetectionConfiguration * @param maxpagesize the maximum number of items in one page. * @param token the token for getting the next page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2941,7 +2941,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * @param token the token for getting the next page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2969,7 +2969,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * @param maxpagesize the maximum number of items in one page. * @param token the token for getting the next page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -2991,7 +2991,7 @@ public PagedFlux getIncidentsByAnomalyDetectionConfigurationNext * @param token the token for getting the next page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3012,7 +3012,7 @@ public PagedFlux getIncidentsByAnomalyDetectionConfigurationNext * @param maxpagesize the maximum number of items in one page. * @param token the token for getting the next page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3031,7 +3031,7 @@ public PagedIterable getIncidentsByAnomalyDetectionConfiguration * @param token the token for getting the next page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3049,7 +3049,7 @@ public PagedIterable getIncidentsByAnomalyDetectionConfiguration * @param configurationId anomaly detection configuration unique id. * @param incidentId incident id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3070,7 +3070,7 @@ public Mono> getRootCauseOfIncidentByAnomalyDetectionCon * @param incidentId incident id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3088,7 +3088,7 @@ public Mono> getRootCauseOfIncidentByAnomalyDetectionCon * @param configurationId anomaly detection configuration unique id. * @param incidentId incident id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3113,7 +3113,7 @@ public Mono getRootCauseOfIncidentByAnomalyDetectionConfiguration * @param incidentId incident id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3138,7 +3138,7 @@ public Mono getRootCauseOfIncidentByAnomalyDetectionConfiguration * @param configurationId anomaly detection configuration unique id. * @param incidentId incident id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3155,7 +3155,7 @@ public RootCauseList getRootCauseOfIncidentByAnomalyDetectionConfiguration( * @param incidentId incident id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3172,7 +3172,7 @@ public Response getRootCauseOfIncidentByAnomalyDetectionConfigura * * @param body Create data source credential request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3188,7 +3188,7 @@ public Mono createCredentialWithResponseAsync(DataSour * @param body Create data source credential request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3204,7 +3204,7 @@ public Mono createCredentialWithResponseAsync( * * @param body Create data source credential request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3219,7 +3219,7 @@ public Mono createCredentialAsync(DataSourceCredential body) { * @param body Create data source credential request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3233,7 +3233,7 @@ public Mono createCredentialAsync(DataSourceCredential body, Context conte * * @param body Create data source credential request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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) @@ -3247,7 +3247,7 @@ public void createCredential(DataSourceCredential body) { * @param body Create data source credential request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3262,7 +3262,7 @@ public Response createCredentialWithResponse(DataSourceCredential body, Co * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3289,7 +3289,7 @@ public Mono> listCredentialsSinglePageAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3315,7 +3315,7 @@ public Mono> listCredentialsSinglePageAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3333,7 +3333,7 @@ public PagedFlux listCredentialsAsync(Integer skip, Intege * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3350,7 +3350,7 @@ public PagedFlux listCredentialsAsync(Integer skip, Intege * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3366,7 +3366,7 @@ public PagedIterable listCredentials(Integer skip, Integer * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3381,7 +3381,7 @@ public PagedIterable listCredentials(Integer skip, Integer * @param credentialId Data source credential unique ID. * @param body Update data source credential request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3400,7 +3400,7 @@ public Mono> updateCredentialWithResponseAsync( * @param body Update data source credential request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3417,7 +3417,7 @@ public Mono> updateCredentialWithResponseAsync( * @param credentialId Data source credential unique ID. * @param body Update data source credential request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3441,7 +3441,7 @@ public Mono updateCredentialAsync(UUID credentialId, DataS * @param body Update data source credential request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3465,7 +3465,7 @@ public Mono updateCredentialAsync( * @param credentialId Data source credential unique ID. * @param body Update data source credential request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3481,7 +3481,7 @@ public DataSourceCredential updateCredential(UUID credentialId, DataSourceCreden * @param body Update data source credential request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3496,7 +3496,7 @@ public Response updateCredentialWithResponse( * * @param credentialId Data source credential unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3513,7 +3513,7 @@ public Mono> deleteCredentialWithResponseAsync(UUID credentialId) * @param credentialId Data source credential unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3528,7 +3528,7 @@ public Mono> deleteCredentialWithResponseAsync(UUID credentialId, * * @param credentialId Data source credential unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3543,7 +3543,7 @@ public Mono deleteCredentialAsync(UUID credentialId) { * @param credentialId Data source credential unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3557,7 +3557,7 @@ public Mono deleteCredentialAsync(UUID credentialId, Context context) { * * @param credentialId Data source credential unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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) @@ -3571,7 +3571,7 @@ public void deleteCredential(UUID credentialId) { * @param credentialId Data source credential unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3585,7 +3585,7 @@ public Response deleteCredentialWithResponse(UUID credentialId, Context co * * @param credentialId Data source credential unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data source credential. */ @@ -3602,7 +3602,7 @@ public Mono> getCredentialWithResponseAsync(UUID * @param credentialId Data source credential unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data source credential. */ @@ -3617,7 +3617,7 @@ public Mono> getCredentialWithResponseAsync(UUID * * @param credentialId Data source credential unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data source credential. */ @@ -3640,7 +3640,7 @@ public Mono getCredentialAsync(UUID credentialId) { * @param credentialId Data source credential unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data source credential. */ @@ -3662,7 +3662,7 @@ public Mono getCredentialAsync(UUID credentialId, Context * * @param credentialId Data source credential unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data source credential. */ @@ -3677,7 +3677,7 @@ public DataSourceCredential getCredential(UUID credentialId) { * @param credentialId Data source credential unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data source credential. */ @@ -3697,7 +3697,7 @@ public Response getCredentialWithResponse(UUID credentialI * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3747,7 +3747,7 @@ public Mono> listDataFeedsSinglePageAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3795,7 +3795,7 @@ public Mono> listDataFeedsSinglePageAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3827,7 +3827,7 @@ public PagedFlux listDataFeedsAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3866,7 +3866,7 @@ public PagedFlux listDataFeedsAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3895,7 +3895,7 @@ public PagedIterable listDataFeeds( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -3919,7 +3919,7 @@ public PagedIterable listDataFeeds( * * @param body parameters to create a data feed. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3935,7 +3935,7 @@ public Mono createDataFeedWithResponseAsync(DataFeedDeta * @param body parameters to create a data feed. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3950,7 +3950,7 @@ public Mono createDataFeedWithResponseAsync(DataFeedDeta * * @param body parameters to create a data feed. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3965,7 +3965,7 @@ public Mono createDataFeedAsync(DataFeedDetail body) { * @param body parameters to create a data feed. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -3979,7 +3979,7 @@ public Mono createDataFeedAsync(DataFeedDetail body, Context context) { * * @param body parameters to create a data feed. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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) @@ -3993,7 +3993,7 @@ public void createDataFeed(DataFeedDetail body) { * @param body parameters to create a data feed. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4007,7 +4007,7 @@ public Response createDataFeedWithResponse(DataFeedDetail body, Context co * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data feed by its id. */ @@ -4024,7 +4024,7 @@ public Mono> getDataFeedByIdWithResponseAsync(UUID data * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data feed by its id. */ @@ -4039,7 +4039,7 @@ public Mono> getDataFeedByIdWithResponseAsync(UUID data * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data feed by its id. */ @@ -4062,7 +4062,7 @@ public Mono getDataFeedByIdAsync(UUID dataFeedId) { * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data feed by its id. */ @@ -4084,7 +4084,7 @@ public Mono getDataFeedByIdAsync(UUID dataFeedId, Context contex * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data feed by its id. */ @@ -4099,7 +4099,7 @@ public DataFeedDetail getDataFeedById(UUID dataFeedId) { * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a data feed by its id. */ @@ -4114,7 +4114,7 @@ public Response getDataFeedByIdWithResponse(UUID dataFeedId, Con * @param dataFeedId The data feed unique id. * @param body parameters to update a data feed. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4132,7 +4132,7 @@ public Mono> updateDataFeedWithResponseAsync(UUID dataF * @param body parameters to update a data feed. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4149,7 +4149,7 @@ public Mono> updateDataFeedWithResponseAsync( * @param dataFeedId The data feed unique id. * @param body parameters to update a data feed. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4173,7 +4173,7 @@ public Mono updateDataFeedAsync(UUID dataFeedId, DataFeedDetailP * @param body parameters to update a data feed. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4196,7 +4196,7 @@ public Mono updateDataFeedAsync(UUID dataFeedId, DataFeedDetailP * @param dataFeedId The data feed unique id. * @param body parameters to update a data feed. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4212,7 +4212,7 @@ public DataFeedDetail updateDataFeed(UUID dataFeedId, DataFeedDetailPatch body) * @param body parameters to update a data feed. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4227,7 +4227,7 @@ public Response updateDataFeedWithResponse( * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4243,7 +4243,7 @@ public Mono> deleteDataFeedWithResponseAsync(UUID dataFeedId) { * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4258,7 +4258,7 @@ public Mono> deleteDataFeedWithResponseAsync(UUID dataFeedId, Con * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4273,7 +4273,7 @@ public Mono deleteDataFeedAsync(UUID dataFeedId) { * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4287,7 +4287,7 @@ public Mono deleteDataFeedAsync(UUID dataFeedId, Context context) { * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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) @@ -4301,7 +4301,7 @@ public void deleteDataFeed(UUID dataFeedId) { * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4315,7 +4315,7 @@ public Response deleteDataFeedWithResponse(UUID dataFeedId, Context contex * * @param feedbackId the unique feedback ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a metric feedback by its id. */ @@ -4332,7 +4332,7 @@ public Mono> getMetricFeedbackWithResponseAsync(UUID fe * @param feedbackId the unique feedback ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a metric feedback by its id. */ @@ -4347,7 +4347,7 @@ public Mono> getMetricFeedbackWithResponseAsync(UUID fe * * @param feedbackId the unique feedback ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a metric feedback by its id. */ @@ -4370,7 +4370,7 @@ public Mono getMetricFeedbackAsync(UUID feedbackId) { * @param feedbackId the unique feedback ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a metric feedback by its id. */ @@ -4392,7 +4392,7 @@ public Mono getMetricFeedbackAsync(UUID feedbackId, Context cont * * @param feedbackId the unique feedback ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a metric feedback by its id. */ @@ -4407,7 +4407,7 @@ public MetricFeedback getMetricFeedback(UUID feedbackId) { * @param feedbackId the unique feedback ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a metric feedback by its id. */ @@ -4423,7 +4423,7 @@ public Response getMetricFeedbackWithResponse(UUID feedbackId, C * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4454,7 +4454,7 @@ public Mono> listMetricFeedbacksSinglePageAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4481,7 +4481,7 @@ public Mono> listMetricFeedbacksSinglePageAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4501,7 +4501,7 @@ public PagedFlux listMetricFeedbacksAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4520,7 +4520,7 @@ public PagedFlux listMetricFeedbacksAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4538,7 +4538,7 @@ public PagedIterable listMetricFeedbacks( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4553,7 +4553,7 @@ public PagedIterable listMetricFeedbacks( * * @param body metric feedback. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4569,7 +4569,7 @@ public Mono createMetricFeedbackWithResponseAsync( * @param body metric feedback. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4585,7 +4585,7 @@ public Mono createMetricFeedbackWithResponseAsync( * * @param body metric feedback. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4600,7 +4600,7 @@ public Mono createMetricFeedbackAsync(MetricFeedback body) { * @param body metric feedback. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4615,7 +4615,7 @@ public Mono createMetricFeedbackAsync(MetricFeedback body, Context context * * @param body metric feedback. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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) @@ -4629,7 +4629,7 @@ public void createMetricFeedback(MetricFeedback body) { * @param body metric feedback. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4645,7 +4645,7 @@ public Response createMetricFeedbackWithResponse(MetricFeedback body, Cont * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4673,7 +4673,7 @@ public Mono> listHooksSinglePageAsync(String hookName, I * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4700,7 +4700,7 @@ public Mono> listHooksSinglePageAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4719,7 +4719,7 @@ public PagedFlux listHooksAsync(String hookName, Integer skip, Integer * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4737,7 +4737,7 @@ public PagedFlux listHooksAsync(String hookName, Integer skip, Integer * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4754,7 +4754,7 @@ public PagedIterable listHooks(String hookName, Integer skip, Integer * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4768,7 +4768,7 @@ public PagedIterable listHooks(String hookName, Integer skip, Integer * * @param body Create hook request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4784,7 +4784,7 @@ public Mono createHookWithResponseAsync(HookInfo body) { * @param body Create hook request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4799,7 +4799,7 @@ public Mono createHookWithResponseAsync(HookInfo body, Conte * * @param body Create hook request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4814,7 +4814,7 @@ public Mono createHookAsync(HookInfo body) { * @param body Create hook request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -4828,7 +4828,7 @@ public Mono createHookAsync(HookInfo body, Context context) { * * @param body Create hook request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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) @@ -4842,7 +4842,7 @@ public void createHook(HookInfo body) { * @param body Create hook request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4856,7 +4856,7 @@ public Response createHookWithResponse(HookInfo body, Context context) { * * @param hookId Hook unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a hook by its id. */ @@ -4872,7 +4872,7 @@ public Mono> getHookWithResponseAsync(UUID hookId) { * @param hookId Hook unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a hook by its id. */ @@ -4887,7 +4887,7 @@ public Mono> getHookWithResponseAsync(UUID hookId, Context co * * @param hookId Hook unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a hook by its id. */ @@ -4910,7 +4910,7 @@ public Mono getHookAsync(UUID hookId) { * @param hookId Hook unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a hook by its id. */ @@ -4932,7 +4932,7 @@ public Mono getHookAsync(UUID hookId, Context context) { * * @param hookId Hook unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a hook by its id. */ @@ -4947,7 +4947,7 @@ public HookInfo getHook(UUID hookId) { * @param hookId Hook unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a hook by its id. */ @@ -4962,7 +4962,7 @@ public Response getHookWithResponse(UUID hookId, Context context) { * @param hookId Hook unique ID. * @param body Update hook request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4979,7 +4979,7 @@ public Mono> updateHookWithResponseAsync(UUID hookId, HookInf * @param body Update hook request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -4995,7 +4995,7 @@ public Mono> updateHookWithResponseAsync(UUID hookId, HookInf * @param hookId Hook unique ID. * @param body Update hook request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5019,7 +5019,7 @@ public Mono updateHookAsync(UUID hookId, HookInfoPatch body) { * @param body Update hook request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5042,7 +5042,7 @@ public Mono updateHookAsync(UUID hookId, HookInfoPatch body, Context c * @param hookId Hook unique ID. * @param body Update hook request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5058,7 +5058,7 @@ public HookInfo updateHook(UUID hookId, HookInfoPatch body) { * @param body Update hook request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5072,7 +5072,7 @@ public Response updateHookWithResponse(UUID hookId, HookInfoPatch body * * @param hookId Hook unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5088,7 +5088,7 @@ public Mono> deleteHookWithResponseAsync(UUID hookId) { * @param hookId Hook unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5103,7 +5103,7 @@ public Mono> deleteHookWithResponseAsync(UUID hookId, Context con * * @param hookId Hook unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5118,7 +5118,7 @@ public Mono deleteHookAsync(UUID hookId) { * @param hookId Hook unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5132,7 +5132,7 @@ public Mono deleteHookAsync(UUID hookId, Context context) { * * @param hookId Hook unique ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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) @@ -5146,7 +5146,7 @@ public void deleteHook(UUID hookId) { * @param hookId Hook unique ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5163,7 +5163,7 @@ public Response deleteHookWithResponse(UUID hookId, Context context) { * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -5195,7 +5195,7 @@ public Mono> getDataFeedIngestionStatusSi * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -5224,7 +5224,7 @@ public Mono> getDataFeedIngestionStatusSi * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -5245,7 +5245,7 @@ public PagedFlux getDataFeedIngestionStatusAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -5265,7 +5265,7 @@ public PagedFlux getDataFeedIngestionStatusAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -5284,7 +5284,7 @@ public PagedIterable getDataFeedIngestionStatus( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -5300,7 +5300,7 @@ public PagedIterable getDataFeedIngestionStatus( * @param dataFeedId The data feed unique id. * @param body The backfill time range. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5319,7 +5319,7 @@ public Mono> resetDataFeedIngestionStatusWithResponseAsync( * @param body The backfill time range. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5336,7 +5336,7 @@ public Mono> resetDataFeedIngestionStatusWithResponseAsync( * @param dataFeedId The data feed unique id. * @param body The backfill time range. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5353,7 +5353,7 @@ public Mono resetDataFeedIngestionStatusAsync(UUID dataFeedId, IngestionPr * @param body The backfill time range. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -5370,7 +5370,7 @@ public Mono resetDataFeedIngestionStatusAsync( * @param dataFeedId The data feed unique id. * @param body The backfill time range. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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) @@ -5385,7 +5385,7 @@ public void resetDataFeedIngestionStatus(UUID dataFeedId, IngestionProgressReset * @param body The backfill time range. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5400,7 +5400,7 @@ public Response resetDataFeedIngestionStatusWithResponse( * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data last success ingestion job timestamp by data feed. */ @@ -5417,7 +5417,7 @@ public Mono> getIngestionProgressWithRespons * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data last success ingestion job timestamp by data feed. */ @@ -5433,7 +5433,7 @@ public Mono> getIngestionProgressWithRespons * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data last success ingestion job timestamp by data feed. */ @@ -5456,7 +5456,7 @@ public Mono getIngestionProgressAsync(UUID dataFeedId * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data last success ingestion job timestamp by data feed. */ @@ -5478,7 +5478,7 @@ public Mono getIngestionProgressAsync(UUID dataFeedId * * @param dataFeedId The data feed unique id. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data last success ingestion job timestamp by data feed. */ @@ -5493,7 +5493,7 @@ public DataFeedIngestionProgress getIngestionProgress(UUID dataFeedId) { * @param dataFeedId The data feed unique id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data last success ingestion job timestamp by data feed. */ @@ -5508,7 +5508,7 @@ public Response getIngestionProgressWithResponse(UUID * @param metricId metric unique id. * @param body query time series data condition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return time series data from metric. */ @@ -5526,7 +5526,7 @@ public Mono> getMetricDataWithResponseAsync(UUID metric * @param body query time series data condition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return time series data from metric. */ @@ -5543,7 +5543,7 @@ public Mono> getMetricDataWithResponseAsync( * @param metricId metric unique id. * @param body query time series data condition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return time series data from metric. */ @@ -5567,7 +5567,7 @@ public Mono getMetricDataAsync(UUID metricId, MetricDataQueryOpt * @param body query time series data condition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return time series data from metric. */ @@ -5590,7 +5590,7 @@ public Mono getMetricDataAsync(UUID metricId, MetricDataQueryOpt * @param metricId metric unique id. * @param body query time series data condition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return time series data from metric. */ @@ -5606,7 +5606,7 @@ public MetricDataList getMetricData(UUID metricId, MetricDataQueryOptions body) * @param body query time series data condition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return time series data from metric. */ @@ -5624,7 +5624,7 @@ public Response getMetricDataWithResponse( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5656,7 +5656,7 @@ public Mono> getMetricSeriesSinglePageAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5684,7 +5684,7 @@ public Mono> getMetricSeriesSinglePageAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5705,7 +5705,7 @@ public PagedFlux getMetricSeriesAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5725,7 +5725,7 @@ public PagedFlux getMetricSeriesAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5744,7 +5744,7 @@ public PagedIterable getMetricSeries( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5762,7 +5762,7 @@ public PagedIterable getMetricSeries( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5794,7 +5794,7 @@ public Mono> getMetricDimensionSinglePageAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5822,7 +5822,7 @@ public Mono> getMetricDimensionSinglePageAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5843,7 +5843,7 @@ public PagedFlux getMetricDimensionAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5863,7 +5863,7 @@ public PagedFlux getMetricDimensionAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5882,7 +5882,7 @@ public PagedIterable getMetricDimension( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5899,7 +5899,7 @@ public PagedIterable getMetricDimension( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5930,7 +5930,7 @@ public Mono> getAnomalyDetectionCon * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5958,7 +5958,7 @@ public Mono> getAnomalyDetectionCon * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5978,7 +5978,7 @@ public PagedFlux getAnomalyDetectionConfiguration * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -5997,7 +5997,7 @@ public PagedFlux getAnomalyDetectionConfiguration * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6015,7 +6015,7 @@ public PagedIterable getAnomalyDetectionConfigura * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6034,7 +6034,7 @@ public PagedIterable getAnomalyDetectionConfigura * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6066,7 +6066,7 @@ public Mono> getEnrichmentStatusByMetricSinglePa * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6095,7 +6095,7 @@ public Mono> getEnrichmentStatusByMetricSinglePa * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6116,7 +6116,7 @@ public PagedFlux getEnrichmentStatusByMetricAsync( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6136,7 +6136,7 @@ public PagedFlux getEnrichmentStatusByMetricAsync( * @param skip for paging, skipped number. * @param maxpagesize the maximum number of items in one page. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6155,7 +6155,7 @@ public PagedIterable getEnrichmentStatusByMetric( * @param maxpagesize the maximum number of items in one page. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6171,7 +6171,7 @@ public PagedIterable getEnrichmentStatusByMetric( * @param nextLink the next link. * @param body query alerting result request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6201,7 +6201,7 @@ public Mono> getAlertsByAnomalyAlertingConfiguration * @param body query alerting result request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6227,7 +6227,7 @@ public Mono> getAlertsByAnomalyAlertingConfiguration * @param nextLink the next link. * @param body query detection anomaly result request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6257,7 +6257,7 @@ public Mono> getAnomaliesByAnomalyDetectionConfigur * @param body query detection anomaly result request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6284,7 +6284,7 @@ public Mono> getAnomaliesByAnomalyDetectionConfigur * @param nextLink the next link. * @param body query dimension values request. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6314,7 +6314,7 @@ public Mono> getDimensionOfAnomaliesByAnomalyDetectionConf * @param body query dimension values request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6341,7 +6341,7 @@ public Mono> getDimensionOfAnomaliesByAnomalyDetectionConf * @param nextLink the next link. * @param body metric feedback filter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6369,7 +6369,7 @@ public Mono> listMetricFeedbacksNextSinglePageAsyn * @param body metric feedback filter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6395,7 +6395,7 @@ public Mono> listMetricFeedbacksNextSinglePageAsyn * @param nextLink the next link. * @param body The query time range. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -6425,7 +6425,7 @@ public Mono> getDataFeedIngestionStatusNe * @param body The query time range. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data ingestion status by data feed. */ @@ -6451,7 +6451,7 @@ public Mono> getDataFeedIngestionStatusNe * @param nextLink the next link. * @param body filter to query series. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6479,7 +6479,7 @@ public Mono> getMetricSeriesNextSinglePageAsync( * @param body filter to query series. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6505,7 +6505,7 @@ public Mono> getMetricSeriesNextSinglePageAsync( * @param nextLink the next link. * @param body query dimension option. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6533,7 +6533,7 @@ public Mono> getMetricDimensionNextSinglePageAsync( * @param body query dimension option. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6559,7 +6559,7 @@ public Mono> getMetricDimensionNextSinglePageAsync( * @param nextLink the next link. * @param body query options. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6589,7 +6589,7 @@ public Mono> getEnrichmentStatusByMetricNextSing * @param body query options. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6614,7 +6614,7 @@ public Mono> getEnrichmentStatusByMetricNextSing * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6643,7 +6643,7 @@ public Mono> getAnomaliesFromAlertByAnomalyAlerting * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6669,7 +6669,7 @@ public Mono> getAnomaliesFromAlertByAnomalyAlerting * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6698,7 +6698,7 @@ public Mono> getIncidentsFromAlertByAnomalyAlertin * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6724,7 +6724,7 @@ public Mono> getIncidentsFromAlertByAnomalyAlertin * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6753,7 +6753,7 @@ public Mono> getIncidentsFromAlertByAnomalyAlertin * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6780,7 +6780,7 @@ public Mono> getIncidentsFromAlertByAnomalyAlertin * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6809,7 +6809,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6834,7 +6834,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6863,7 +6863,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6889,7 +6889,7 @@ public Mono> getIncidentsByAnomalyDetectionConfigu * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6915,7 +6915,7 @@ public Mono> listCredentialsNextSinglePageAs * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6940,7 +6940,7 @@ public Mono> listCredentialsNextSinglePageAs * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6965,7 +6965,7 @@ public Mono> listDataFeedsNextSinglePageAsync(Stri * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -6989,7 +6989,7 @@ public Mono> listDataFeedsNextSinglePageAsync(Stri * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -7014,7 +7014,7 @@ public Mono> listHooksNextSinglePageAsync(String nextLin * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -7038,7 +7038,7 @@ public Mono> listHooksNextSinglePageAsync(String nextLin * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ @@ -7067,7 +7067,7 @@ public Mono> listHooksNextSinglePageAsync(String nextLin * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorCodeException thrown if the request is rejected by server. + * @throws MetricsAdvisorResponseException 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. */ diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/AnomalyProperty.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/AnomalyProperty.java index 0b504df8cfa5..0e65b3bd4673 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/AnomalyProperty.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/AnomalyProperty.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.AnomalyStatus; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/ChangeThresholdConditionPatch.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/ChangeThresholdConditionPatch.java index 6f938c093733..8b60ad04497b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/ChangeThresholdConditionPatch.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/ChangeThresholdConditionPatch.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DataFeedDetail.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DataFeedDetail.java index 87a91cd08514..fc700c8dd6ad 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DataFeedDetail.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DataFeedDetail.java @@ -4,8 +4,8 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DimensionGroupConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DimensionGroupConfiguration.java index 4dca9793dad0..ccf7579d5e72 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DimensionGroupConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/DimensionGroupConfiguration.java @@ -4,9 +4,9 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/Granularity.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/Granularity.java index 6ab44ae84006..82e53d0dfa9d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/Granularity.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/Granularity.java @@ -28,9 +28,6 @@ public final class Granularity extends ExpandableStringEnum { /** Static value Minutely for Granularity. */ public static final Granularity MINUTELY = fromString("Minutely"); - /** Static value Secondly for Granularity. */ - public static final Granularity SECONDLY = fromString("Secondly"); - /** Static value Custom for Granularity. */ public static final Granularity CUSTOM = fromString("Custom"); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/HardThresholdConditionPatch.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/HardThresholdConditionPatch.java index 00e3c4a425e6..411b33611b31 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/HardThresholdConditionPatch.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/HardThresholdConditionPatch.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IncidentProperty.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IncidentProperty.java index aca955e5008f..775b0325321a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IncidentProperty.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IncidentProperty.java @@ -5,7 +5,7 @@ package com.azure.ai.metricsadvisor.implementation.models; import com.azure.ai.metricsadvisor.models.AnomalyIncidentStatus; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IngestionStatusList.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IngestionStatusList.java index d42c387b195c..e5e5f75c7280 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IngestionStatusList.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/IngestionStatusList.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/MetricAlertingConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/MetricAlertingConfiguration.java index 7850f7a9a047..ba228e0e9016 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/MetricAlertingConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/MetricAlertingConfiguration.java @@ -4,9 +4,9 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertSnoozeCondition; -import com.azure.ai.metricsadvisor.models.SeverityCondition; -import com.azure.ai.metricsadvisor.models.TopNGroupScope; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertSnoozeCondition; +import com.azure.ai.metricsadvisor.administration.models.SeverityCondition; +import com.azure.ai.metricsadvisor.administration.models.TopNGroupScope; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.UUID; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeriesConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeriesConfiguration.java index 2af0e12af093..b3157117b87e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeriesConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeriesConfiguration.java @@ -4,9 +4,9 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeverityFilterCondition.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeverityFilterCondition.java index e3ab15f7a838..17df8d565107 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeverityFilterCondition.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SeverityFilterCondition.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SmartDetectionConditionPatch.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SmartDetectionConditionPatch.java index 50d66249620c..3e9c985cc870 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SmartDetectionConditionPatch.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/SmartDetectionConditionPatch.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/WholeMetricConfiguration.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/WholeMetricConfiguration.java index 717d6412569d..1d731997ce76 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/WholeMetricConfiguration.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/models/WholeMetricConfiguration.java @@ -4,9 +4,9 @@ package com.azure.ai.metricsadvisor.implementation.models; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AlertConfigurationTransforms.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AlertConfigurationTransforms.java index 7dcdb01dab8e..41d96440c429 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AlertConfigurationTransforms.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AlertConfigurationTransforms.java @@ -11,15 +11,15 @@ import com.azure.ai.metricsadvisor.implementation.models.Direction; import com.azure.ai.metricsadvisor.implementation.models.MetricAlertingConfiguration; import com.azure.ai.metricsadvisor.implementation.models.ValueCondition; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.BoundaryDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.BoundaryDirection; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScopeType; -import com.azure.ai.metricsadvisor.models.MetricBoundaryCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScopeType; +import com.azure.ai.metricsadvisor.administration.models.MetricBoundaryCondition; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.logging.ClientLogger; @@ -123,7 +123,7 @@ private static List getMetricAlertConfigList( .getSeriesGroupInScope() .asMap()); innerMetricAlertConfiguration.setDimensionAnomalyScope(innerId); - } else if (alertScope.getScopeType() == MetricAnomalyAlertScopeType.TOPN) { + } else if (alertScope.getScopeType() == MetricAnomalyAlertScopeType.TOP_N) { innerMetricAlertConfiguration.setAnomalyScopeType(AnomalyScope.TOPN); innerMetricAlertConfiguration.setTopNAnomalyScope(alertScope.getTopNGroupInScope()); } @@ -136,19 +136,15 @@ private static List getMetricAlertConfigList( ValueCondition innerValueCondition = new ValueCondition(); if (boundaryConditions != null) { BoundaryDirection direction = boundaryConditions.getDirection(); - switch (direction) { - case LOWER: - innerValueCondition.setDirection(Direction.DOWN); - break; - case UPPER: - innerValueCondition.setDirection(Direction.UP); - break; - case BOTH: - innerValueCondition.setDirection(Direction.BOTH); - break; - default: - throw LOGGER.logExceptionAsError(new IllegalStateException("Unexpected value: " - + direction)); + if (direction == BoundaryDirection.LOWER) { + innerValueCondition.setDirection(Direction.DOWN); + } else if (direction == BoundaryDirection.UPPER) { + innerValueCondition.setDirection(Direction.UP); + } else if (direction == BoundaryDirection.BOTH) { + innerValueCondition.setDirection(Direction.BOTH); + } else { + throw LOGGER.logExceptionAsError(new IllegalStateException("Unexpected value: " + + direction)); } innerValueCondition.setLower(boundaryConditions.getLowerBoundary()); innerValueCondition.setUpper(boundaryConditions.getUpperBoundary()); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyAlertConfigurationHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyAlertConfigurationHelper.java index f3aaac1b9bdd..1a75ff9a1351 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyAlertConfigurationHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyAlertConfigurationHelper.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; /** * The helper class to set the non-public properties of an {@link AnomalyAlertConfiguration} instance. diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyDetectionConfigurationHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyDetectionConfigurationHelper.java index a3e934428296..e79ec18b0dad 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyDetectionConfigurationHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyDetectionConfigurationHelper.java @@ -3,7 +3,7 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; /** * The helper class to set the non-public properties of an {@link AnomalyDetectionConfiguration} instance. diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyHelper.java index d25907388c64..2e352355bbc3 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyHelper.java @@ -3,7 +3,7 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.DataPointAnomaly; import com.azure.ai.metricsadvisor.models.AnomalyStatus; import com.azure.ai.metricsadvisor.models.DimensionKey; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyTransforms.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyTransforms.java index 3503911fe1fe..0b7dbbeafe06 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyTransforms.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AnomalyTransforms.java @@ -7,7 +7,7 @@ import com.azure.ai.metricsadvisor.implementation.models.DetectionAnomalyFilterCondition; import com.azure.ai.metricsadvisor.implementation.models.DimensionGroupIdentity; import com.azure.ai.metricsadvisor.implementation.models.SeverityFilterCondition; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.DataPointAnomaly; import com.azure.ai.metricsadvisor.models.DimensionKey; import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedFilter; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureBlobDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureBlobDataFeedSourceAccessor.java new file mode 100644 index 000000000000..4923a710ce93 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureBlobDataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureBlobDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class AzureBlobDataFeedSourceAccessor { + private static Accessor accessor; + + private AzureBlobDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link SqlServerDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(AzureBlobDataFeedSource feedSource); + } + + /** + * The method called from {@link AzureBlobDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureBlobDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(AzureBlobDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureCosmosDbDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureCosmosDbDataFeedSourceAccessor.java new file mode 100644 index 000000000000..b6012ad84ab9 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureCosmosDbDataFeedSourceAccessor.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureCosmosDbDataFeedSource; + +public final class AzureCosmosDbDataFeedSourceAccessor { + private static Accessor accessor; + + private AzureCosmosDbDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link AzureCosmosDbDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(AzureCosmosDbDataFeedSource feedSource); + } + + /** + * The method called from {@link AzureCosmosDbDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureCosmosDbDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(AzureCosmosDbDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataExplorerDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataExplorerDataFeedSourceAccessor.java new file mode 100644 index 000000000000..1e77ffec316f --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataExplorerDataFeedSourceAccessor.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureDataExplorerDataFeedSource; + +public final class AzureDataExplorerDataFeedSourceAccessor { + private static Accessor accessor; + + private AzureDataExplorerDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link AzureDataExplorerDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(AzureDataExplorerDataFeedSource feedSource); + } + + /** + * The method called from {@link AzureDataExplorerDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureDataExplorerDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(AzureDataExplorerDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataLakeStorageGen2DataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataLakeStorageGen2DataFeedSourceAccessor.java new file mode 100644 index 000000000000..182ff57e61e6 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureDataLakeStorageGen2DataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureDataLakeStorageGen2DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class AzureDataLakeStorageGen2DataFeedSourceAccessor { + private static Accessor accessor; + + private AzureDataLakeStorageGen2DataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link AzureDataLakeStorageGen2DataFeedSource} instance. + */ + public interface Accessor { + String getAccountKey(AzureDataLakeStorageGen2DataFeedSource feedSource); + } + + /** + * The method called from {@link SqlServerDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureDataLakeStorageGen2DataFeedSourceAccessor.accessor = accessor; + } + + public static String getAccountKey(AzureDataLakeStorageGen2DataFeedSource feedSource) { + return accessor.getAccountKey(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureEventHubsDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureEventHubsDataFeedSourceAccessor.java new file mode 100644 index 000000000000..2cb6790bcfb2 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureEventHubsDataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureEventHubsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class AzureEventHubsDataFeedSourceAccessor { + private static Accessor accessor; + + private AzureEventHubsDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link SqlServerDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(AzureEventHubsDataFeedSource feedSource); + } + + /** + * The method called from {@link SqlServerDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureEventHubsDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(AzureEventHubsDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureLogAnalyticsDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureLogAnalyticsDataFeedSourceAccessor.java new file mode 100644 index 000000000000..8ccd45adce52 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureLogAnalyticsDataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureLogAnalyticsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class AzureLogAnalyticsDataFeedSourceAccessor { + private static Accessor accessor; + + private AzureLogAnalyticsDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link SqlServerDataFeedSource} instance. + */ + public interface Accessor { + String getClientSecret(AzureLogAnalyticsDataFeedSource feedSource); + } + + /** + * The method called from {@link AzureLogAnalyticsDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureLogAnalyticsDataFeedSourceAccessor.accessor = accessor; + } + + public static String getClientSecret(AzureLogAnalyticsDataFeedSource feedSource) { + return accessor.getClientSecret(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureTableDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureTableDataFeedSourceAccessor.java new file mode 100644 index 000000000000..e50ed6bad771 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/AzureTableDataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.AzureTableDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class AzureTableDataFeedSourceAccessor { + private static Accessor accessor; + + private AzureTableDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link AzureTableDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(AzureTableDataFeedSource feedSource); + } + + /** + * The method called from {@link SqlServerDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + AzureTableDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(AzureTableDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedHelper.java index 9f8be9954b60..3f190bc00098 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedHelper.java @@ -3,9 +3,9 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; -import com.azure.ai.metricsadvisor.models.DataFeedStatus; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedStatus; import java.time.OffsetDateTime; import java.util.Map; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedTransforms.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedTransforms.java index 4b3e767d0552..6d4f50fe95f2 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedTransforms.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataFeedTransforms.java @@ -3,6 +3,7 @@ package com.azure.ai.metricsadvisor.implementation.util; +import com.azure.ai.metricsadvisor.implementation.models.AuthenticationTypeEnum; import com.azure.ai.metricsadvisor.implementation.models.AzureApplicationInsightsDataFeed; import com.azure.ai.metricsadvisor.implementation.models.AzureApplicationInsightsDataFeedPatch; import com.azure.ai.metricsadvisor.implementation.models.AzureApplicationInsightsParameter; @@ -51,35 +52,35 @@ import com.azure.ai.metricsadvisor.implementation.models.SQLServerDataFeedPatch; import com.azure.ai.metricsadvisor.implementation.models.SQLSourceParameterPatch; import com.azure.ai.metricsadvisor.implementation.models.SqlSourceParameter; -import com.azure.ai.metricsadvisor.models.AzureAppInsightsDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureBlobDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureCosmosDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureDataExplorerDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureDataLakeStorageGen2DataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureEventHubsDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureLogAnalyticsDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureTableDataFeedSource; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedAccessMode; -import com.azure.ai.metricsadvisor.models.DataFeedAutoRollUpMethod; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedMissingDataPointFillSettings; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedRollupSettings; -import com.azure.ai.metricsadvisor.models.DataFeedRollupType; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedSource; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; -import com.azure.ai.metricsadvisor.models.DataFeedStatus; -import com.azure.ai.metricsadvisor.models.DataFeedMissingDataPointFillType; -import com.azure.ai.metricsadvisor.models.InfluxDBDataFeedSource; -import com.azure.ai.metricsadvisor.models.MongoDBDataFeedSource; -import com.azure.ai.metricsadvisor.models.MySqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.PostgreSqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.SQLServerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureAppInsightsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureBlobDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureCosmosDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataExplorerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataLakeStorageGen2DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureEventHubsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureLogAnalyticsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureTableDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedAccessMode; +import com.azure.ai.metricsadvisor.administration.models.DataFeedAutoRollUpMethod; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMissingDataPointFillSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedStatus; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMissingDataPointFillType; +import com.azure.ai.metricsadvisor.models.InfluxDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.MongoDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.MySqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.PostgreSqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; import com.azure.core.util.logging.ClientLogger; import java.time.Duration; @@ -165,13 +166,25 @@ private static DataFeed setDataFeedSourceType(final DataFeedDetail dataFeedDetai } else if (dataFeedDetail instanceof AzureBlobDataFeed) { final AzureBlobParameter dataSourceParameter = ((AzureBlobDataFeed) dataFeedDetail) .getDataSourceParameter(); - dataFeed.setSource(new AzureBlobDataFeedSource(dataSourceParameter.getConnectionString(), - dataSourceParameter.getContainer(), dataSourceParameter.getBlobTemplate())); + if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.BASIC) { + dataFeed.setSource(AzureBlobDataFeedSource.fromBasicCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getContainer(), + dataSourceParameter.getBlobTemplate())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.MANAGED_IDENTITY) { + dataFeed.setSource(AzureBlobDataFeedSource.fromManagedIdentityCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getContainer(), + dataSourceParameter.getBlobTemplate())); + } else { + throw LOGGER.logExceptionAsError(new RuntimeException( + String.format("AuthType %s not supported for Blob", dataFeedDetail.getAuthenticationType()))); + } dataFeedSourceType = DataFeedSourceType.AZURE_BLOB; } else if (dataFeedDetail instanceof AzureCosmosDBDataFeed) { final AzureCosmosDBParameter dataSourceParameter = ((AzureCosmosDBDataFeed) dataFeedDetail).getDataSourceParameter(); - dataFeed.setSource(new AzureCosmosDataFeedSource( + dataFeed.setSource(new AzureCosmosDbDataFeedSource( dataSourceParameter.getConnectionString(), dataSourceParameter.getSqlQuery(), dataSourceParameter.getDatabase(), @@ -181,10 +194,33 @@ private static DataFeed setDataFeedSourceType(final DataFeedDetail dataFeedDetai } else if (dataFeedDetail instanceof AzureDataExplorerDataFeed) { final SqlSourceParameter dataSourceParameter = ((AzureDataExplorerDataFeed) dataFeedDetail).getDataSourceParameter(); - dataFeed.setSource(new AzureDataExplorerDataFeedSource( - dataSourceParameter.getConnectionString(), - dataSourceParameter.getQuery() - )); + if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.BASIC) { + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromBasicCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery() + )); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.MANAGED_IDENTITY) { + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromManagedIdentityCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery() + )); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL) { + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromServicePrincipalCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery(), + dataFeedDetail.getCredentialId() + )); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL_IN_KV) { + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromServicePrincipalInKeyVaultCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery(), + dataFeedDetail.getCredentialId() + )); + } else { + throw LOGGER.logExceptionAsError(new RuntimeException( + String.format("AuthType %s not supported for AzureDataExplorer", + dataFeedDetail.getAuthenticationType()))); + } dataFeedSourceType = DataFeedSourceType.AZURE_DATA_EXPLORER; } else if (dataFeedDetail instanceof AzureEventHubsDataFeed) { final AzureEventHubsParameter azureEventHubsParameter = @@ -201,7 +237,7 @@ private static DataFeed setDataFeedSourceType(final DataFeedDetail dataFeedDetai dataFeedSourceType = DataFeedSourceType.AZURE_TABLE; } else if (dataFeedDetail instanceof InfluxDBDataFeed) { final InfluxDBParameter dataSourceParameter = ((InfluxDBDataFeed) dataFeedDetail).getDataSourceParameter(); - dataFeed.setSource(new InfluxDBDataFeedSource( + dataFeed.setSource(new InfluxDbDataFeedSource( dataSourceParameter.getConnectionString(), dataSourceParameter.getDatabase(), dataSourceParameter.getUserName(), @@ -227,12 +263,37 @@ private static DataFeed setDataFeedSourceType(final DataFeedDetail dataFeedDetai } else if (dataFeedDetail instanceof SQLServerDataFeed) { final SqlSourceParameter dataSourceParameter = ((SQLServerDataFeed) dataFeedDetail) .getDataSourceParameter(); - dataFeed.setSource(new SQLServerDataFeedSource(dataSourceParameter.getConnectionString(), - dataSourceParameter.getQuery())); + if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.BASIC) { + dataFeed.setSource(SqlServerDataFeedSource.fromBasicCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.MANAGED_IDENTITY) { + dataFeed.setSource(SqlServerDataFeedSource.fromManagedIdentityCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.AZURE_SQLCONNECTION_STRING) { + dataFeed.setSource(SqlServerDataFeedSource.fromConnectionStringCredential( + dataSourceParameter.getQuery(), + dataFeedDetail.getCredentialId())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL) { + dataFeed.setSource(SqlServerDataFeedSource.fromServicePrincipalCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery(), + dataFeedDetail.getCredentialId())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL_IN_KV) { + dataFeed.setSource(SqlServerDataFeedSource.fromServicePrincipalInKeyVaultCredential( + dataSourceParameter.getConnectionString(), + dataSourceParameter.getQuery(), + dataFeedDetail.getCredentialId())); + } else { + throw LOGGER.logExceptionAsError(new RuntimeException( + String.format("AuthType %s not supported for AzureSqlServer", + dataFeedDetail.getAuthenticationType()))); + } dataFeedSourceType = DataFeedSourceType.SQL_SERVER_DB; } else if (dataFeedDetail instanceof MongoDBDataFeed) { final MongoDBParameter dataSourceParameter = ((MongoDBDataFeed) dataFeedDetail).getDataSourceParameter(); - dataFeed.setSource(new MongoDBDataFeedSource( + dataFeed.setSource(new MongoDbDataFeedSource( dataSourceParameter.getConnectionString(), dataSourceParameter.getDatabase(), dataSourceParameter.getCommand() @@ -241,22 +302,69 @@ private static DataFeed setDataFeedSourceType(final DataFeedDetail dataFeedDetai } else if (dataFeedDetail instanceof AzureDataLakeStorageGen2DataFeed) { final AzureDataLakeStorageGen2Parameter azureDataLakeStorageGen2Parameter = ((AzureDataLakeStorageGen2DataFeed) dataFeedDetail).getDataSourceParameter(); - dataFeed.setSource(new AzureDataLakeStorageGen2DataFeedSource( - azureDataLakeStorageGen2Parameter.getAccountName(), - azureDataLakeStorageGen2Parameter.getAccountKey(), - azureDataLakeStorageGen2Parameter.getFileSystemName(), - azureDataLakeStorageGen2Parameter.getDirectoryTemplate(), - azureDataLakeStorageGen2Parameter.getFileTemplate() - )); + if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.BASIC) { + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromBasicCredential( + azureDataLakeStorageGen2Parameter.getAccountName(), + azureDataLakeStorageGen2Parameter.getAccountKey(), + azureDataLakeStorageGen2Parameter.getFileSystemName(), + azureDataLakeStorageGen2Parameter.getDirectoryTemplate(), + azureDataLakeStorageGen2Parameter.getFileTemplate() + )); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.DATA_LAKE_GEN2SHARED_KEY) { + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromSharedKeyCredential( + azureDataLakeStorageGen2Parameter.getAccountName(), + azureDataLakeStorageGen2Parameter.getFileSystemName(), + azureDataLakeStorageGen2Parameter.getDirectoryTemplate(), + azureDataLakeStorageGen2Parameter.getFileTemplate(), + dataFeedDetail.getCredentialId() + )); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL) { + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromServicePrincipalCredential( + azureDataLakeStorageGen2Parameter.getAccountName(), + azureDataLakeStorageGen2Parameter.getFileSystemName(), + azureDataLakeStorageGen2Parameter.getDirectoryTemplate(), + azureDataLakeStorageGen2Parameter.getFileTemplate(), + dataFeedDetail.getCredentialId() + )); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL_IN_KV) { + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromServicePrincipalInKeyVaultCredential( + azureDataLakeStorageGen2Parameter.getAccountName(), + azureDataLakeStorageGen2Parameter.getFileSystemName(), + azureDataLakeStorageGen2Parameter.getDirectoryTemplate(), + azureDataLakeStorageGen2Parameter.getFileTemplate(), + dataFeedDetail.getCredentialId() + )); + } else { + throw LOGGER.logExceptionAsError(new RuntimeException( + String.format("AuthType %s not supported for AzureDataLakeStorageGen2", + dataFeedDetail.getAuthenticationType()))); + } dataFeedSourceType = DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2; } else if (dataFeedDetail instanceof AzureLogAnalyticsDataFeed) { final AzureLogAnalyticsParameter azureLogAnalyticsDataFeed = ((AzureLogAnalyticsDataFeed) dataFeedDetail).getDataSourceParameter(); - dataFeed.setSource(new AzureLogAnalyticsDataFeedSource(azureLogAnalyticsDataFeed.getTenantId(), - azureLogAnalyticsDataFeed.getClientId(), - azureLogAnalyticsDataFeed.getClientSecret(), - azureLogAnalyticsDataFeed.getWorkspaceId(), - azureLogAnalyticsDataFeed.getQuery())); + if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.BASIC) { + dataFeed.setSource(AzureLogAnalyticsDataFeedSource.fromBasicCredential( + azureLogAnalyticsDataFeed.getTenantId(), + azureLogAnalyticsDataFeed.getClientId(), + azureLogAnalyticsDataFeed.getClientSecret(), + azureLogAnalyticsDataFeed.getWorkspaceId(), + azureLogAnalyticsDataFeed.getQuery())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL) { + dataFeed.setSource(AzureLogAnalyticsDataFeedSource.fromServicePrincipalCredential( + azureLogAnalyticsDataFeed.getWorkspaceId(), + azureLogAnalyticsDataFeed.getQuery(), + dataFeedDetail.getCredentialId())); + } else if (dataFeedDetail.getAuthenticationType() == AuthenticationTypeEnum.SERVICE_PRINCIPAL_IN_KV) { + dataFeed.setSource(AzureLogAnalyticsDataFeedSource.fromServicePrincipalInKeyVaultCredential( + azureLogAnalyticsDataFeed.getWorkspaceId(), + azureLogAnalyticsDataFeed.getQuery(), + dataFeedDetail.getCredentialId())); + } else { + throw LOGGER.logExceptionAsError(new RuntimeException( + String.format("AuthType %s not supported for AzureLogAnalytics", + dataFeedDetail.getAuthenticationType()))); + } dataFeedSourceType = DataFeedSourceType.AZURE_LOG_ANALYTICS; } else { throw LOGGER.logExceptionAsError(new RuntimeException( @@ -288,82 +396,98 @@ public static DataFeedDetail toDataFeedDetailSource(final DataFeedSource dataFee final AzureBlobDataFeedSource azureBlobDataFeedSource = ((AzureBlobDataFeedSource) dataFeedSource); dataFeedDetail = new AzureBlobDataFeed() .setDataSourceParameter(new AzureBlobParameter() - .setConnectionString(azureBlobDataFeedSource.getConnectionString()) + .setConnectionString(AzureBlobDataFeedSourceAccessor.getConnectionString(azureBlobDataFeedSource)) .setContainer(azureBlobDataFeedSource.getContainer()) - .setBlobTemplate(azureBlobDataFeedSource.getBlobTemplate())); - } else if (dataFeedSource instanceof AzureCosmosDataFeedSource) { - final AzureCosmosDataFeedSource azureCosmosDataFeedSource = ((AzureCosmosDataFeedSource) dataFeedSource); + .setBlobTemplate(azureBlobDataFeedSource.getBlobTemplate())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureBlobDataFeedSource.getAuthenticationType().toString())); + } else if (dataFeedSource instanceof AzureCosmosDbDataFeedSource) { + final AzureCosmosDbDataFeedSource azureCosmosDbDataFeedSource = ((AzureCosmosDbDataFeedSource) dataFeedSource); dataFeedDetail = new AzureCosmosDBDataFeed() .setDataSourceParameter(new AzureCosmosDBParameter() - .setConnectionString(azureCosmosDataFeedSource.getConnectionString()) - .setCollectionId(azureCosmosDataFeedSource.getCollectionId()) - .setDatabase(azureCosmosDataFeedSource.getDatabase()) - .setSqlQuery(azureCosmosDataFeedSource.getSqlQuery())); + .setConnectionString(AzureCosmosDbDataFeedSourceAccessor + .getConnectionString(azureCosmosDbDataFeedSource)) + .setCollectionId(azureCosmosDbDataFeedSource.getCollectionId()) + .setDatabase(azureCosmosDbDataFeedSource.getDatabase()) + .setSqlQuery(azureCosmosDbDataFeedSource.getSqlQuery())); } else if (dataFeedSource instanceof AzureDataExplorerDataFeedSource) { final AzureDataExplorerDataFeedSource azureDataExplorerDataFeedSource = ((AzureDataExplorerDataFeedSource) dataFeedSource); dataFeedDetail = new AzureDataExplorerDataFeed() .setDataSourceParameter(new SqlSourceParameter() - .setConnectionString(azureDataExplorerDataFeedSource.getConnectionString()) - .setQuery(azureDataExplorerDataFeedSource.getQuery())); + .setConnectionString( + AzureDataExplorerDataFeedSourceAccessor.getConnectionString(azureDataExplorerDataFeedSource)) + .setQuery(azureDataExplorerDataFeedSource.getQuery())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureDataExplorerDataFeedSource.getAuthenticationType().toString())) + .setCredentialId(azureDataExplorerDataFeedSource.getCredentialId()); } else if (dataFeedSource instanceof AzureEventHubsDataFeedSource) { final AzureEventHubsDataFeedSource azureEventHubsDataFeedSource = ((AzureEventHubsDataFeedSource) dataFeedSource); dataFeedDetail = new AzureEventHubsDataFeed() .setDataSourceParameter(new AzureEventHubsParameter() - .setConnectionString(azureEventHubsDataFeedSource.getConnectionString()) + .setConnectionString(AzureEventHubsDataFeedSourceAccessor. + getConnectionString(azureEventHubsDataFeedSource)) .setConsumerGroup(azureEventHubsDataFeedSource.getConsumerGroup())); } else if (dataFeedSource instanceof AzureTableDataFeedSource) { final AzureTableDataFeedSource azureTableDataFeedSource = ((AzureTableDataFeedSource) dataFeedSource); dataFeedDetail = new AzureTableDataFeed() .setDataSourceParameter(new AzureTableParameter() - .setConnectionString(azureTableDataFeedSource.getConnectionString()) + .setConnectionString(AzureTableDataFeedSourceAccessor + .getConnectionString(azureTableDataFeedSource)) .setTable(azureTableDataFeedSource.getTableName()) .setQuery(azureTableDataFeedSource.getQueryScript())); - } else if (dataFeedSource instanceof InfluxDBDataFeedSource) { - final InfluxDBDataFeedSource influxDBDataFeedSource = ((InfluxDBDataFeedSource) dataFeedSource); + } else if (dataFeedSource instanceof InfluxDbDataFeedSource) { + final InfluxDbDataFeedSource influxDBDataFeedSource = ((InfluxDbDataFeedSource) dataFeedSource); dataFeedDetail = new InfluxDBDataFeed() .setDataSourceParameter(new InfluxDBParameter() .setConnectionString(influxDBDataFeedSource.getConnectionString()) .setDatabase(influxDBDataFeedSource.getDatabase()) .setQuery(influxDBDataFeedSource.getQuery()) - .setPassword(influxDBDataFeedSource.getPassword()) + .setPassword(InfluxDbDataFeedSourceAccessor.getPassword(influxDBDataFeedSource)) .setUserName(influxDBDataFeedSource.getUserName())); } else if (dataFeedSource instanceof MySqlDataFeedSource) { final MySqlDataFeedSource mySqlDataFeedSource = ((MySqlDataFeedSource) dataFeedSource); dataFeedDetail = new MySqlDataFeed() .setDataSourceParameter(new SqlSourceParameter() - .setConnectionString(mySqlDataFeedSource.getConnectionString()) + .setConnectionString(MySqlDataFeedSourceAccessor.getConnectionString(mySqlDataFeedSource)) .setQuery(mySqlDataFeedSource.getQuery())); } else if (dataFeedSource instanceof PostgreSqlDataFeedSource) { final PostgreSqlDataFeedSource postgreSqlDataFeedSource = ((PostgreSqlDataFeedSource) dataFeedSource); dataFeedDetail = new PostgreSqlDataFeed() .setDataSourceParameter(new SqlSourceParameter() - .setConnectionString(postgreSqlDataFeedSource.getConnectionString()) + .setConnectionString(PostgreSqlDataFeedSourceAccessor.getConnectionString(postgreSqlDataFeedSource)) .setQuery(postgreSqlDataFeedSource.getQuery())); - } else if (dataFeedSource instanceof SQLServerDataFeedSource) { - final SQLServerDataFeedSource sqlServerDataFeedSource = ((SQLServerDataFeedSource) dataFeedSource); + } else if (dataFeedSource instanceof SqlServerDataFeedSource) { + final SqlServerDataFeedSource sqlServerDataFeedSource = ((SqlServerDataFeedSource) dataFeedSource); dataFeedDetail = new SQLServerDataFeed() .setDataSourceParameter(new SqlSourceParameter() - .setConnectionString(sqlServerDataFeedSource.getConnectionString()) - .setQuery(sqlServerDataFeedSource.getQuery())); - } else if (dataFeedSource instanceof MongoDBDataFeedSource) { - final MongoDBDataFeedSource azureCosmosDataFeedSource = ((MongoDBDataFeedSource) dataFeedSource); + .setConnectionString(SqlServerDataFeedSourceAccessor.getConnectionString(sqlServerDataFeedSource)) + .setQuery(sqlServerDataFeedSource.getQuery())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(sqlServerDataFeedSource.getAuthenticationType().toString())) + .setCredentialId(sqlServerDataFeedSource.getCredentialId()); + } else if (dataFeedSource instanceof MongoDbDataFeedSource) { + final MongoDbDataFeedSource mongoDbDataFeedSource = ((MongoDbDataFeedSource) dataFeedSource); dataFeedDetail = new MongoDBDataFeed() .setDataSourceParameter(new MongoDBParameter() - .setConnectionString(azureCosmosDataFeedSource.getConnectionString()) - .setCommand(azureCosmosDataFeedSource.getCommand()) - .setDatabase(azureCosmosDataFeedSource.getDatabase())); + .setConnectionString(MongoDbDataFeedSourceAccessor.getConnectionString(mongoDbDataFeedSource)) + .setCommand(mongoDbDataFeedSource.getCommand()) + .setDatabase(mongoDbDataFeedSource.getDatabase())); } else if (dataFeedSource instanceof AzureDataLakeStorageGen2DataFeedSource) { final AzureDataLakeStorageGen2DataFeedSource azureDataLakeStorageGen2DataFeedSource = ((AzureDataLakeStorageGen2DataFeedSource) dataFeedSource); dataFeedDetail = new AzureDataLakeStorageGen2DataFeed() .setDataSourceParameter(new AzureDataLakeStorageGen2Parameter() - .setAccountKey(azureDataLakeStorageGen2DataFeedSource.getAccountKey()) + .setAccountKey(AzureDataLakeStorageGen2DataFeedSourceAccessor + .getAccountKey(azureDataLakeStorageGen2DataFeedSource)) .setAccountName(azureDataLakeStorageGen2DataFeedSource.getAccountName()) .setDirectoryTemplate(azureDataLakeStorageGen2DataFeedSource.getDirectoryTemplate()) .setFileSystemName(azureDataLakeStorageGen2DataFeedSource.getFileSystemName()) - .setFileTemplate(azureDataLakeStorageGen2DataFeedSource.getFileTemplate())); + .setFileTemplate(azureDataLakeStorageGen2DataFeedSource.getFileTemplate())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureDataLakeStorageGen2DataFeedSource.getAuthenticationType().toString())) + .setCredentialId(azureDataLakeStorageGen2DataFeedSource.getCredentialId()); } else if (dataFeedSource instanceof AzureLogAnalyticsDataFeedSource) { final AzureLogAnalyticsDataFeedSource azureLogAnalyticsDataFeedSource = ((AzureLogAnalyticsDataFeedSource) dataFeedSource); @@ -371,9 +495,13 @@ public static DataFeedDetail toDataFeedDetailSource(final DataFeedSource dataFee .setDataSourceParameter(new AzureLogAnalyticsParameter() .setTenantId(azureLogAnalyticsDataFeedSource.getTenantId()) .setClientId(azureLogAnalyticsDataFeedSource.getClientId()) - .setClientSecret(azureLogAnalyticsDataFeedSource.getClientSecret()) + .setClientSecret(AzureLogAnalyticsDataFeedSourceAccessor + .getClientSecret(azureLogAnalyticsDataFeedSource)) .setWorkspaceId(azureLogAnalyticsDataFeedSource.getWorkspaceId()) - .setQuery(azureLogAnalyticsDataFeedSource.getQuery())); + .setQuery(azureLogAnalyticsDataFeedSource.getQuery())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureLogAnalyticsDataFeedSource.getAuthenticationType().toString())) + .setCredentialId(azureLogAnalyticsDataFeedSource.getCredentialId()); } else { throw LOGGER.logExceptionAsError(new RuntimeException( String.format("Data feed source type %s not supported", dataFeedSource.getClass().getCanonicalName()))); @@ -403,97 +531,117 @@ public static DataFeedDetailPatch toInnerForUpdate(final DataFeedSource dataFeed final AzureBlobDataFeedSource azureBlobDataFeedSource = ((AzureBlobDataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureBlobDataFeedPatch() .setDataSourceParameter(new AzureBlobParameterPatch() - .setConnectionString(azureBlobDataFeedSource.getConnectionString()) + .setConnectionString(AzureBlobDataFeedSourceAccessor.getConnectionString(azureBlobDataFeedSource)) .setContainer(azureBlobDataFeedSource.getContainer()) - .setBlobTemplate(azureBlobDataFeedSource.getBlobTemplate())); - } else if (dataFeedSource instanceof AzureCosmosDataFeedSource) { - final AzureCosmosDataFeedSource azureCosmosDataFeedSource = ((AzureCosmosDataFeedSource) dataFeedSource); + .setBlobTemplate(azureBlobDataFeedSource.getBlobTemplate())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureBlobDataFeedSource.getAuthenticationType().toString())); + } else if (dataFeedSource instanceof AzureCosmosDbDataFeedSource) { + final AzureCosmosDbDataFeedSource azureCosmosDbDataFeedSource = ((AzureCosmosDbDataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureCosmosDBDataFeedPatch() .setDataSourceParameter(new AzureCosmosDBParameterPatch() - .setConnectionString(azureCosmosDataFeedSource.getConnectionString()) - .setCollectionId(azureCosmosDataFeedSource.getCollectionId()) - .setDatabase(azureCosmosDataFeedSource.getDatabase()) - .setSqlQuery(azureCosmosDataFeedSource.getSqlQuery())); + .setConnectionString(AzureCosmosDbDataFeedSourceAccessor + .getConnectionString(azureCosmosDbDataFeedSource)) + .setCollectionId(azureCosmosDbDataFeedSource.getCollectionId()) + .setDatabase(azureCosmosDbDataFeedSource.getDatabase()) + .setSqlQuery(azureCosmosDbDataFeedSource.getSqlQuery())); } else if (dataFeedSource instanceof AzureDataExplorerDataFeedSource) { final AzureDataExplorerDataFeedSource azureDataExplorerDataFeedSource = ((AzureDataExplorerDataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureDataExplorerDataFeedPatch() .setDataSourceParameter(new SQLSourceParameterPatch() - .setConnectionString(azureDataExplorerDataFeedSource.getConnectionString()) - .setQuery(azureDataExplorerDataFeedSource.getQuery())); + .setConnectionString( + AzureDataExplorerDataFeedSourceAccessor.getConnectionString(azureDataExplorerDataFeedSource)) + .setQuery(azureDataExplorerDataFeedSource.getQuery())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureDataExplorerDataFeedSource.getAuthenticationType().toString())) + .setCredentialId(azureDataExplorerDataFeedSource.getCredentialId()); } else if (dataFeedSource instanceof AzureEventHubsDataFeedSource) { final AzureEventHubsDataFeedSource azureEventHubsDataFeedSource = ((AzureEventHubsDataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureEventHubsDataFeedPatch() .setDataSourceParameter(new AzureEventHubsParameterPatch() - .setConnectionString(azureEventHubsDataFeedSource.getConnectionString()) + .setConnectionString(AzureEventHubsDataFeedSourceAccessor + .getConnectionString(azureEventHubsDataFeedSource)) .setConsumerGroup(azureEventHubsDataFeedSource.getConsumerGroup())); } else if (dataFeedSource instanceof AzureTableDataFeedSource) { final AzureTableDataFeedSource azureTableDataFeedSource = ((AzureTableDataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureTableDataFeedPatch() .setDataSourceParameter(new AzureTableParameterPatch() - .setConnectionString(azureTableDataFeedSource.getConnectionString()) + .setConnectionString(AzureTableDataFeedSourceAccessor.getConnectionString(azureTableDataFeedSource)) .setTable(azureTableDataFeedSource.getTableName()) .setQuery(azureTableDataFeedSource.getQueryScript())); - } else if (dataFeedSource instanceof InfluxDBDataFeedSource) { - final InfluxDBDataFeedSource influxDBDataFeedSource = ((InfluxDBDataFeedSource) dataFeedSource); + } else if (dataFeedSource instanceof InfluxDbDataFeedSource) { + final InfluxDbDataFeedSource influxDBDataFeedSource = ((InfluxDbDataFeedSource) dataFeedSource); dataFeedDetailPatch = new InfluxDBDataFeedPatch() .setDataSourceParameter(new InfluxDBParameterPatch() .setConnectionString(influxDBDataFeedSource.getConnectionString()) .setDatabase(influxDBDataFeedSource.getDatabase()) .setQuery(influxDBDataFeedSource.getQuery()) - .setPassword(influxDBDataFeedSource.getPassword()) + .setPassword(InfluxDbDataFeedSourceAccessor.getPassword(influxDBDataFeedSource)) .setUserName(influxDBDataFeedSource.getUserName())); } else if (dataFeedSource instanceof MySqlDataFeedSource) { final MySqlDataFeedSource mySqlDataFeedSource = ((MySqlDataFeedSource) dataFeedSource); dataFeedDetailPatch = new MySqlDataFeedPatch() .setDataSourceParameter(new SQLSourceParameterPatch() - .setConnectionString(mySqlDataFeedSource.getConnectionString()) + .setConnectionString(MySqlDataFeedSourceAccessor.getConnectionString(mySqlDataFeedSource)) .setQuery(mySqlDataFeedSource.getQuery())); } else if (dataFeedSource instanceof PostgreSqlDataFeedSource) { final PostgreSqlDataFeedSource postgreSqlDataFeedSource = ((PostgreSqlDataFeedSource) dataFeedSource); dataFeedDetailPatch = new PostgreSqlDataFeedPatch() .setDataSourceParameter(new SQLSourceParameterPatch() - .setConnectionString(postgreSqlDataFeedSource.getConnectionString()) + .setConnectionString(PostgreSqlDataFeedSourceAccessor.getConnectionString(postgreSqlDataFeedSource)) .setQuery(postgreSqlDataFeedSource.getQuery())); - } else if (dataFeedSource instanceof SQLServerDataFeedSource) { - final SQLServerDataFeedSource sqlServerDataFeedSource = ((SQLServerDataFeedSource) dataFeedSource); + } else if (dataFeedSource instanceof SqlServerDataFeedSource) { + final SqlServerDataFeedSource sqlServerDataFeedSource = ((SqlServerDataFeedSource) dataFeedSource); dataFeedDetailPatch = new SQLServerDataFeedPatch() .setDataSourceParameter(new SQLSourceParameterPatch() - .setConnectionString(sqlServerDataFeedSource.getConnectionString()) - .setQuery(sqlServerDataFeedSource.getQuery())); - } else if (dataFeedSource instanceof MongoDBDataFeedSource) { - final MongoDBDataFeedSource azureCosmosDataFeedSource = ((MongoDBDataFeedSource) dataFeedSource); + .setConnectionString(SqlServerDataFeedSourceAccessor.getConnectionString(sqlServerDataFeedSource)) + .setQuery(sqlServerDataFeedSource.getQuery())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(sqlServerDataFeedSource.getAuthenticationType().toString())) + .setCredentialId(sqlServerDataFeedSource.getCredentialId()); + } else if (dataFeedSource instanceof MongoDbDataFeedSource) { + final MongoDbDataFeedSource mongoDbDataFeedSource = ((MongoDbDataFeedSource) dataFeedSource); dataFeedDetailPatch = new MongoDBDataFeedPatch() .setDataSourceParameter(new MongoDBParameterPatch() - .setConnectionString(azureCosmosDataFeedSource.getConnectionString()) - .setCommand(azureCosmosDataFeedSource.getCommand()) - .setDatabase(azureCosmosDataFeedSource.getDatabase())); + .setConnectionString(MongoDbDataFeedSourceAccessor.getConnectionString(mongoDbDataFeedSource)) + .setCommand(mongoDbDataFeedSource.getCommand()) + .setDatabase(mongoDbDataFeedSource.getDatabase())); } else if (dataFeedSource instanceof AzureDataLakeStorageGen2DataFeedSource) { final AzureDataLakeStorageGen2DataFeedSource azureDataLakeStorageGen2DataFeedSource = ((AzureDataLakeStorageGen2DataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureDataLakeStorageGen2DataFeedPatch() .setDataSourceParameter(new AzureDataLakeStorageGen2ParameterPatch() - .setAccountKey(azureDataLakeStorageGen2DataFeedSource.getAccountKey()) + .setAccountKey(AzureDataLakeStorageGen2DataFeedSourceAccessor + .getAccountKey(azureDataLakeStorageGen2DataFeedSource)) .setAccountName(azureDataLakeStorageGen2DataFeedSource.getAccountName()) .setDirectoryTemplate(azureDataLakeStorageGen2DataFeedSource.getDirectoryTemplate()) .setFileSystemName(azureDataLakeStorageGen2DataFeedSource.getFileSystemName()) - .setFileTemplate(azureDataLakeStorageGen2DataFeedSource.getFileTemplate())); + .setFileTemplate(azureDataLakeStorageGen2DataFeedSource.getFileTemplate())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureDataLakeStorageGen2DataFeedSource.getAuthenticationType().toString())) + .setCredentialId(azureDataLakeStorageGen2DataFeedSource.getCredentialId()); } else if (dataFeedSource instanceof AzureLogAnalyticsDataFeedSource) { - final AzureLogAnalyticsDataFeedSource azureDataLakeStorageGen2DataFeedSource = + final AzureLogAnalyticsDataFeedSource azureLogAnalyticsDataFeedSource = ((AzureLogAnalyticsDataFeedSource) dataFeedSource); dataFeedDetailPatch = new AzureLogAnalyticsDataFeedPatch() .setDataSourceParameter(new AzureLogAnalyticsParameterPatch() - .setTenantId(azureDataLakeStorageGen2DataFeedSource.getTenantId()) - .setClientId(azureDataLakeStorageGen2DataFeedSource.getClientId()) - .setClientSecret(azureDataLakeStorageGen2DataFeedSource.getClientSecret()) - .setWorkspaceId(azureDataLakeStorageGen2DataFeedSource.getWorkspaceId()) - .setQuery(azureDataLakeStorageGen2DataFeedSource.getQuery())); + .setTenantId(azureLogAnalyticsDataFeedSource.getTenantId()) + .setClientId(azureLogAnalyticsDataFeedSource.getClientId()) + .setClientSecret(AzureLogAnalyticsDataFeedSourceAccessor + .getClientSecret(azureLogAnalyticsDataFeedSource)) + .setWorkspaceId(azureLogAnalyticsDataFeedSource.getWorkspaceId()) + .setQuery(azureLogAnalyticsDataFeedSource.getQuery())) + .setAuthenticationType(AuthenticationTypeEnum + .fromString(azureLogAnalyticsDataFeedSource.getAuthenticationType().toString())) + .setCredentialId(azureLogAnalyticsDataFeedSource.getCredentialId()); } else { throw LOGGER.logExceptionAsError(new RuntimeException( String.format("Data feed source type %s not supported.", dataFeedSource.getClass().getCanonicalName()))); } + return dataFeedDetailPatch; } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceCredentialEntityTransforms.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceCredentialEntityTransforms.java new file mode 100644 index 000000000000..afce1874acd8 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceCredentialEntityTransforms.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.implementation.models.AzureSQLConnectionStringCredential; +import com.azure.ai.metricsadvisor.implementation.models.AzureSQLConnectionStringCredentialPatch; +import com.azure.ai.metricsadvisor.implementation.models.AzureSQLConnectionStringParam; +import com.azure.ai.metricsadvisor.implementation.models.AzureSQLConnectionStringParamPatch; +import com.azure.ai.metricsadvisor.implementation.models.DataLakeGen2SharedKeyCredential; +import com.azure.ai.metricsadvisor.implementation.models.DataLakeGen2SharedKeyCredentialPatch; +import com.azure.ai.metricsadvisor.implementation.models.DataLakeGen2SharedKeyParam; +import com.azure.ai.metricsadvisor.implementation.models.DataLakeGen2SharedKeyParamPatch; +import com.azure.ai.metricsadvisor.implementation.models.DataSourceCredential; +import com.azure.ai.metricsadvisor.implementation.models.DataSourceCredentialPatch; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalCredential; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalCredentialPatch; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalInKVCredential; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalInKVCredentialPatch; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalInKVParam; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalInKVParamPatch; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalParam; +import com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalParamPatch; +import com.azure.ai.metricsadvisor.administration.models.DatasourceDataLakeGen2SharedKey; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceSqlServerConnectionString; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipal; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.core.util.logging.ClientLogger; + +/** + * Helper class to convert between service level credential model to SDK exposed model. + */ +public final class DataSourceCredentialEntityTransforms { + private static final ClientLogger LOGGER = new ClientLogger(DataSourceCredentialEntityTransforms.class); + + private DataSourceCredentialEntityTransforms() { + } + + /** + * Transform configuration wire model to {@link DatasourceCredentialEntity}. + * + * @param innerCredential The wire model instance. + * + * @return The custom model instance. + */ + public static DatasourceCredentialEntity fromInner(DataSourceCredential innerCredential) { + if (innerCredential instanceof AzureSQLConnectionStringCredential) { + final AzureSQLConnectionStringCredential sqlConnectionStringCredential + = (AzureSQLConnectionStringCredential) innerCredential; + final DatasourceSqlServerConnectionString credentialEntity + = new DatasourceSqlServerConnectionString( + sqlConnectionStringCredential.getDataSourceCredentialName(), + null); + DataSourceSqlServerConnectionStringAccessor.setId(credentialEntity, + sqlConnectionStringCredential.getDataSourceCredentialId().toString()); + credentialEntity.setDescription(sqlConnectionStringCredential.getDataSourceCredentialDescription()); + return credentialEntity; + } else if (innerCredential instanceof DataLakeGen2SharedKeyCredential) { + final DataLakeGen2SharedKeyCredential dataLakeGen2SharedKeyCredential + = (DataLakeGen2SharedKeyCredential) innerCredential; + final DatasourceDataLakeGen2SharedKey credentialEntity = new DatasourceDataLakeGen2SharedKey( + dataLakeGen2SharedKeyCredential.getDataSourceCredentialName(), + null); + DataSourceDataLakeGen2SharedKeyAccessor.setId(credentialEntity, + dataLakeGen2SharedKeyCredential.getDataSourceCredentialId().toString()); + credentialEntity.setDescription(dataLakeGen2SharedKeyCredential.getDataSourceCredentialDescription()); + return credentialEntity; + } else if (innerCredential instanceof ServicePrincipalCredential) { + final ServicePrincipalCredential servicePrincipalCredential = (ServicePrincipalCredential) innerCredential; + final DatasourceServicePrincipal credentialEntity = + new DatasourceServicePrincipal(servicePrincipalCredential.getDataSourceCredentialName(), + servicePrincipalCredential.getParameters().getClientId(), + servicePrincipalCredential.getParameters().getTenantId(), + null); + DataSourceServicePrincipalAccessor.setId(credentialEntity, + servicePrincipalCredential.getDataSourceCredentialId().toString()); + credentialEntity.setDescription(servicePrincipalCredential.getDataSourceCredentialDescription()); + return credentialEntity; + } else if (innerCredential instanceof ServicePrincipalInKVCredential) { + final ServicePrincipalInKVCredential servicePrincipalInKVCredential + = (ServicePrincipalInKVCredential) innerCredential; + final DatasourceServicePrincipalInKeyVault credentialEntity = + new DatasourceServicePrincipalInKeyVault(); + credentialEntity + .setName(servicePrincipalInKVCredential.getDataSourceCredentialName()) + .setDescription(servicePrincipalInKVCredential.getDataSourceCredentialDescription()) + .setKeyVaultForDatasourceSecrets(servicePrincipalInKVCredential.getParameters().getKeyVaultEndpoint(), + servicePrincipalInKVCredential.getParameters().getKeyVaultClientId(), + null) + .setTenantId(servicePrincipalInKVCredential.getParameters().getTenantId()) + .setSecretNameForDatasourceClientId( + servicePrincipalInKVCredential.getParameters().getServicePrincipalIdNameInKV()) + .setSecretNameForDatasourceClientSecret( + servicePrincipalInKVCredential.getParameters().getServicePrincipalSecretNameInKV()); + + DataSourceServicePrincipalInKeyVaultAccessor.setId(credentialEntity, + servicePrincipalInKVCredential.getDataSourceCredentialId().toString()); + + return credentialEntity; + } else { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Unknown inner credential type.")); + } + } + + public static DataSourceCredential toInnerForCreate(DatasourceCredentialEntity credentialEntity) { + if (credentialEntity instanceof DatasourceSqlServerConnectionString) { + final DatasourceSqlServerConnectionString credential + = (DatasourceSqlServerConnectionString) credentialEntity; + final AzureSQLConnectionStringCredential innerCredential = new AzureSQLConnectionStringCredential(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential.setParameters(new AzureSQLConnectionStringParam() + .setConnectionString(DataSourceSqlServerConnectionStringAccessor + .getConnectionString(credential))); + + return innerCredential; + } else if (credentialEntity instanceof DatasourceDataLakeGen2SharedKey) { + final DatasourceDataLakeGen2SharedKey credential + = (DatasourceDataLakeGen2SharedKey) credentialEntity; + final DataLakeGen2SharedKeyCredential innerCredential = new DataLakeGen2SharedKeyCredential(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential + .setParameters(new DataLakeGen2SharedKeyParam() + .setAccountKey(DataSourceDataLakeGen2SharedKeyAccessor.getSharedKey(credential))); + + return innerCredential; + } else if (credentialEntity instanceof DatasourceServicePrincipal) { + final DatasourceServicePrincipal credential + = (DatasourceServicePrincipal) credentialEntity; + final ServicePrincipalCredential innerCredential = new ServicePrincipalCredential(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential.setParameters(new ServicePrincipalParam() + .setClientId(credential.getClientId()) + .setTenantId(credential.getTenantId()) + .setClientSecret(DataSourceServicePrincipalAccessor.getClientSecret(credential))); + + return innerCredential; + } else if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + final DatasourceServicePrincipalInKeyVault credential + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + final ServicePrincipalInKVCredential innerCredential = new ServicePrincipalInKVCredential(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential.setParameters(new ServicePrincipalInKVParam() + .setKeyVaultEndpoint(credential.getKeyVaultEndpoint()) + .setKeyVaultClientId(credential.getKeyVaultClientId()) + .setKeyVaultClientSecret(DataSourceServicePrincipalInKeyVaultAccessor + .getKeyVaultClientSecret(credential)) + .setServicePrincipalIdNameInKV(credential.getSecretNameForDatasourceClientId()) + .setServicePrincipalSecretNameInKV(credential.getSecretNameForDatasourceClientSecret()) + .setTenantId(credential.getTenantId())); + return innerCredential; + } else { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Unknown credential entity type.")); + } + } + + public static DataSourceCredentialPatch toInnerForUpdate(DatasourceCredentialEntity credentialEntity) { + if (credentialEntity instanceof DatasourceSqlServerConnectionString) { + final DatasourceSqlServerConnectionString credential + = (DatasourceSqlServerConnectionString) credentialEntity; + final AzureSQLConnectionStringCredentialPatch innerCredential = new AzureSQLConnectionStringCredentialPatch(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential.setParameters(new AzureSQLConnectionStringParamPatch() + .setConnectionString(DataSourceSqlServerConnectionStringAccessor + .getConnectionString(credential))); + + return innerCredential; + } else if (credentialEntity instanceof DatasourceDataLakeGen2SharedKey) { + final DatasourceDataLakeGen2SharedKey credential + = (DatasourceDataLakeGen2SharedKey) credentialEntity; + final DataLakeGen2SharedKeyCredentialPatch innerCredential = new DataLakeGen2SharedKeyCredentialPatch(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential + .setParameters(new DataLakeGen2SharedKeyParamPatch() + .setAccountKey(DataSourceDataLakeGen2SharedKeyAccessor.getSharedKey(credential))); + + return innerCredential; + } else if (credentialEntity instanceof DatasourceServicePrincipal) { + final DatasourceServicePrincipal credential + = (DatasourceServicePrincipal) credentialEntity; + final ServicePrincipalCredentialPatch innerCredential = new ServicePrincipalCredentialPatch(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential.setParameters(new ServicePrincipalParamPatch() + .setClientId(credential.getClientId()) + .setTenantId(credential.getTenantId()) + .setClientSecret(DataSourceServicePrincipalAccessor.getClientSecret(credential))); + + return innerCredential; + } else if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + final DatasourceServicePrincipalInKeyVault credential + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + final ServicePrincipalInKVCredentialPatch innerCredential = new ServicePrincipalInKVCredentialPatch(); + innerCredential.setDataSourceCredentialName(credentialEntity.getName()); + innerCredential.setDataSourceCredentialDescription(credentialEntity.getDescription()); + innerCredential.setParameters(new ServicePrincipalInKVParamPatch() + .setKeyVaultEndpoint(credential.getKeyVaultEndpoint()) + .setKeyVaultClientId(credential.getKeyVaultClientId()) + .setKeyVaultClientSecret(DataSourceServicePrincipalInKeyVaultAccessor + .getKeyVaultClientSecret(credential)) + .setServicePrincipalIdNameInKV(credential.getSecretNameForDatasourceClientId()) + .setServicePrincipalSecretNameInKV(credential.getSecretNameForDatasourceClientSecret()) + .setTenantId(credential.getTenantId())); + return innerCredential; + } else { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Unknown credential entity type.")); + } + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceDataLakeGen2SharedKeyAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceDataLakeGen2SharedKeyAccessor.java new file mode 100644 index 000000000000..5688230e83a3 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceDataLakeGen2SharedKeyAccessor.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceDataLakeGen2SharedKey; + +public final class DataSourceDataLakeGen2SharedKeyAccessor { + private static Accessor accessor; + + private DataSourceDataLakeGen2SharedKeyAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link DatasourceDataLakeGen2SharedKey} instance. + */ + public interface Accessor { + void setId(DatasourceDataLakeGen2SharedKey entity, String id); + String getSharedKey(DatasourceDataLakeGen2SharedKey entity); + } + + /** + * The method called from {@link DatasourceDataLakeGen2SharedKey} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + DataSourceDataLakeGen2SharedKeyAccessor.accessor = accessor; + } + + public static void setId(DatasourceDataLakeGen2SharedKey entity, String id) { + accessor.setId(entity, id); + } + + public static String getSharedKey(DatasourceDataLakeGen2SharedKey entity) { + return accessor.getSharedKey(entity); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalAccessor.java new file mode 100644 index 000000000000..30e2aafb359b --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalAccessor.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipal; + +public final class DataSourceServicePrincipalAccessor { + private static Accessor accessor; + + private DataSourceServicePrincipalAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link DatasourceServicePrincipal} instance. + */ + public interface Accessor { + void setId(DatasourceServicePrincipal entity, String id); + String getClientSecret(DatasourceServicePrincipal entity); + } + + /** + * The method called from {@link DatasourceServicePrincipal} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + DataSourceServicePrincipalAccessor.accessor = accessor; + } + + public static void setId(DatasourceServicePrincipal entity, String id) { + accessor.setId(entity, id); + } + + public static String getClientSecret(DatasourceServicePrincipal entity) { + return accessor.getClientSecret(entity); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalInKeyVaultAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalInKeyVaultAccessor.java new file mode 100644 index 000000000000..96e7bc648ce7 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceServicePrincipalInKeyVaultAccessor.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; + +public final class DataSourceServicePrincipalInKeyVaultAccessor { + private static Accessor accessor; + + private DataSourceServicePrincipalInKeyVaultAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link DatasourceServicePrincipalInKeyVault} instance. + */ + public interface Accessor { + void setId(DatasourceServicePrincipalInKeyVault entity, String id); + String getKeyVaultClientSecret(DatasourceServicePrincipalInKeyVault entity); + } + + /** + * The method called from {@link DatasourceServicePrincipalInKeyVault} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + DataSourceServicePrincipalInKeyVaultAccessor.accessor = accessor; + } + + public static void setId(DatasourceServicePrincipalInKeyVault entity, String id) { + accessor.setId(entity, id); + } + + public static String getKeyVaultClientSecret(DatasourceServicePrincipalInKeyVault entity) { + return accessor.getKeyVaultClientSecret(entity); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceSqlServerConnectionStringAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceSqlServerConnectionStringAccessor.java new file mode 100644 index 000000000000..75bec7dbf91e --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DataSourceSqlServerConnectionStringAccessor.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceSqlServerConnectionString; + +public final class DataSourceSqlServerConnectionStringAccessor { + private static Accessor accessor; + + private DataSourceSqlServerConnectionStringAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link DatasourceSqlServerConnectionString} instance. + */ + public interface Accessor { + void setId(DatasourceSqlServerConnectionString entity, String id); + String getConnectionString(DatasourceSqlServerConnectionString entity); + } + + /** + * The method called from {@link DatasourceSqlServerConnectionString} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + DataSourceSqlServerConnectionStringAccessor.accessor = accessor; + } + + public static void setId(DatasourceSqlServerConnectionString entity, String id) { + accessor.setId(entity, id); + } + + public static String getConnectionString(DatasourceSqlServerConnectionString entity) { + return accessor.getConnectionString(entity); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DetectionConfigurationTransforms.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DetectionConfigurationTransforms.java index d3edc0e64424..14a46cf57d38 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DetectionConfigurationTransforms.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/DetectionConfigurationTransforms.java @@ -15,15 +15,15 @@ import com.azure.ai.metricsadvisor.implementation.models.SuppressConditionPatch; import com.azure.ai.metricsadvisor.implementation.models.WholeMetricConfiguration; import com.azure.ai.metricsadvisor.implementation.models.WholeMetricConfigurationPatch; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.MetricSeriesGroupDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricSingleSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricSeriesGroupDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSingleSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.CoreUtils; @@ -37,7 +37,7 @@ import java.util.stream.Stream; /** - * Expose transformation methods to transform {@link com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration} + * Expose transformation methods to transform {@link AnomalyDetectionConfiguration} * model to REST API wire model and vice-versa. */ public final class DetectionConfigurationTransforms { @@ -175,7 +175,7 @@ public static PagedResponse fromInnerPagedRespons } /** - * Transform {@link com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration} to create API wire model. + * Transform {@link AnomalyDetectionConfiguration} to create API wire model. * * @param metricId The metric id. * @param detectionConfiguration The custom model instance. @@ -222,7 +222,7 @@ public static com.azure.ai.metricsadvisor.implementation.models.AnomalyDetection } /** - * Transform {@link com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration} to update API wire model. + * Transform {@link AnomalyDetectionConfiguration} to update API wire model. * * @param detectionConfiguration The custom model instance. * @return The wire model instance. diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookHelper.java index 26550fdfb7ec..d276921fe2f7 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookHelper.java @@ -3,7 +3,7 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; import java.util.List; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookTransforms.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookTransforms.java index 92d0249715d7..f39d20bdf113 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookTransforms.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/HookTransforms.java @@ -13,9 +13,9 @@ import com.azure.ai.metricsadvisor.implementation.models.WebhookHookInfoPatch; import com.azure.ai.metricsadvisor.implementation.models.WebhookHookParameter; import com.azure.ai.metricsadvisor.implementation.models.WebhookHookParameterPatch; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.NotificationHook; -import com.azure.ai.metricsadvisor.models.WebNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.WebNotificationHook; import com.azure.core.http.HttpHeaders; import com.azure.core.http.rest.Page; import com.azure.core.http.rest.PagedResponse; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/IncidentHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/IncidentHelper.java index b8f63ef86423..62d9220cabc0 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/IncidentHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/IncidentHelper.java @@ -4,7 +4,7 @@ package com.azure.ai.metricsadvisor.implementation.util; import com.azure.ai.metricsadvisor.models.AnomalyIncidentStatus; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.DimensionKey; import com.azure.ai.metricsadvisor.models.AnomalyIncident; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/InfluxDbDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/InfluxDbDataFeedSourceAccessor.java new file mode 100644 index 000000000000..a05fb172312f --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/InfluxDbDataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.models.InfluxDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class InfluxDbDataFeedSourceAccessor { + private static Accessor accessor; + + private InfluxDbDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link SqlServerDataFeedSource} instance. + */ + public interface Accessor { + String getPassword(InfluxDbDataFeedSource feedSource); + } + + /** + * The method called from {@link InfluxDbDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + InfluxDbDataFeedSourceAccessor.accessor = accessor; + } + + public static String getPassword(InfluxDbDataFeedSource feedSource) { + return accessor.getPassword(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricAnomalyFeedbackHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricAnomalyFeedbackHelper.java index b9dd1ff646a2..27d9c4773d84 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricAnomalyFeedbackHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricAnomalyFeedbackHelper.java @@ -3,7 +3,7 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; import com.azure.ai.metricsadvisor.models.MetricAnomalyFeedback; /** diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricBoundaryConditionHelper.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricBoundaryConditionHelper.java index dc6612dd0dc9..3430764f664f 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricBoundaryConditionHelper.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MetricBoundaryConditionHelper.java @@ -4,8 +4,8 @@ package com.azure.ai.metricsadvisor.implementation.util; -import com.azure.ai.metricsadvisor.models.BoundaryDirection; -import com.azure.ai.metricsadvisor.models.MetricBoundaryCondition; +import com.azure.ai.metricsadvisor.administration.models.BoundaryDirection; +import com.azure.ai.metricsadvisor.administration.models.MetricBoundaryCondition; /** * The helper class to set the non-public properties of an {@link MetricBoundaryCondition} instance. diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MongoDbDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MongoDbDataFeedSourceAccessor.java new file mode 100644 index 000000000000..ad592e60df1b --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MongoDbDataFeedSourceAccessor.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.MongoDbDataFeedSource; + +public final class MongoDbDataFeedSourceAccessor { + private static Accessor accessor; + + private MongoDbDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link MongoDbDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(MongoDbDataFeedSource feedSource); + } + + /** + * The method called from {@link MongoDbDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + MongoDbDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(MongoDbDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MySqlDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MySqlDataFeedSourceAccessor.java new file mode 100644 index 000000000000..88f98b5edc15 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/MySqlDataFeedSourceAccessor.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.MySqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class MySqlDataFeedSourceAccessor { + private static Accessor accessor; + + private MySqlDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link SqlServerDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(MySqlDataFeedSource feedSource); + } + + /** + * The method called from {@link MySqlDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + MySqlDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(MySqlDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/PostgreSqlDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/PostgreSqlDataFeedSourceAccessor.java new file mode 100644 index 000000000000..461d8de16c21 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/PostgreSqlDataFeedSourceAccessor.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.PostgreSqlDataFeedSource; + +public final class PostgreSqlDataFeedSourceAccessor { + private static Accessor accessor; + + private PostgreSqlDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link PostgreSqlDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(PostgreSqlDataFeedSource feedSource); + } + + /** + * The method called from {@link PostgreSqlDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + PostgreSqlDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(PostgreSqlDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/SqlServerDataFeedSourceAccessor.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/SqlServerDataFeedSourceAccessor.java new file mode 100644 index 000000000000..73ec2f6c85d8 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/implementation/util/SqlServerDataFeedSourceAccessor.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.implementation.util; + +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; + +public final class SqlServerDataFeedSourceAccessor { + private static Accessor accessor; + + private SqlServerDataFeedSourceAccessor() { + } + + /** + * Type defining the methods to set the non-public properties of + * an {@link SqlServerDataFeedSource} instance. + */ + public interface Accessor { + String getConnectionString(SqlServerDataFeedSource feedSource); + } + + /** + * The method called from {@link SqlServerDataFeedSource} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final Accessor accessor) { + SqlServerDataFeedSourceAccessor.accessor = accessor; + } + + public static String getConnectionString(SqlServerDataFeedSource feedSource) { + return accessor.getConnectionString(feedSource); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyIncident.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyIncident.java index 5eaf76e86218..62da6421c218 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyIncident.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AnomalyIncident.java @@ -3,6 +3,7 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.implementation.util.IncidentHelper; import java.time.OffsetDateTime; @@ -20,8 +21,8 @@ public final class AnomalyIncident { private AnomalyIncidentStatus status; private OffsetDateTime startTime; private OffsetDateTime lastTime; - private Double value; - private Double expectedValue; + private Double valueOfRootNode; + private Double expectedValueOfRootNode; static { IncidentHelper.setAccessor(new IncidentHelper.IncidentAccessor() { @@ -52,12 +53,12 @@ public void setRootDimensionKey(AnomalyIncident incident, DimensionKey rootDimen @Override public void setValue(AnomalyIncident incident, Double value) { - incident.setValue(value); + incident.setValueOfRootNode(value); } @Override public void setExpectedValue(AnomalyIncident incident, Double value) { - incident.setExpectedValue(value); + incident.setExpectedValueOfRootNode(value); } @Override @@ -135,8 +136,8 @@ public DimensionKey getRootDimensionKey() { * * @return The value. */ - public Double getValue() { - return this.value; + public Double getValueOfRootNode() { + return this.valueOfRootNode; } /** @@ -144,8 +145,8 @@ public Double getValue() { * * @return The expected value. */ - public Double getExpectedValue() { - return this.expectedValue; + public Double getExpectedValueOfRootNode() { + return this.expectedValueOfRootNode; } /** @@ -204,12 +205,12 @@ void setRootDimensionKey(DimensionKey rootDimensionKey) { this.rootDimensionKey = rootDimensionKey; } - void setValue(Double value) { - this.value = value; + void setValueOfRootNode(Double valueOfRootNode) { + this.valueOfRootNode = valueOfRootNode; } - void setExpectedValue(Double value) { - this.expectedValue = value; + void setExpectedValueOfRootNode(Double value) { + this.expectedValueOfRootNode = value; } void setSeverity(AnomalySeverity severity) { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureBlobDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureBlobDataFeedSource.java deleted file mode 100644 index 76c472d6f8dc..000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureBlobDataFeedSource.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -import com.azure.core.annotation.Immutable; - -/** - * The AzureBlobDataFeedSource model. - */ -@Immutable -public final class AzureBlobDataFeedSource extends DataFeedSource { - /* - * Azure Blob connection string - */ - private final String connectionString; - - /* - * Container - */ - private final String container; - - /* - * Blob Template - */ - private final String blobTemplate; - - /** - * Create a AzureBlobDataFeedSource instance. - * - * @param connectionString the Azure Blob connection string - * @param container the container name - * @param blobTemplate the blob template name - */ - public AzureBlobDataFeedSource(final String connectionString, final String container, final String blobTemplate) { - this.connectionString = connectionString; - this.container = container; - this.blobTemplate = blobTemplate; - } - - /** - * Get the Azure Blob connection string. - * - * @return the connectionString value. - */ - public String getConnectionString() { - return this.connectionString; - } - - - /** - * Get the container name. - * - * @return the container value. - */ - public String getContainer() { - return this.container; - } - - - /** - * Get the blob template name. - * - * @return the blobTemplate value. - */ - public String getBlobTemplate() { - return this.blobTemplate; - } - - -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataExplorerDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataExplorerDataFeedSource.java deleted file mode 100644 index e2f5336b0116..000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataExplorerDataFeedSource.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -import com.azure.core.annotation.Immutable; - -/** - * The AzureDataExplorerDataFeedSource model. - */ -@Immutable -public final class AzureDataExplorerDataFeedSource extends DataFeedSource { - /* - * Database connection string - */ - private final String connectionString; - - /* - * Query script - */ - private final String query; - - /** - * Create a AzureDataExplorerDataFeedSource instance. - * - * @param connectionString the database connection string. - * @param query the query script. - */ - public AzureDataExplorerDataFeedSource(final String connectionString, final String query) { - this.connectionString = connectionString; - this.query = query; - } - - /** - * Get the connectionString property: Database connection string. - * - * @return the connectionString value. - */ - public String getConnectionString() { - return this.connectionString; - } - - - /** - * Get the query property: Query script. - * - * @return the query value. - */ - public String getQuery() { - return this.query; - } - -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataLakeStorageGen2DataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataLakeStorageGen2DataFeedSource.java deleted file mode 100644 index abcc378b11ff..000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureDataLakeStorageGen2DataFeedSource.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -import com.azure.core.annotation.Immutable; - -/** - * The AzureDataLakeStorageGen2DataFeedSource model. - */ -@Immutable -public final class AzureDataLakeStorageGen2DataFeedSource extends DataFeedSource { - /* - * Account name - */ - private final String accountName; - - /* - * Account key - */ - private final String accountKey; - - /* - * File system name (Container) - */ - private final String fileSystemName; - - /* - * Directory template - */ - private final String directoryTemplate; - - /* - * File template - */ - private final String fileTemplate; - - /** - * Constructs a AzureDataLakeStorageGen2DataFeedSource object. - * - * @param accountName the name of the storage account. - * @param accountKey the key of the storage account. - * @param fileSystemName the file system name. - * @param directoryTemplate the directoty template of the storage account. - * @param fileTemplate the file template. - */ - public AzureDataLakeStorageGen2DataFeedSource(final String accountName, final String accountKey, - final String fileSystemName, final String directoryTemplate, final String fileTemplate) { - this.accountName = accountName; - this.accountKey = accountKey; - this.fileSystemName = fileSystemName; - this.directoryTemplate = directoryTemplate; - this.fileTemplate = fileTemplate; - } - - /** - * Get the the account name for the AzureDataLakeStorageGen2DataFeedSource. - * - * @return the accountName value. - */ - public String getAccountName() { - return this.accountName; - } - - /** - * Get the account key value for the AzureDataLakeStorageGen2DataFeedSource. - * - * @return the accountKey value. - */ - public String getAccountKey() { - return this.accountKey; - } - - /** - * Get the file system name or the container name. - * - * @return the fileSystemName value. - */ - public String getFileSystemName() { - return this.fileSystemName; - } - - /** - * Get the directory template. - * - * @return the directoryTemplate value. - */ - public String getDirectoryTemplate() { - return this.directoryTemplate; - } - - /** - * Get the file template. - * - * @return the fileTemplate value. - */ - public String getFileTemplate() { - return this.fileTemplate; - } -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureLogAnalyticsDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureLogAnalyticsDataFeedSource.java deleted file mode 100644 index db23a800fd09..000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/AzureLogAnalyticsDataFeedSource.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.ai.metricsadvisor.models; - -import com.azure.core.annotation.Immutable; - -/** The AzureLogAnalyticsDataFeedSource model. */ -@Immutable -public final class AzureLogAnalyticsDataFeedSource extends DataFeedSource { - /* - * The tenant id of service principal that have access to this Log - * Analytics - */ - private final String tenantId; - - /* - * The client id of service principal that have access to this Log - * Analytics - */ - private final String clientId; - - /* - * The client secret of service principal that have access to this Log - * Analytics - */ - private final String clientSecret; - - /* - * The workspace id of this Log Analytics - */ - private final String workspaceId; - - /* - * The KQL (Kusto Query Language) query to fetch data from this Log - * Analytics - */ - private final String query; - - /** - * Create a AzureLogAnalyticsDataFeedSource instance. - * - * @param tenantId The tenant id of service principal that have access to this Log Analytics. - * @param clientId The client id of service principal that have access to this Log Analytics. - * @param clientSecret The client secret of service principal that have access to this Log Analytics. - * @param workspaceId the query script. - * @param query the KQL (Kusto Query Language) query to fetch data from this Log - * Analytics. - */ - public AzureLogAnalyticsDataFeedSource(String tenantId, String clientId, String clientSecret, - String workspaceId, String query) { - this.tenantId = tenantId; - this.clientId = clientId; - this.clientSecret = clientSecret; - this.workspaceId = workspaceId; - this.query = query; - } - - /** - * Get the tenantId property: The tenant id of service principal that have access to this Log Analytics. - * - * @return the tenantId value. - */ - public String getTenantId() { - return this.tenantId; - } - - /** - * Get the clientId property: The client id of service principal that have access to this Log Analytics. - * - * @return the clientId value. - */ - public String getClientId() { - return this.clientId; - } - - /** - * Get the clientSecret property: The client secret of service principal that have access to this Log Analytics. - * - * @return the clientSecret value. - */ - public String getClientSecret() { - return this.clientSecret; - } - - /** - * Get the workspaceId property: The workspace id of this Log Analytics. - * - * @return the workspaceId value. - */ - public String getWorkspaceId() { - return this.workspaceId; - } - - /** - * Get the query property: The KQL (Kusto Query Language) query to fetch data from this Log Analytics. - * - * @return the query value. - */ - public String getQuery() { - return this.query; - } -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/BoundaryDirection.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/BoundaryDirection.java deleted file mode 100644 index 4618aecd3662..000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/BoundaryDirection.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -/** - * Describes the direction of boundary used in anomaly boundary conditions. - */ -public enum BoundaryDirection { - /** - * Defines the lower boundary in a boundary condition. - */ - LOWER, - /** - * Defines the upper boundary in a boundary condition. - */ - UPPER, - /** - * Defines both lower and upper boundary in a boundary condition. - */ - BOTH -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedRollupType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedRollupType.java deleted file mode 100644 index 0dc56b2ecedc..000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedRollupType.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -/** - * Defines values for LeaseStateType. - */ -public enum DataFeedRollupType { - - /** - * Enum value NoRollup. - */ - NO_ROLLUP("NoRollup"), - - /** - * Enum value NeedRollup. - */ - AUTO_ROLLUP("NeedRollup"), - - /** - * Enum value AlreadyRollup. - */ - ALREADY_ROLLUP("AlreadyRollup"); - - /** - /** - * The actual serialized value for a DataFeedRollupType instance. - */ - private final String value; - - DataFeedRollupType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a DataFeedRollupType instance. - * - * @param value the serialized value to parse. - * @return the parsed DataFeedRollupType object, or null if unable to parse. - */ - public static DataFeedRollupType fromString(String value) { - DataFeedRollupType[] items = DataFeedRollupType.values(); - for (DataFeedRollupType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSource.java deleted file mode 100644 index f8a542a5ad9e..000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSource.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -/** The DataFeedSource model. */ -public abstract class DataFeedSource { - // No common properties, used only as discriminator type. -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSourceType.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSourceType.java deleted file mode 100644 index c26e0981ee99..000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataFeedSourceType.java +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -/** - * Defines values for DataFeedSourceType. - */ -public enum DataFeedSourceType { - - /** - * Enum value AzureApplicationInsights. - */ - AZURE_APP_INSIGHTS("AzureApplicationInsights"), - - /** - * Enum value AzureBlob. - */ - AZURE_BLOB("AzureBlob"), - - /** - * Enum value AzureDataExplorer. - */ - AZURE_DATA_EXPLORER("AzureDataExplorer"), - - /** - * Enum value AzureEventHubs. - */ - AZURE_EVENT_HUBS("AzureEventHubs"), - - /** - * Enum value AzureTable. - */ - AZURE_TABLE("AzureTable"), - - /** - * Enum value HttpRequest. - */ - HTTP_REQUEST("HttpRequest"), - - /** - * Enum value InfluxDB. - */ - INFLUX_DB("InfluxDB"), - - /** - * Enum value MongoDB. - */ - MONGO_DB("MongoDB"), - - /** - * Enum value MySql. - */ - MYSQL_DB("MySql"), - - /** - * Enum value PostgreSql. - */ - POSTGRE_SQL_DB("PostgreSql"), - - /** - * Enum value SqlServer. - */ - SQL_SERVER_DB("SqlServer"), - - /** - * Enum value AzureCosmosDB. - */ - AZURE_COSMOS_DB("AzureCosmosDB"), - - /** - * Enum value SqlServer. - */ - ELASTIC_SEARCH("Elasticsearch"), - - /** - * Enum value AzureDataLakeStorageGen2. - */ - AZURE_DATA_LAKE_STORAGE_GEN2("AzureDataLakeStorageGen2"), - - /** - * Enum value AzureLogAnalytics. - */ - AZURE_LOG_ANALYTICS("AzureLogAnalytics"); - - /** - /** - * The actual serialized value for a DataFeedSourceType instance. - */ - private final String value; - - DataFeedSourceType(final String value) { - this.value = value; - } - - /** - * Parses a serialized value to a DataFeedSourceType instance. - * - * @param value the serialized value to parse. - * @return the parsed DataFeedSourceType object, or null if unable to parse. - */ - public static DataFeedSourceType fromString(final String value) { - final DataFeedSourceType[] items = DataFeedSourceType.values(); - for (final DataFeedSourceType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataPointAnomaly.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataPointAnomaly.java index 59d061aa8f28..a45bebf21364 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataPointAnomaly.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DataPointAnomaly.java @@ -3,6 +3,7 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.implementation.util.AnomalyHelper; import java.time.OffsetDateTime; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DimensionKey.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DimensionKey.java index 2d3626e17365..29ede8fc8fee 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DimensionKey.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/DimensionKey.java @@ -3,6 +3,8 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; + import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -67,6 +69,16 @@ public DimensionKey put(String dimensionName, String dimensionValue) { return this; } + /** + * Gets dimension value for the given {@code dimensionName}. + * + * @param dimensionName The dimension name. + * @return The dimension value if exists, {@code null} otherwise. + */ + public String get(String dimensionName) { + return this.dimensions.get(dimensionName); + } + /** * Removes a dimension name-value from the key. * diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ElasticsearchDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ElasticsearchDataFeedSource.java deleted file mode 100644 index 5dc57cda515a..000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ElasticsearchDataFeedSource.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -import com.azure.core.annotation.Immutable; - -/** - * The ElasticsearchDataFeedSource model. - */ -@Immutable -public final class ElasticsearchDataFeedSource extends DataFeedSource { - /* - * Host - */ - private final String host; - - /* - * Port - */ - private final String port; - - /* - * Authorization header - */ - private final String authHeader; - - /* - * Query - */ - private final String query; - - /** - * Construct a ElasticsearchDataFeedSource instance. - * - * @param host the host for data source. - * @param port the port data source. - * @param authHeader the auth header for data source. - * @param query the query. - */ - public ElasticsearchDataFeedSource(final String host, final String port, final String authHeader, - final String query) { - this.host = host; - this.port = port; - this.authHeader = authHeader; - this.query = query; - } - - /** - * Get the host value for the Elasticsearch. - * - * @return the host value. - */ - public String getHost() { - return this.host; - } - - /** - * Get the port for the Elasticsearch. - * - * @return the port value. - */ - public String getPort() { - return this.port; - } - - /** - * Get the authorization header. - * - * @return the authHeader value. - */ - public String getAuthHeader() { - return this.authHeader; - } - - /** - * Get the query value. - * - * @return the query value. - */ - public String getQuery() { - return this.query; - } -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/HttpRequestDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/HttpRequestDataFeedSource.java deleted file mode 100644 index 5a39d412497b..000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/HttpRequestDataFeedSource.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -import com.azure.core.annotation.Fluent; - -/** - * The HttpRequestDataFeedSource model. - */ -@Fluent -public final class HttpRequestDataFeedSource extends DataFeedSource { - - /* - * HTTP URL - */ - private final String url; - - /* - * HTTP header - */ - private String httpHeader; - - /* - * HTTP method - */ - private final String httpMethod; - - /* - * HTTP request body - */ - private String payload; - - /** - * Create a HttpRequestDataFeedSource instance. - * @param url the HTTP url. - * @param httpMethod the HTTP method. - */ - public HttpRequestDataFeedSource(final String url, final String httpMethod) { - this.url = url; - this.httpMethod = httpMethod; - } - - /** - * Get the url property: HTTP URL. - * - * @return the url value. - */ - public String getUrl() { - return this.url; - } - - /** - * Get the httpHeader property: HTTP header. - * - * @return the httpHeader value. - */ - public String getHttpHeader() { - return this.httpHeader; - } - - /** - * Get the httpMethod property: HTTP method. - * - * @return the httpMethod value. - */ - public String getHttpMethod() { - return this.httpMethod; - } - - /** - * Get the payload property: HTTP request body. - * - * @return the payload value. - */ - public String getPayload() { - return this.payload; - } - - /** - * Set the httpHeader property: HTTP header. - * - * @param httpHeader the httpHeader value to set. - * @return the HttpRequestDataFeedSource object itself. - */ - public HttpRequestDataFeedSource setHttpHeader(String httpHeader) { - this.httpHeader = httpHeader; - return this; - } - - /** - * Set the payload property: HTTP reuqest body. - * - * @param payload the payload value to set. - * @return the HttpRequestDataFeedSource object itself. - */ - public HttpRequestDataFeedSource setPayload(String payload) { - this.payload = payload; - return this; - } -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/InfluxDBDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/InfluxDbDataFeedSource.java similarity index 69% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/InfluxDBDataFeedSource.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/InfluxDbDataFeedSource.java index 6692eca9ff5a..d2416ce6af5f 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/InfluxDBDataFeedSource.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/InfluxDbDataFeedSource.java @@ -3,13 +3,15 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSource; +import com.azure.ai.metricsadvisor.implementation.util.InfluxDbDataFeedSourceAccessor; import com.azure.core.annotation.Immutable; /** - * The InfluxDBDataFeedSource model. + * The InfluxDbDataFeedSource model. */ @Immutable -public final class InfluxDBDataFeedSource extends DataFeedSource { +public final class InfluxDbDataFeedSource extends DataFeedSource { /* * InfluxDB connection string */ @@ -35,8 +37,18 @@ public final class InfluxDBDataFeedSource extends DataFeedSource { */ private final String query; + static { + InfluxDbDataFeedSourceAccessor.setAccessor( + new InfluxDbDataFeedSourceAccessor.Accessor() { + @Override + public String getPassword(InfluxDbDataFeedSource feedSource) { + return feedSource.getPassword(); + } + }); + } + /** - * Create a InfluxDBDataFeedSource instance. + * Create a InfluxDbDataFeedSource instance. * * @param connectionString InfluxDB connection string * @param database the database name. @@ -44,9 +56,9 @@ public final class InfluxDBDataFeedSource extends DataFeedSource { * @param password the database access password. * @param query the query value. */ - public InfluxDBDataFeedSource(final String connectionString, final String database, final String userName, - final String password, - final String query) { + public InfluxDbDataFeedSource(final String connectionString, final String database, final String userName, + final String password, + final String query) { this.connectionString = connectionString; this.database = database; this.userName = userName; @@ -82,17 +94,6 @@ public String getUserName() { return this.userName; } - - /** - * Get the password property: Database access password. - * - * @return the password value. - */ - public String getPassword() { - return this.password; - } - - /** * Get the query property: Query script. * @@ -102,5 +103,7 @@ public String getQuery() { return this.query; } - + private String getPassword() { + return this.password; + } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAlertOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAlertOptions.java index 048e2cf31aff..388adbd4147a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAlertOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAlertOptions.java @@ -3,9 +3,12 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + /** * Describes the additional parameters for the API to list the alerts triggered. */ +@Fluent public final class ListAlertOptions { private Integer maxPageSize; private Integer skip; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesAlertedOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesAlertedOptions.java index 801b62d27d2b..0d10486e2c31 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesAlertedOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesAlertedOptions.java @@ -3,9 +3,12 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + /** * Describes the additional parameters for the API to list anomalies in an alert. */ +@Fluent public final class ListAnomaliesAlertedOptions { private Integer maxPageSize; private Integer skip; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedFilter.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedFilter.java index 0222ea5c723e..f8365a306b59 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedFilter.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedFilter.java @@ -3,11 +3,15 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; +import com.azure.core.annotation.Fluent; + import java.util.List; /** * Describes additional conditions to filter the anomalies while listing. */ +@Fluent public final class ListAnomaliesDetectedFilter { private AnomalySeverity minSeverity; private AnomalySeverity maxSeverity; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedOptions.java index a5d7ae2339ff..d5d59223a64d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomaliesDetectedOptions.java @@ -3,9 +3,12 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + /** * Describes the additional parameters for the API to list anomalies detected. */ +@Fluent public final class ListAnomaliesDetectedOptions { private Integer maxPageSize; private Integer skip; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyDimensionValuesOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyDimensionValuesOptions.java index b6ad61d7b907..e2c73b5bcd84 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyDimensionValuesOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListAnomalyDimensionValuesOptions.java @@ -3,9 +3,12 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + /** * Describes the additional parameters for the API to list values of a dimension that have anomalies. */ +@Fluent public final class ListAnomalyDimensionValuesOptions { private Integer maxPageSize; private Integer skip; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsAlertedOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsAlertedOptions.java index f41940700838..c6b43559b3c9 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsAlertedOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsAlertedOptions.java @@ -3,9 +3,12 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + /** * Describes the additional parameters for the API to list incidents in an alert. */ +@Fluent public final class ListIncidentsAlertedOptions { private Integer maxPageSize; private Integer skip; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsDetectedOptions.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsDetectedOptions.java index 122f74b98cb2..affa1d65aa6d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsDetectedOptions.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ListIncidentsDetectedOptions.java @@ -3,11 +3,14 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + import java.util.List; /** * Describes the additional parameters for the API to list incidents detected. */ +@Fluent public final class ListIncidentsDetectedOptions { private Integer maxPageSize; private List dimensionsToFilter; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyFeedback.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyFeedback.java index 46162f1e7adb..d6d9deebc4f2 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyFeedback.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricAnomalyFeedback.java @@ -3,13 +3,14 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; import com.azure.ai.metricsadvisor.implementation.util.MetricAnomalyFeedbackHelper; import com.azure.core.annotation.Fluent; import java.time.OffsetDateTime; /** - * The MetricAnomalyFeedback class. + * A feedback to indicate a set of data points as Anomaly or NotAnomaly. */ @Fluent public final class MetricAnomalyFeedback extends MetricFeedback { @@ -94,6 +95,19 @@ public MetricAnomalyFeedback setDetectionConfigurationId( return this; } + /** + * Set the series keys value for the feedback. + * + * @param dimensionFilter the dimensionFilter value to set. + * + * @return the MetricAnomalyFeedback object itself. + */ + @Override + public MetricAnomalyFeedback setDimensionFilter(final DimensionKey dimensionFilter) { + super.setDimensionFilter(dimensionFilter); + return this; + } + /** * Get the corresponding anomaly detection configuration Id of this * feedback. diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricChangePointFeedback.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricChangePointFeedback.java index b5faf24abf2c..1bac75b32a03 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricChangePointFeedback.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricChangePointFeedback.java @@ -3,14 +3,15 @@ package com.azure.ai.metricsadvisor.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import java.time.OffsetDateTime; /** - * The MetricChangePointFeedback class. + * The Feedback that allows the user to mark the exact change point when the time series has + * a trend change. This helps the anomaly detector in future analysis. */ -@Immutable +@Fluent public final class MetricChangePointFeedback extends MetricFeedback { private final OffsetDateTime startTime; private final OffsetDateTime endTime; @@ -32,6 +33,19 @@ public MetricChangePointFeedback(OffsetDateTime startTime, this.changePointValue = changePointValue; } + /** + * Set the series keys value for the feedback. + * + * @param dimensionFilter the dimensionFilter value to set. + * + * @return the MetricChangePointFeedback object itself. + */ + @Override + public MetricChangePointFeedback setDimensionFilter(final DimensionKey dimensionFilter) { + super.setDimensionFilter(dimensionFilter); + return this; + } + /** * Get the change point feedback value. * diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricCommentFeedback.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricCommentFeedback.java index bc361dba6c2a..cddb9d398f36 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricCommentFeedback.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricCommentFeedback.java @@ -3,14 +3,15 @@ package com.azure.ai.metricsadvisor.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import java.time.OffsetDateTime; /** - * The MetricCommentFeedback class. + * The feedback that allows adding comments in plain text providing more + * context about the data. */ -@Immutable +@Fluent public final class MetricCommentFeedback extends MetricFeedback { private final OffsetDateTime startTime; private final OffsetDateTime endTime; @@ -32,6 +33,19 @@ public MetricCommentFeedback(OffsetDateTime startTime, this.comment = comment; } + /** + * Set the series keys value for the feedback. + * + * @param dimensionFilter the dimensionFilter value to set. + * + * @return the MetricCommentFeedback object itself. + */ + @Override + public MetricCommentFeedback setDimensionFilter(final DimensionKey dimensionFilter) { + super.setDimensionFilter(dimensionFilter); + return this; + } + /** * Get the comment value. * diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricFeedback.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricFeedback.java index 7e2a8dee292f..653fa51ba12b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricFeedback.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricFeedback.java @@ -4,12 +4,22 @@ package com.azure.ai.metricsadvisor.models; import com.azure.ai.metricsadvisor.implementation.util.MetricFeedbackHelper; +import com.azure.core.annotation.Fluent; import java.time.OffsetDateTime; /** - * The abstract MetricFeedback class. + * Users can submit various feedback for the anomaly detection that the service + * performed. The {@link MetricFeedback} represents the base type for different + * feedback. The feedback will be applied for the future anomaly detection + * processing of the same time series. + * + * @see MetricAnomalyFeedback + * @see MetricChangePointFeedback + * @see MetricCommentFeedback + * @see MetricPeriodFeedback */ +@Fluent public abstract class MetricFeedback { private String id; private String metricId; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricPeriodFeedback.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricPeriodFeedback.java index 866d10bea00e..9eb6572880dc 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricPeriodFeedback.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricPeriodFeedback.java @@ -3,12 +3,13 @@ package com.azure.ai.metricsadvisor.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; /** - * The MetricPeriodFeedback model. + * The Feedback that helps the service in estimating period(seasonality) + * of the time series. */ -@Immutable +@Fluent public final class MetricPeriodFeedback extends MetricFeedback { private final PeriodType periodType; private final int periodValue; @@ -25,6 +26,19 @@ public MetricPeriodFeedback(PeriodType periodType, this.periodValue = periodValue; } + /** + * Set the series keys value for the feedback. + * + * @param dimensionFilter the dimensionFilter value to set. + * + * @return the MetricPeriodFeedback object itself. + */ + @Override + public MetricPeriodFeedback setDimensionFilter(final DimensionKey dimensionFilter) { + super.setDimensionFilter(dimensionFilter); + return this; + } + /** * Get the type of setting period. * diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ErrorCode.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorError.java similarity index 80% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ErrorCode.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorError.java index e91792d487e5..1c3c134a9610 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ErrorCode.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorError.java @@ -7,9 +7,9 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The ErrorCode model. */ +/** The MetricsAdvisorError model. */ @Fluent -public final class ErrorCode { +public final class MetricsAdvisorError { /* * The message property. */ @@ -35,9 +35,9 @@ public String getMessage() { * Set the message property: The message property. * * @param message the message value to set. - * @return the ErrorCode object itself. + * @return the MetricsAdvisorError object itself. */ - public ErrorCode setMessage(String message) { + public MetricsAdvisorError setMessage(String message) { this.message = message; return this; } @@ -55,9 +55,9 @@ public String getCode() { * Set the code property: The code property. * * @param code the code value to set. - * @return the ErrorCode object itself. + * @return the MetricsAdvisorError object itself. */ - public ErrorCode setCode(String code) { + public MetricsAdvisorError setCode(String code) { this.code = code; return this; } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeyCredential.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeyCredential.java index 11560091de54..37a5e3c2f4a6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeyCredential.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeyCredential.java @@ -3,12 +3,15 @@ package com.azure.ai.metricsadvisor.models; +import com.azure.core.annotation.Fluent; + /** * The MetricsAdvisorKeyCredential class. */ +@Fluent public final class MetricsAdvisorKeyCredential { - private volatile String subscriptionKey; - private volatile String apiKey; + private volatile MetricsAdvisorKeys keys; + private final Object updateLock = new Object(); /** * Creates a MetricsAdvisorKeyCredential credential that authorizes request with the given keys. @@ -17,54 +20,33 @@ public final class MetricsAdvisorKeyCredential { * @param apiKey the api key used to authorize requests */ public MetricsAdvisorKeyCredential(String subscriptionKey, String apiKey) { - this.subscriptionKey = subscriptionKey; - this.apiKey = apiKey; - } - - /** - * Retrieves the subscription key associated to this credential. - * - * @return The subscription key being used to authorize requests. - */ - public String getSubscriptionKey() { - return this.subscriptionKey; + this.keys = new MetricsAdvisorKeys(subscriptionKey, apiKey); } /** - * Retrieves the api key associated to this credential. + * Retrieves the {@link MetricsAdvisorKeys} containing the subscription key and api key + * associated with this credential. * - * @return The api key being used to authorize requests. + * @return The {@link MetricsAdvisorKeys} containing the subscription key and api key. */ - public String getApiKey() { - return this.apiKey; + public MetricsAdvisorKeys getKeys() { + return this.keys; } /** - * Rotates the subscription key associated to this credential. + * Update the subscription and api key associated to this credential. *

- * This is intended to be used when you've regenerated your subscription key and want to - * update long lived clients. + * This is intended to be used when you've regenerated your subscription key and + * api key want to update long lived clients. *

* @param subscriptionKey The new subscription key to associated with this credential. - * @return The updated {@code MetricsAdvisorKeyCredential} object. - */ - public MetricsAdvisorKeyCredential updateSubscriptionKey(String subscriptionKey) { - this.subscriptionKey = subscriptionKey; - return this; - } - - /** - * Rotates the api key associated to this credential. - *

- * This is intended to be used when you've regenerated your api key and want to - * update long lived clients. - *

- * * @param apiKey The new api key to associated with this credential. * @return The updated {@code MetricsAdvisorKeyCredential} object. */ - public MetricsAdvisorKeyCredential updateApiKey(String apiKey) { - this.apiKey = apiKey; + public MetricsAdvisorKeyCredential updateKey(String subscriptionKey, String apiKey) { + synchronized (this.updateLock) { + this.keys = new MetricsAdvisorKeys(subscriptionKey, apiKey); + } return this; } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeys.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeys.java new file mode 100644 index 000000000000..933456534681 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorKeys.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.models; + +import com.azure.core.annotation.Immutable; + +/** + * Represents a credential bag containing the subscription key and api key. + * + * @see MetricsAdvisorKeyCredential + */ +@Immutable +public final class MetricsAdvisorKeys { + private final String subscriptionKey; + private final String apiKey; + + MetricsAdvisorKeys(String subscriptionKey, String apiKey) { + this.subscriptionKey = subscriptionKey; + this.apiKey = apiKey; + } + + /** + * Retrieves the subscription key. + * + * @return The subscription key. + */ + public String getSubscriptionKey() { + return this.subscriptionKey; + } + + /** + * Retrieves the api key. + * + * @return The api key. + */ + public String getApiKey() { + return this.apiKey; + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ErrorCodeException.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorResponseException.java similarity index 61% rename from sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ErrorCodeException.java rename to sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorResponseException.java index e8aed79f5cc8..d778fb2f395d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/ErrorCodeException.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/MetricsAdvisorResponseException.java @@ -8,30 +8,30 @@ import com.azure.core.http.HttpResponse; /** Exception thrown for an invalid response with ErrorCode information. */ -public final class ErrorCodeException extends HttpResponseException { +public final class MetricsAdvisorResponseException extends HttpResponseException { /** - * Initializes a new instance of the ErrorCodeException class. + * Initializes a new instance of the MetricsAdvisorResponseException class. * * @param message the exception message or the response content if a message is not available. * @param response the HTTP response. */ - public ErrorCodeException(String message, HttpResponse response) { + public MetricsAdvisorResponseException(String message, HttpResponse response) { super(message, response); } /** - * Initializes a new instance of the ErrorCodeException class. + * Initializes a new instance of the MetricsAdvisorResponseException class. * * @param message the exception message or the response content if a message is not available. * @param response the HTTP response. * @param value the deserialized response value. */ - public ErrorCodeException(String message, HttpResponse response, ErrorCode value) { + public MetricsAdvisorResponseException(String message, HttpResponse response, MetricsAdvisorError value) { super(message, response, value); } @Override - public ErrorCode getValue() { - return (ErrorCode) super.getValue(); + public MetricsAdvisorError getValue() { + return (MetricsAdvisorError) super.getValue(); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SQLServerDataFeedSource.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SQLServerDataFeedSource.java deleted file mode 100644 index cd08acb7f841..000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SQLServerDataFeedSource.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -import com.azure.core.annotation.Immutable; - -/** - * The SQLServerDataFeedSource model. - */ -@Immutable -public final class SQLServerDataFeedSource extends DataFeedSource { - /* - * Database connection string - */ - private final String connectionString; - - /* - * Query script - */ - private final String query; - - /** - * Create a SQLServerDataFeedSource instance - * - * @param connectionString the database connection string. - * @param query the query value. - */ - public SQLServerDataFeedSource(final String connectionString, final String query) { - this.connectionString = connectionString; - this.query = query; - } - - /** - * Get the connectionString property: Database connection string. - * - * @return the connectionString value. - */ - public String getConnectionString() { - return this.connectionString; - } - - - /** - * Get the query property: Query script. - * - * @return the query value. - */ - public String getQuery() { - return this.query; - } - - -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SingleBoundaryDirection.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SingleBoundaryDirection.java deleted file mode 100644 index f82503553f8a..000000000000 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/models/SingleBoundaryDirection.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.ai.metricsadvisor.models; - -/** - * Defines values for SingleBoundaryDirection. - */ -public enum SingleBoundaryDirection { - /** - * Enum value lower boundary. - */ - LOWER, - /** - * Enum value upper boundary. - */ - UPPER -} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/module-info.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/module-info.java index 1257368814eb..1c53ff113d93 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/module-info.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/module-info.java @@ -7,8 +7,10 @@ exports com.azure.ai.metricsadvisor; exports com.azure.ai.metricsadvisor.models; exports com.azure.ai.metricsadvisor.administration; + exports com.azure.ai.metricsadvisor.administration.models; opens com.azure.ai.metricsadvisor.implementation to com.fasterxml.jackson.databind; + opens com.azure.ai.metricsadvisor.administration.models to com.fasterxml.jackson.databind; opens com.azure.ai.metricsadvisor.models to com.fasterxml.jackson.databind; opens com.azure.ai.metricsadvisor.implementation.models to com.fasterxml.jackson.databind, com.azure.core; } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesAsyncSample.java index c7643650b84b..142d08a3ff77 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesAsyncSample.java @@ -30,8 +30,8 @@ public static void main(String[] args) { final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-12T00:00:00Z"); PagedFlux enrichedDataFlux - = advisorAsyncClient.listMetricEnrichedSeriesData(Arrays.asList(seriesKey), - detectionConfigurationId, + = advisorAsyncClient.listMetricEnrichedSeriesData(detectionConfigurationId, + Arrays.asList(seriesKey), startTime, endTime); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesSample.java index b13a51554f18..aef0f8859f73 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListEnrichedSeriesSample.java @@ -30,8 +30,8 @@ public static void main(String[] args) { final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-12T00:00:00Z"); PagedIterable enrichedDataIterable - = advisorClient.listMetricEnrichedSeriesData(Arrays.asList(seriesKey), - detectionConfigurationId, + = advisorClient.listMetricEnrichedSeriesData(detectionConfigurationId, + Arrays.asList(seriesKey), startTime, endTime); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedAsyncSample.java index 90fa4d81dde0..2e12585da3d9 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedAsyncSample.java @@ -24,7 +24,7 @@ public static void main(String[] args) { final ListIncidentsAlertedOptions options = new ListIncidentsAlertedOptions() .setMaxPageSize(10); - PagedFlux incidentsPagedFlux = advisorAsyncClient.listIncidentsForAlert( + PagedFlux incidentsPagedFlux = advisorAsyncClient.listIncidents( alertConfigurationId, alertId, options); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedSample.java index 250e37caf1c9..99b348db6018 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsAlertedSample.java @@ -7,6 +7,7 @@ import com.azure.ai.metricsadvisor.models.ListIncidentsAlertedOptions; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; /** * Sample demonstrates how to list incidents in an alert. @@ -24,10 +25,11 @@ public static void main(String[] args) { final ListIncidentsAlertedOptions options = new ListIncidentsAlertedOptions() .setMaxPageSize(10); - PagedIterable incidentsIterable = advisorClient.listIncidentsForAlert( + PagedIterable incidentsIterable = advisorClient.listIncidents( alertConfigurationId, alertId, - options); + options, + Context.NONE); for (AnomalyIncident anomalyIncident : incidentsIterable) { System.out.printf("DataFeedMetric Id: %s%n", anomalyIncident.getMetricId()); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedAsyncSample.java index f8f2a86bb776..3c78bb3b5fc6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedAsyncSample.java @@ -28,7 +28,7 @@ public static void main(String[] args) { .setMaxPageSize(1000); PagedFlux incidentsFlux - = advisorAsyncClient.listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime, options); + = advisorAsyncClient.listIncidents(detectionConfigurationId, startTime, endTime, options); incidentsFlux.doOnNext(incident -> { System.out.printf("Data Feed Metric Id: %s%n", incident.getMetricId()); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedSample.java index 6a2f001e81b0..7103f8469bac 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListIncidentsDetectedSample.java @@ -29,7 +29,7 @@ public static void main(String[] args) { .setMaxPageSize(1000); PagedIterable incidentsIterable - = advisorClient.listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime, options, + = advisorClient.listIncidents(detectionConfigurationId, startTime, endTime, options, Context.NONE); for (AnomalyIncident anomalyIncident : incidentsIterable) { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsAsyncSample.java index 51a808caad09..534e09c52ced 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsAsyncSample.java @@ -21,7 +21,7 @@ public static void main(String[] args) { final String alertId = "1746b031c00"; final ListAnomaliesAlertedOptions options = new ListAnomaliesAlertedOptions() .setMaxPageSize(10); - advisorAsyncClient.listAnomaliesForAlert( + advisorAsyncClient.listAnomalies( alertConfigurationId, alertId, options) diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsSample.java index 257a5ed2a5cd..d581b3755cd9 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForAlertsSample.java @@ -25,7 +25,7 @@ public static void main(String[] args) { final ListAnomaliesAlertedOptions options = new ListAnomaliesAlertedOptions() .setMaxPageSize(10); - PagedIterable anomaliesIterable = advisorClient.listAnomaliesForAlert( + PagedIterable anomaliesIterable = advisorClient.listAnomalies( alertConfigurationId, alertId, options, diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigAsyncSample.java index fb8e5678af54..a54d66f3c502 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigAsyncSample.java @@ -3,7 +3,7 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedFilter; import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedOptions; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; @@ -29,7 +29,7 @@ public static void main(String[] args) { final ListAnomaliesDetectedOptions options = new ListAnomaliesDetectedOptions() .setMaxPageSize(10) .setFilter(filter); - advisorAsyncClient.listAnomaliesForDetectionConfig(detectionConfigurationId, + advisorAsyncClient.listAnomalies(detectionConfigurationId, startTime, endTime, options) .doOnNext(anomaly -> { System.out.printf("DataPoint Anomaly Severity: %s%n", anomaly.getSeverity()); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigSample.java index 09a73a9fa2f6..d7a3cdf48d1f 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ListsAnomaliesForDetectionConfigSample.java @@ -7,7 +7,7 @@ import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedFilter; import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedOptions; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.core.http.rest.PagedIterable; import java.time.OffsetDateTime; @@ -32,7 +32,7 @@ public static void main(String[] args) { .setMaxPageSize(10) .setFilter(filter); PagedIterable anomaliesIterable - = advisorClient.listAnomaliesForDetectionConfig(detectionConfigurationId, + = advisorClient.listAnomalies(detectionConfigurationId, startTime, endTime); for (DataPointAnomaly dataPointAnomaly : anomaliesIterable) { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricFeedbackAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricFeedbackAsyncSample.java index b931dc58d331..be85df753317 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricFeedbackAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricFeedbackAsyncSample.java @@ -39,7 +39,7 @@ public static void main(String[] args) { System.out.printf("Creating Metric Feedback%n"); final Mono createdFeedbackMono - = advisorAsyncClient.addFeeddback(metricId, metricChangePointFeedback); + = advisorAsyncClient.addFeedback(metricId, metricChangePointFeedback); createdFeedbackMono .doOnSubscribe(__ -> diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClientJavaDocCodeSnippets.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClientJavaDocCodeSnippets.java index 04a65ab24e84..4dfd96bf9e7b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClientJavaDocCodeSnippets.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorAsyncClientJavaDocCodeSnippets.java @@ -27,7 +27,7 @@ import com.azure.ai.metricsadvisor.models.MetricFeedback; import com.azure.ai.metricsadvisor.models.MetricPeriodFeedback; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.rest.PagedFlux; @@ -85,7 +85,23 @@ public void createMetricAdvisorAsyncClientWithPipeline() { * Code snippet for * {@link MetricsAdvisorAsyncClient#listMetricSeriesDefinitions(String, OffsetDateTime, ListMetricSeriesDefinitionOptions)} */ + public void listMetricSeriesDefinitions() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricSeriesDefinitions#String-OffsetDateTime + String metricId = "b460abfc-7a58-47d7-9d99-21ee21fdfc6e"; + final OffsetDateTime activeSince = OffsetDateTime.parse("2020-07-10T00:00:00Z"); + + metricsAdvisorAsyncClient.listMetricSeriesDefinitions(metricId, activeSince) + .subscribe(metricSeriesDefinition -> { + System.out.printf("Data Feed Metric id for the retrieved series definition : %s%n", + metricSeriesDefinition.getMetricId()); + System.out.printf("Series Key:"); + System.out.println(metricSeriesDefinition.getSeriesKey().asMap()); + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricSeriesDefinitions#String-OffsetDateTime + } + + public void listMetricSeriesDefinitionsWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricSeriesDefinitions#String-OffsetDateTime-ListMetricSeriesDefinitionOptions String metricId = "b460abfc-7a58-47d7-9d99-21ee21fdfc6e"; final OffsetDateTime activeSince = OffsetDateTime.parse("2020-07-10T00:00:00Z"); @@ -154,17 +170,42 @@ public void listMetricDimensionValuesWithOptions() { // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricDimensionValues#String-String-ListMetricDimensionValuesOptions } + public void listIncidentsForAlert() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-String + final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; + final String alertId = "1746b031c00"; + + metricsAdvisorAsyncClient.listIncidents( + alertConfigurationId, + alertId) + .subscribe(incident -> { + System.out.printf("Data Feed Metric Id: %s%n", incident.getMetricId()); + System.out.printf("Detection Configuration Id: %s%n", incident.getDetectionConfigurationId()); + System.out.printf("Anomaly Incident Id: %s%n", incident.getId()); + System.out.printf("Anomaly Incident Start Time: %s%n", incident.getStartTime()); + System.out.printf("Anomaly Incident AnomalySeverity: %s%n", incident.getSeverity()); + System.out.printf("Anomaly Incident Status: %s%n", incident.getStatus()); + System.out.printf("Root DataFeedDimension Key:"); + DimensionKey rootDimension = incident.getRootDimensionKey(); + for (Map.Entry dimension : rootDimension.asMap().entrySet()) { + System.out.printf("DimensionName: %s DimensionValue:%s%n", + dimension.getKey(), dimension.getValue()); + } + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-String + } + /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listIncidentsForAlert(String, String, ListIncidentsAlertedOptions)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#listIncidents(String, String, ListIncidentsAlertedOptions)}. */ - public void listIncidentsForAlert() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions + public void listIncidentsForAlertWithOptions() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-String-ListIncidentsAlertedOptions final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final String alertId = "1746b031c00"; final ListIncidentsAlertedOptions options = new ListIncidentsAlertedOptions() .setMaxPageSize(10); - metricsAdvisorAsyncClient.listIncidentsForAlert( + metricsAdvisorAsyncClient.listIncidents( alertConfigurationId, alertId, options) @@ -182,18 +223,18 @@ public void listIncidentsForAlert() { dimension.getKey(), dimension.getValue()); } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-String-ListIncidentsAlertedOptions } /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomaliesForAlert(String, String)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomalies(String, String)}. */ public void listAnomaliesForAlert() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForAlert#String-String + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-String final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final String alertId = "1746b031c00"; - metricsAdvisorAsyncClient.listAnomaliesForAlert( + metricsAdvisorAsyncClient.listAnomalies( alertConfigurationId, alertId) .subscribe(anomaly -> { @@ -210,19 +251,19 @@ public void listAnomaliesForAlert() { dimension.getKey(), dimension.getValue()); } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForAlert#String-String + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-String } /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomaliesForAlert(String, String, ListAnomaliesAlertedOptions)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomalies(String, String, ListAnomaliesAlertedOptions)}. */ public void listAnomaliesForAlertWithOptions() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForAlert#String-String-ListAnomaliesAlertedOptions + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-String-ListAnomaliesAlertedOptions final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final String alertId = "1746b031c00"; final ListAnomaliesAlertedOptions options = new ListAnomaliesAlertedOptions() .setMaxPageSize(10); - metricsAdvisorAsyncClient.listAnomaliesForAlert( + metricsAdvisorAsyncClient.listAnomalies( alertConfigurationId, alertId, options) @@ -236,13 +277,29 @@ public void listAnomaliesForAlertWithOptions() { System.out.printf("Series Key:"); System.out.println(anomaly.getSeriesKey().asMap()); }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForAlert#String-String-ListAnomaliesAlertedOptions + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-String-ListAnomaliesAlertedOptions + } + + public void listAlertForAlertConfiguration() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAlerts#String-OffsetDateTime-OffsetDateTime + final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; + final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); + final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); + final AlertQueryTimeMode timeMode = AlertQueryTimeMode.ANOMALY_TIME; + + metricsAdvisorAsyncClient.listAlerts(alertConfigurationId, startTime, endTime) + .subscribe(alert -> { + System.out.printf("Anomaly Alert Id: %s%n", alert.getId()); + System.out.printf("Created Time: %s%n", alert.getCreatedTime()); + System.out.printf("Modified Time: %s%n", alert.getModifiedTime()); + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAlerts#String-OffsetDateTime-OffsetDateTime } /** * Code snippet for {@link MetricsAdvisorAsyncClient#listAlerts(String, OffsetDateTime, OffsetDateTime, ListAlertOptions)}. */ - public void listAlertForAlertConfiguration() { + public void listAlertForAlertConfigurationWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAlerts#String-OffsetDateTime-OffsetDateTime-ListAlertOptions final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); @@ -261,10 +318,22 @@ public void listAlertForAlertConfiguration() { // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAlerts#String-OffsetDateTime-OffsetDateTime-ListAlertOptions } - /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomalyDimensionValues(String, String, OffsetDateTime, OffsetDateTime, ListAnomalyDimensionValuesOptions)}. - */ public void listAnomalyDimensionValues() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalyDimensionValues#String-String-OffsetDateTime-OffsetDateTime + final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; + final String dimensionName = "Dim1"; + final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); + final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); + + metricsAdvisorAsyncClient.listAnomalyDimensionValues(detectionConfigurationId, + dimensionName, + startTime, endTime) + .subscribe(dimensionValue -> { + System.out.printf("DataFeedDimension Value: %s%n", dimensionValue); + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalyDimensionValues#String-String-OffsetDateTime-OffsetDateTime + } + public void listAnomalyDimensionValuesWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalyDimensionValues#String-String-OffsetDateTime-OffsetDateTime-ListAnomalyDimensionValuesOptions final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final String dimensionName = "Dim1"; @@ -283,11 +352,32 @@ public void listAnomalyDimensionValues() { // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalyDimensionValues#String-String-OffsetDateTime-OffsetDateTime-ListAnomalyDimensionValuesOptions } + public void listIncidentsForDetectionConfig() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-OffsetDateTime-OffsetDateTime + final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; + final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); + final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); + + PagedFlux incidentsFlux + = metricsAdvisorAsyncClient.listIncidents(detectionConfigurationId, startTime, endTime); + + incidentsFlux.subscribe(incident -> { + System.out.printf("Data Feed Metric Id: %s%n", incident.getMetricId()); + System.out.printf("Detection Configuration Id: %s%n", incident.getDetectionConfigurationId()); + System.out.printf("Anomaly Incident Id: %s%n", incident.getId()); + System.out.printf("Anomaly Incident Start Time: %s%n", incident.getStartTime()); + System.out.printf("Anomaly Incident AnomalySeverity: %s%n", incident.getSeverity()); + System.out.printf("Anomaly Incident Status: %s%n", incident.getStatus()); + System.out.printf("Root DataFeedDimension Key: %s%n", incident.getRootDimensionKey().asMap()); + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-OffsetDateTime-OffsetDateTime + } + /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listIncidentsForDetectionConfig(String, OffsetDateTime, OffsetDateTime, ListIncidentsDetectedOptions)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#listIncidents(String, OffsetDateTime, OffsetDateTime, ListIncidentsDetectedOptions)}. */ - public void listIncidentsForDetectionConfig() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions + public void listIncidentsForDetectionConfigWithOptions() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); @@ -295,7 +385,7 @@ public void listIncidentsForDetectionConfig() { .setMaxPageSize(1000); PagedFlux incidentsFlux - = metricsAdvisorAsyncClient.listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime, options); + = metricsAdvisorAsyncClient.listIncidents(detectionConfigurationId, startTime, endTime, options); incidentsFlux.subscribe(incident -> { System.out.printf("Data Feed Metric Id: %s%n", incident.getMetricId()); @@ -306,14 +396,34 @@ public void listIncidentsForDetectionConfig() { System.out.printf("Anomaly Incident Status: %s%n", incident.getStatus()); System.out.printf("Root DataFeedDimension Key: %s%n", incident.getRootDimensionKey().asMap()); }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidents#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions + } + + public void listAnomaliesForDetectionConfiguration() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-OffsetDateTime-OffsetDateTime + final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; + final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); + final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); + + metricsAdvisorAsyncClient.listAnomalies(detectionConfigurationId, + startTime, endTime) + .subscribe(anomaly -> { + System.out.printf("DataPoint Anomaly AnomalySeverity: %s%n", anomaly.getSeverity()); + System.out.printf("Series Key:"); + DimensionKey seriesKey = anomaly.getSeriesKey(); + for (Map.Entry dimension : seriesKey.asMap().entrySet()) { + System.out.printf("DimensionName: %s DimensionValue:%s%n", + dimension.getKey(), dimension.getValue()); + } + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-OffsetDateTime-OffsetDateTime } /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomaliesForDetectionConfig(String, OffsetDateTime, OffsetDateTime, ListAnomaliesDetectedOptions)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#listAnomalies(String, OffsetDateTime, OffsetDateTime, ListAnomaliesDetectedOptions)}. */ - public void listAnomaliesForDetectionConfiguration() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions + public void listAnomaliesForDetectionConfigurationWithOptions() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); @@ -322,7 +432,7 @@ public void listAnomaliesForDetectionConfiguration() { final ListAnomaliesDetectedOptions options = new ListAnomaliesDetectedOptions() .setMaxPageSize(10) .setFilter(filter); - metricsAdvisorAsyncClient.listAnomaliesForDetectionConfig(detectionConfigurationId, + metricsAdvisorAsyncClient.listAnomalies(detectionConfigurationId, startTime, endTime, options) .subscribe(anomaly -> { System.out.printf("DataPoint Anomaly AnomalySeverity: %s%n", anomaly.getSeverity()); @@ -333,21 +443,21 @@ public void listAnomaliesForDetectionConfiguration() { dimension.getKey(), dimension.getValue()); } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listAnomalies#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions } /* - * Code snippet for {@link MetricsAdvisorAsyncClient#addFeeddback(String, MetricFeedback)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#addFeedback(String, MetricFeedback)}. */ public void createMetricFeedback() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeeddback#String-MetricFeedback + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeedback#String-MetricFeedback final String metricId = "d3gh4i4-b804-4ab9-a70f-0da0c89cft3l"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final MetricChangePointFeedback metricChangePointFeedback = new MetricChangePointFeedback(startTime, endTime, ChangePointValue.AUTO_DETECT); - metricsAdvisorAsyncClient.addFeeddback(metricId, metricChangePointFeedback) + metricsAdvisorAsyncClient.addFeedback(metricId, metricChangePointFeedback) .subscribe(metricFeedback -> { MetricChangePointFeedback createdMetricChangePointFeedback = (MetricChangePointFeedback) metricFeedback; System.out.printf("Data Feed Metric feedback Id: %s%n", createdMetricChangePointFeedback.getId()); @@ -358,7 +468,7 @@ public void createMetricFeedback() { System.out.printf("Data Feed Metric feedback end time: %s%n", createdMetricChangePointFeedback.getEndTime()); }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeeddback#String-MetricFeedback + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.addFeedback#String-MetricFeedback } /** @@ -555,7 +665,7 @@ public void listIncidentRootCausesWithIncident() { = new ListIncidentsDetectedOptions() .setMaxPageSize(10); - metricsAdvisorAsyncClient.listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime, options) + metricsAdvisorAsyncClient.listIncidents(detectionConfigurationId, startTime, endTime, options) .flatMap(incident -> { return metricsAdvisorAsyncClient.listIncidentRootCauses(incident); }) @@ -568,10 +678,26 @@ public void listIncidentRootCausesWithIncident() { // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listIncidentRootCauses#AnomalyIncident } + public void listMetricEnrichmentStatus() { + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichmentStatus#String-OffsetDateTime-OffsetDateTime + final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); + final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); + final String metricId = "d3gh4i4-b804-4ab9-a70f-0da0c89cft3l"; + + metricsAdvisorAsyncClient.listMetricEnrichmentStatus(metricId, startTime, endTime) + .subscribe(enrichmentStatus -> { + System.out.printf("Data Feed Metric enrichment status : %s%n", enrichmentStatus.getStatus()); + System.out.printf("Data Feed Metric enrichment status message: %s%n", enrichmentStatus.getMessage()); + System.out.printf("Data Feed Metric enrichment status data slice timestamp : %s%n", + enrichmentStatus.getTimestamp()); + }); + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichmentStatus#String-OffsetDateTime-OffsetDateTime + } + /** * Code snippet for {@link MetricsAdvisorAsyncClient#listMetricEnrichmentStatus(String, OffsetDateTime, OffsetDateTime, ListMetricEnrichmentStatusOptions)}. */ - public void listMetricEnrichmentStatus() { + public void listMetricEnrichmentStatusWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichmentStatus#String-OffsetDateTime-OffsetDateTime-ListMetricEnrichmentStatusOptions final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); @@ -589,10 +715,10 @@ public void listMetricEnrichmentStatus() { } /** - * Code snippet for {@link MetricsAdvisorAsyncClient#listMetricEnrichedSeriesData(List, String, OffsetDateTime, OffsetDateTime)}. + * Code snippet for {@link MetricsAdvisorAsyncClient#listMetricEnrichedSeriesData(String, List, OffsetDateTime, OffsetDateTime)}. */ public void listEnrichedSeries() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime final String detectionConfigurationId = "e87d899d-a5a0-4259-b752-11aea34d5e34"; final DimensionKey seriesKey = new DimensionKey() .put("Dim1", "Common Lime") @@ -601,8 +727,8 @@ public void listEnrichedSeries() { final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-12T00:00:00Z"); PagedFlux enrichedDataFlux - = metricsAdvisorAsyncClient.listMetricEnrichedSeriesData(Arrays.asList(seriesKey), - detectionConfigurationId, + = metricsAdvisorAsyncClient.listMetricEnrichedSeriesData(detectionConfigurationId, + Arrays.asList(seriesKey), startTime, endTime); @@ -619,6 +745,6 @@ public void listEnrichedSeries() { System.out.println("the periods calculated for the data points in the time series:"); System.out.println(enrichedData.getPeriods()); }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime + // END: com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientJavaDocCodeSnippets.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientJavaDocCodeSnippets.java index 4ae874c049f6..d55095b80f05 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientJavaDocCodeSnippets.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientJavaDocCodeSnippets.java @@ -29,7 +29,7 @@ import com.azure.ai.metricsadvisor.models.MetricFeedback; import com.azure.ai.metricsadvisor.models.MetricPeriodFeedback; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.AlertQueryTimeMode; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; @@ -203,48 +203,16 @@ public void listMetricDimensionValuesWithOptions() { } /** - * Code snippet for {@link MetricsAdvisorClient#listIncidentsForAlert(String, String, ListIncidentsAlertedOptions)}. - */ - public void listIncidentsForAlert() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions - final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; - final String alertId = "1746b031c00"; - final ListIncidentsAlertedOptions options = new ListIncidentsAlertedOptions() - .setMaxPageSize(10); - - PagedIterable incidentsIterable = metricsAdvisorClient.listIncidentsForAlert( - alertConfigurationId, - alertId, - options); - - for (AnomalyIncident anomalyIncident : incidentsIterable) { - System.out.printf("Data Feed Metric Id: %s%n", anomalyIncident.getMetricId()); - System.out.printf("Detection Configuration Id: %s%n", anomalyIncident.getDetectionConfigurationId()); - System.out.printf("Anomaly Incident Id: %s%n", anomalyIncident.getId()); - System.out.printf("Anomaly Incident Start Time: %s%n", anomalyIncident.getStartTime()); - System.out.printf("Anomaly Incident AnomalySeverity: %s%n", anomalyIncident.getSeverity()); - System.out.printf("Anomaly Incident Status: %s%n", anomalyIncident.getStatus()); - System.out.printf("Root DataFeedDimension Key:"); - DimensionKey rootDimension = anomalyIncident.getRootDimensionKey(); - for (Map.Entry dimension : rootDimension.asMap().entrySet()) { - System.out.printf("DimensionName: %s DimensionValue:%s%n", - dimension.getKey(), dimension.getValue()); - } - } - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions - } - - /** - * Code snippet for {@link MetricsAdvisorClient#listIncidentsForAlert(String, String, ListIncidentsAlertedOptions, Context)}. + * Code snippet for {@link MetricsAdvisorClient#listIncidents(String, String, ListIncidentsAlertedOptions, Context)}. */ public void listIncidentsForAlertWithContext() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions-Context + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-String-ListIncidentsAlertedOptions-Context final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final String alertId = "1746b031c00"; final ListIncidentsAlertedOptions options = new ListIncidentsAlertedOptions() .setMaxPageSize(10); - PagedIterable incidentsIterable = metricsAdvisorClient.listIncidentsForAlert( + PagedIterable incidentsIterable = metricsAdvisorClient.listIncidents( alertConfigurationId, alertId, options, @@ -270,17 +238,17 @@ public void listIncidentsForAlertWithContext() { } } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForAlert#String-String-ListIncidentsAlertedOptions-Context + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-String-ListIncidentsAlertedOptions-Context } /** - * Code snippet for {@link MetricsAdvisorClient#listAnomaliesForAlert(String, String)} + * Code snippet for {@link MetricsAdvisorClient#listAnomalies(String, String)} */ public void listAnomaliesForAlert() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForAlert#String-String + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-String final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final String alertId = "1746b031c00"; - PagedIterable anomaliesIterable = metricsAdvisorClient.listAnomaliesForAlert( + PagedIterable anomaliesIterable = metricsAdvisorClient.listAnomalies( alertConfigurationId, alertId ); @@ -295,19 +263,19 @@ public void listAnomaliesForAlert() { System.out.printf("Series Key:"); System.out.println(dataPointAnomaly.getSeriesKey().asMap()); } - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForAlert#String-String + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-String } /** - * Code snippet for {@link MetricsAdvisorClient#listAnomaliesForAlert(String, String, ListAnomaliesAlertedOptions, Context)}. + * Code snippet for {@link MetricsAdvisorClient#listAnomalies(String, String, ListAnomaliesAlertedOptions, Context)}. */ public void listAnomaliesForAlertWithContext() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForAlert#String-String-ListAnomaliesAlertedOptions-Context + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-String-ListAnomaliesAlertedOptions-Context final String alertConfigurationId = "ff3014a0-bbbb-41ec-a637-677e77b81299"; final String alertId = "1746b031c00"; final ListAnomaliesAlertedOptions options = new ListAnomaliesAlertedOptions() .setMaxPageSize(10); - PagedIterable anomaliesIterable = metricsAdvisorClient.listAnomaliesForAlert( + PagedIterable anomaliesIterable = metricsAdvisorClient.listAnomalies( alertConfigurationId, alertId, options, @@ -329,7 +297,7 @@ public void listAnomaliesForAlertWithContext() { System.out.println(dataPointAnomaly.getSeriesKey().asMap()); } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForAlert#String-String-ListAnomaliesAlertedOptions-Context + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-String-ListAnomaliesAlertedOptions-Context } /** @@ -435,16 +403,16 @@ public void listAnomalyDimensionValuesWithContext() { } /** - * Code snippet for {@link MetricsAdvisorClient#listIncidentsForDetectionConfig(String, OffsetDateTime, OffsetDateTime)}. + * Code snippet for {@link MetricsAdvisorClient#listIncidents(String, OffsetDateTime, OffsetDateTime)}. */ public void listIncidentsForDetectionConfig() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-OffsetDateTime-OffsetDateTime final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); PagedIterable incidentsIterable - = metricsAdvisorClient.listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime); + = metricsAdvisorClient.listIncidents(detectionConfigurationId, startTime, endTime); for (AnomalyIncident anomalyIncident : incidentsIterable) { System.out.printf("Data Feed Metric Id: %s%n", anomalyIncident.getMetricId()); @@ -455,14 +423,14 @@ public void listIncidentsForDetectionConfig() { System.out.printf("Anomaly Incident Status: %s%n", anomalyIncident.getStatus()); System.out.printf("Root DataFeedDimension Key: %s%n", anomalyIncident.getRootDimensionKey().asMap()); } - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-OffsetDateTime-OffsetDateTime } /** - * Code snippet for {@link MetricsAdvisorClient#listIncidentsForDetectionConfig(String, OffsetDateTime, OffsetDateTime, ListIncidentsDetectedOptions, Context)}. + * Code snippet for {@link MetricsAdvisorClient#listIncidents(String, OffsetDateTime, OffsetDateTime, ListIncidentsDetectedOptions, Context)}. */ public void listIncidentsForDetectionConfigWithContext() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions-Context + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions-Context final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); @@ -470,7 +438,7 @@ public void listIncidentsForDetectionConfigWithContext() { .setMaxPageSize(1000); PagedIterable incidentsIterable - = metricsAdvisorClient.listIncidentsForDetectionConfig(detectionConfigurationId, + = metricsAdvisorClient.listIncidents(detectionConfigurationId, startTime, endTime, options, Context.NONE); @@ -491,14 +459,14 @@ public void listIncidentsForDetectionConfigWithContext() { System.out.printf("Root DataFeedDimension Key: %s%n", anomalyIncident.getRootDimensionKey().asMap()); } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidentsForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions-Context + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listIncidents#String-OffsetDateTime-OffsetDateTime-ListIncidentsDetectedOptions-Context } /* - * Code snippet for {@link MetricsAdvisorClient#listAnomaliesForDetectionConfig(String, ListAnomaliesDetectedOptions)}. + * Code snippet for {@link MetricsAdvisorClient#listAnomalies(String, ListAnomaliesDetectedOptions)}. */ public void listAnomaliesForDetectionConfiguration() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-OffsetDateTime-OffsetDateTime final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); @@ -508,7 +476,7 @@ public void listAnomaliesForDetectionConfiguration() { .setMaxPageSize(10) .setFilter(filter); PagedIterable anomaliesIterable - = metricsAdvisorClient.listAnomaliesForDetectionConfig(detectionConfigurationId, startTime, endTime, + = metricsAdvisorClient.listAnomalies(detectionConfigurationId, startTime, endTime, options, Context.NONE); for (DataPointAnomaly dataPointAnomaly : anomaliesIterable) { @@ -520,14 +488,14 @@ public void listAnomaliesForDetectionConfiguration() { dimension.getKey(), dimension.getValue()); } } - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-OffsetDateTime-OffsetDateTime } /** - * Code snippet for {@link MetricsAdvisorClient#listAnomaliesForDetectionConfig(String, OffsetDateTime, OffsetDateTime, ListAnomaliesDetectedOptions, Context)}. + * Code snippet for {@link MetricsAdvisorClient#listAnomalies(String, OffsetDateTime, OffsetDateTime, ListAnomaliesDetectedOptions, Context)}. */ public void listAnomaliesForDetectionConfigurationWithContext() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions-Context + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions-Context final String detectionConfigurationId = "c0f2539f-b804-4ab9-a70f-0da0c89c76d8"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T12:00:00Z"); @@ -537,7 +505,7 @@ public void listAnomaliesForDetectionConfigurationWithContext() { .setMaxPageSize(10) .setFilter(filter); PagedIterable anomaliesIterable - = metricsAdvisorClient.listAnomaliesForDetectionConfig(detectionConfigurationId, + = metricsAdvisorClient.listAnomalies(detectionConfigurationId, startTime, endTime, options, Context.NONE); @@ -556,14 +524,14 @@ public void listAnomaliesForDetectionConfigurationWithContext() { } } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomaliesForDetectionConfig#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions-Context + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listAnomalies#String-OffsetDateTime-OffsetDateTime-ListAnomaliesDetectedOptions-Context } /* - * Code snippet for {@link MetricsAdvisorClient#addFeeddback(String, MetricFeedback)}. + * Code snippet for {@link MetricsAdvisorClient#addFeedback(String, MetricFeedback)}. */ public void createMetricFeedback() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeeddback#String-MetricFeedback + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeedback#String-MetricFeedback final String metricId = "d3gh4i4-b804-4ab9-a70f-0da0c89cft3l"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); @@ -581,11 +549,11 @@ public void createMetricFeedback() { createdMetricChangePointFeedback.getStartTime()); System.out.printf("Data Feed Metric feedback end time: %s%n", createdMetricChangePointFeedback.getEndTime()); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeeddback#String-MetricFeedback + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeedback#String-MetricFeedback } /** - * Code snippet for {@link MetricsAdvisorClient#createMetricFeedbackWithResponse(String, MetricFeedback, Context)}. + * Code snippet for {@link MetricsAdvisorClient#addFeedbackWithResponse(String, MetricFeedback, Context)}. */ public void createMetricFeedbackWithResponse() { // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.addFeedbackWithResponse#String-MetricFeedback-Context @@ -596,7 +564,7 @@ public void createMetricFeedbackWithResponse() { = new MetricChangePointFeedback(startTime, endTime, ChangePointValue.AUTO_DETECT); final Response metricFeedbackResponse - = metricsAdvisorClient.createMetricFeedbackWithResponse(metricId, metricChangePointFeedback, Context.NONE); + = metricsAdvisorClient.addFeedbackWithResponse(metricId, metricChangePointFeedback, Context.NONE); System.out.printf("Data Feed Metric feedback creation operation status %s%n", metricFeedbackResponse.getStatusCode()); @@ -798,7 +766,7 @@ public void listIncidentRootCausesWithIncident() { final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); - metricsAdvisorClient.listIncidentsForDetectionConfig(detectionConfigurationId, startTime, endTime) + metricsAdvisorClient.listIncidents(detectionConfigurationId, startTime, endTime) .forEach(incident -> { metricsAdvisorClient.listIncidentRootCauses(incident) .forEach(incidentRootCause -> { @@ -852,10 +820,10 @@ public void listMetricEnrichmentStatusWithContext() { } /** - * Code snippet for {@link MetricsAdvisorClient#listMetricEnrichedSeriesData(List, String, OffsetDateTime, OffsetDateTime)}. + * Code snippet for {@link MetricsAdvisorClient#listMetricEnrichedSeriesData(String, List, OffsetDateTime, OffsetDateTime)}. */ public void listEnrichedSeries() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime final String detectionConfigurationId = "e87d899d-a5a0-4259-b752-11aea34d5e34"; final DimensionKey seriesKey = new DimensionKey() .put("Dim1", "Common Lime") @@ -864,8 +832,8 @@ public void listEnrichedSeries() { final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-12T00:00:00Z"); PagedIterable enrichedDataIterable - = metricsAdvisorClient.listMetricEnrichedSeriesData(Arrays.asList(seriesKey), - detectionConfigurationId, + = metricsAdvisorClient.listMetricEnrichedSeriesData(detectionConfigurationId, + Arrays.asList(seriesKey), startTime, endTime); @@ -882,14 +850,14 @@ public void listEnrichedSeries() { System.out.println("the periods calculated for the data points in the time series:"); System.out.println(enrichedData.getPeriods()); } - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime } /** - * Code snippet for {@link MetricsAdvisorClient#listMetricEnrichedSeriesData(List, String, OffsetDateTime, OffsetDateTime, Context)}. + * Code snippet for {@link MetricsAdvisorClient#listMetricEnrichedSeriesData(String, List, OffsetDateTime, OffsetDateTime, Context)}. */ public void listEnrichedSeriesWithContext() { - // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime-Context + // BEGIN: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime-Context final String detectionConfigurationId = "e87d899d-a5a0-4259-b752-11aea34d5e34"; final DimensionKey seriesKey = new DimensionKey() .put("Dim1", "Common Lime") @@ -898,8 +866,8 @@ public void listEnrichedSeriesWithContext() { final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-12T00:00:00Z"); PagedIterable enrichedDataIterable - = metricsAdvisorClient.listMetricEnrichedSeriesData(Arrays.asList(seriesKey), - detectionConfigurationId, + = metricsAdvisorClient.listMetricEnrichedSeriesData(detectionConfigurationId, + Arrays.asList(seriesKey), startTime, endTime); @@ -923,6 +891,6 @@ public void listEnrichedSeriesWithContext() { System.out.println(enrichedData.getPeriods()); } }); - // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#List-String-OffsetDateTime-OffsetDateTime-Context + // END: com.azure.ai.metricsadvisor.MetricsAdvisorClient.listMetricEnrichedSeriesData#String-List-OffsetDateTime-OffsetDateTime-Context } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ReadmeSamples.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ReadmeSamples.java index b0c3c631f1c1..df6ade93241c 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ReadmeSamples.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/ReadmeSamples.java @@ -5,37 +5,37 @@ import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClientBuilder; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedRollupSettings; -import com.azure.ai.metricsadvisor.models.DataFeedRollupType; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MySqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.NotificationHook; -import com.azure.ai.metricsadvisor.models.SQLServerDataFeedSource; -import com.azure.ai.metricsadvisor.models.SeverityCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; -import com.azure.ai.metricsadvisor.models.SuppressCondition; +import com.azure.ai.metricsadvisor.administration.models.MySqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.SeverityCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SuppressCondition; import com.azure.core.credential.TokenCredential; import com.azure.core.exception.HttpResponseException; import com.azure.identity.DefaultAzureCredentialBuilder; @@ -43,7 +43,7 @@ import java.time.OffsetDateTime; import java.util.Arrays; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.SQL_SERVER_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.SQL_SERVER_DB; /** * WARNING: MODIFYING THIS FILE WILL REQUIRE CORRESPONDING UPDATES TO README.md FILE. LINE NUMBERS ARE USED TO EXTRACT @@ -143,7 +143,7 @@ public void createDataFeed() { if (SQL_SERVER_DB == createdSqlDataFeed.getSourceType()) { System.out.printf("Data feed sql server query: %s%n", - ((SQLServerDataFeedSource) createdSqlDataFeed.getSource()).getQuery()); + ((SqlServerDataFeedSource) createdSqlDataFeed.getSource()).getQuery()); } } @@ -263,7 +263,7 @@ public void queryAlertsForDetection() { System.out.printf("AnomalyAlert created on: %s%n", alert.getCreatedTime()); // List anomalies for returned alerts - metricsAdvisorClient.listAnomaliesForAlert( + metricsAdvisorClient.listAnomalies( alertConfigurationId, alert.getId()) .forEach(anomaly -> { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationAsyncSample.java index 97fc054b1e11..bc404d105e6e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationAsyncSample.java @@ -3,19 +3,19 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricSeriesGroupDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricSingleSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.ListMetricAnomalyDetectionConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricSeriesGroupDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSingleSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; -import com.azure.ai.metricsadvisor.models.SuppressCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SuppressCondition; import com.azure.core.http.rest.PagedFlux; import reactor.core.publisher.Mono; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationSample.java index 4f7124abd75a..bac9636608b2 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/AnomalyDetectionConfigurationSample.java @@ -3,19 +3,18 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricSeriesGroupDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricSingleSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSeriesGroupDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSingleSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; -import com.azure.ai.metricsadvisor.models.SuppressCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SuppressCondition; import com.azure.core.http.rest.PagedIterable; import java.util.Arrays; @@ -56,8 +55,7 @@ public static void main(String[] args) { // List configurations System.out.printf("Listing detection configurations%n"); PagedIterable detectionConfigsIterable - = advisorAdministrationClient.listMetricAnomalyDetectionConfigs(metricId, - new ListMetricAnomalyDetectionConfigsOptions()); + = advisorAdministrationClient.listMetricAnomalyDetectionConfigs(metricId); for (AnomalyDetectionConfiguration detectionConfig : detectionConfigsIterable) { printDetectionConfiguration(detectionConfig); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionAsyncSample.java index 0c1cba4c142e..e33e8702eb51 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionAsyncSample.java @@ -3,7 +3,7 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; import java.time.OffsetDateTime; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionSample.java index 4c9bed81fd0d..409b25df167a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DataFeedIngestionSample.java @@ -3,9 +3,9 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; -import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; import com.azure.core.http.rest.PagedIterable; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedAsyncSample.java index bf56085da476..e33629591ac0 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedAsyncSample.java @@ -3,16 +3,16 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AzureAppInsightsDataFeedSource; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.AzureAppInsightsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; import reactor.core.publisher.Mono; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedSample.java index 408af9b8b42c..94a165b4bfd5 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatafeedSample.java @@ -3,16 +3,16 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AzureAppInsightsDataFeedSource; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.AzureAppInsightsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; import java.time.OffsetDateTime; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialAsyncSample.java new file mode 100644 index 000000000000..b4f39c07f031 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialAsyncSample.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; +import reactor.core.publisher.Mono; + +import java.util.UUID; + +/** + * Async sample demonstrates how to create, get, update, delete and list datasource credential entity. + */ +public class DatasourceCredentialAsyncSample { + public static void main(String[] args) { + final MetricsAdvisorAdministrationAsyncClient advisorAdministrationAsyncClient = + new MetricsAdvisorAdministrationClientBuilder() + .endpoint("https://{endpoint}.cognitiveservices.azure.com/") + .credential(new MetricsAdvisorKeyCredential("subscription_key", "api_key")) + .buildAsyncClient(); + + // Create Datasource credential entity + System.out.printf("Creating Datasource Credential entity%n"); + + final String name = "sample_name" + UUID.randomUUID(); + final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; + final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; + + DatasourceCredentialEntity datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets("kv", cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + + final Mono createdDatasourceCredentialEntityMono = advisorAdministrationAsyncClient + .createDatasourceCredential(datasourceCredential); + + createdDatasourceCredentialEntityMono + .doOnSubscribe(__ -> + System.out.printf("Creating Datasource credential entity%n")) + .doOnSuccess(datasourceCredentialEntity -> + System.out.printf("Created Datasource credential entity: %s%n", datasourceCredentialEntity.getId())); + + // Retrieve the datasource credential entity that just created. + Mono fetchDataFeedMono = + createdDatasourceCredentialEntityMono.flatMap(createdDatasourceCredEntity -> { + return advisorAdministrationAsyncClient.getDatasourceCredential(createdDatasourceCredEntity.getId()) + .doOnSubscribe(__ -> + System.out + .printf("Fetching Datasource credential entity: %s%n", createdDatasourceCredEntity.getId())) + .doOnSuccess(config -> + System.out.printf("Fetched Datasource credential entity%n")) + .doOnNext(credentialEntity -> { + System.out.printf("Datasource credential entity Id : %s%n", credentialEntity.getId()); + System.out.printf("Datasource credential entity name : %s%n", credentialEntity.getName()); + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + }); + + // Update the datasource credential entity. + Mono updateDatasourcCredMono = fetchDataFeedMono + .flatMap(datasourceCredEntity -> { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV = null; + if (datasourceCredEntity instanceof DatasourceServicePrincipalInKeyVault) { + actualCredentialSPInKV = (DatasourceServicePrincipalInKeyVault) datasourceCredEntity; + } + + return advisorAdministrationAsyncClient.updateDatasourceCredential( + actualCredentialSPInKV.setSecretNameForDatasourceClientId("clientIdSecretName")) + .doOnSubscribe(__ -> + System.out.printf("Updating datasource credential entity: %s%n", datasourceCredEntity.getId())) + .doOnSuccess(config -> { + + System.out.printf("Updated datasource credential entity%n"); + System.out.printf("Updated datasource credential entity client Id: %s%n", + ((DatasourceServicePrincipalInKeyVault) datasourceCredEntity) + .getSecretNameForDatasourceClientId()); + }); + }); + + // Delete the datasource credential entity. + Mono deleteDatasourceCredMono = updateDatasourcCredMono.flatMap(datasourceCredEntity -> { + return advisorAdministrationAsyncClient.deleteDatasourceCredential(datasourceCredEntity.getId()) + .doOnSubscribe(__ -> + System.out.printf("Deleting datasource credential entity: %s%n", datasourceCredEntity.getId())) + .doOnSuccess(config -> + System.out.printf("Deleted datasource credential entity%n")); + }); + + /* + This will block until all the above CRUD on operation on email hook is completed. + This is strongly discouraged for use in production as it eliminates the benefits + of asynchronous IO. It is used here to ensure the sample runs to completion. + */ + deleteDatasourceCredMono.block(); + + // List datasource credential entity. + System.out.printf("Listing datasource credential entity%n"); + advisorAdministrationAsyncClient.listDatasourceCredentials() + .doOnNext(datasourceCredentialEntity -> { + System.out.printf("Datasource credential entity Id: %s%n", datasourceCredentialEntity.getId()); + System.out.printf("Datasource credential entity name: %s%n", datasourceCredentialEntity.getName()); + System.out.printf("Datasource credential entity description: %s%n", + datasourceCredentialEntity.getDescription()); + if (datasourceCredentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) datasourceCredentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialSample.java new file mode 100644 index 000000000000..6b47ce7566d0 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/DatasourceCredentialSample.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor.administration; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; + +import java.util.UUID; + +/** + * Async sample demonstrates how to create, get, update, delete and list datasource credential entity. + */ +public class DatasourceCredentialSample { + public static void main(String[] args) { + final MetricsAdvisorAdministrationClient advisorAdministrationClient = + new MetricsAdvisorAdministrationClientBuilder() + .endpoint("https://{endpoint}.cognitiveservices.azure.com/") + .credential(new MetricsAdvisorKeyCredential("subscription_key", "api_key")) + .buildClient(); + + // Create Datasource credential entity + System.out.printf("Creating Datasource Credential entity%n"); + + final String name = "sample_name" + UUID.randomUUID(); + final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; + final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; + + DatasourceCredentialEntity datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets("kv", cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + + DatasourceCredentialEntity createdDatasourceCredentialEntity = advisorAdministrationClient + .createDatasourceCredential(datasourceCredential); + + + System.out.printf("Created Datasource credential entity: %s"); + + // Retrieve the datasource credential entity that just created. + DatasourceCredentialEntity fetchDatasourceCredEntity + = advisorAdministrationClient.getDatasourceCredential(createdDatasourceCredentialEntity.getId()); + System.out.printf("Fetched Datasource credential entity%n"); + + System.out.printf("Datasource credential entity Id : %s%n", fetchDatasourceCredEntity.getId()); + System.out.printf("Datasource credential entity name : %s%n", fetchDatasourceCredEntity.getName()); + if (fetchDatasourceCredEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) fetchDatasourceCredEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + + // Update the datasource credential entity. + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV = null; + if (fetchDatasourceCredEntity instanceof DatasourceServicePrincipalInKeyVault) { + actualCredentialSPInKV = (DatasourceServicePrincipalInKeyVault) fetchDatasourceCredEntity; + } + + DatasourceCredentialEntity updatedDatasourceCred = + advisorAdministrationClient.updateDatasourceCredential( + actualCredentialSPInKV.setSecretNameForDatasourceClientId("clientIdSecretName")); + + System.out.printf("Updated datasource credential entity%n"); + System.out.printf("Updated datasource credential entity client Id: %s%n", + ((DatasourceServicePrincipalInKeyVault) updatedDatasourceCred) + .getSecretNameForDatasourceClientId()); + + + // Delete the datasource credential entity. + advisorAdministrationClient.deleteDatasourceCredential(fetchDatasourceCredEntity.getId()); + + System.out.printf("Deleted datasource credential entity%n"); + + // List datasource credential entity. + System.out.printf("Listing datasource credential entity%n"); + advisorAdministrationClient.listDatasourceCredentials() + .forEach(datasourceCredentialEntity -> { + System.out.printf("Datasource credential entity Id: %s%n", datasourceCredentialEntity.getId()); + System.out.printf("Datasource credential entity name: %s%n", datasourceCredentialEntity.getName()); + System.out.printf("Datasource credential entity description: %s%n", + datasourceCredentialEntity.getDescription()); + if (datasourceCredentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKVItem + = (DatasourceServicePrincipalInKeyVault) datasourceCredentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKVItem.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKVItem.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKVItem.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKVItem.getSecretNameForDatasourceClientSecret()); + } + }); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookAsyncSample.java index f991e60921e8..715bcd20b17e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookAsyncSample.java @@ -3,10 +3,10 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.WebNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.WebNotificationHook; import com.azure.core.http.rest.PagedFlux; import reactor.core.publisher.Mono; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookSample.java index f410ca2e2952..5e8258863724 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/HookSample.java @@ -3,10 +3,10 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.WebNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.WebNotificationHook; import com.azure.core.http.rest.PagedIterable; /** diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClientJavaDocCodeSnippets.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClientJavaDocCodeSnippets.java index cdb740e16fdc..fd6cf16bb6ab 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClientJavaDocCodeSnippets.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationAsyncClientJavaDocCodeSnippets.java @@ -3,47 +3,50 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedRollupSettings; -import com.azure.ai.metricsadvisor.models.DataFeedRollupType; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedStatus; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedStatus; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions; -import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions; -import com.azure.ai.metricsadvisor.models.NotificationHook; -import com.azure.ai.metricsadvisor.models.ListDataFeedFilter; -import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions; -import com.azure.ai.metricsadvisor.models.ListDataFeedOptions; -import com.azure.ai.metricsadvisor.models.ListHookOptions; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; -import com.azure.ai.metricsadvisor.models.MetricSeriesGroupDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricSingleSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.ListCredentialEntityOptions; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedFilter; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.ListHookOptions; +import com.azure.ai.metricsadvisor.administration.models.ListMetricAnomalyDetectionConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.MetricSeriesGroupDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSingleSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MySqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; -import com.azure.ai.metricsadvisor.models.SeverityCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; -import com.azure.ai.metricsadvisor.models.SuppressCondition; -import com.azure.ai.metricsadvisor.models.WebNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.MySqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.SeverityCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SuppressCondition; +import com.azure.ai.metricsadvisor.administration.models.WebNotificationHook; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.util.Context; @@ -51,6 +54,7 @@ import java.time.OffsetDateTime; import java.util.Arrays; import java.util.List; +import java.util.UUID; /** * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient} @@ -546,7 +550,7 @@ public void listHooksWithOptions() { /** * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#listDataFeedIngestionStatus(String, ListDataFeedIngestionOptions)}. */ - public void listDataFeedIngestionStatus() { + public void listDataFeedIngestionStatusWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDataFeedIngestionStatus#String-ListDataFeedIngestionOptions final String dataFeedId = "4957a2f7-a0f4-4fc0-b8d7-d866c1df0f4c"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); @@ -1065,10 +1069,23 @@ public void getDetectionConfigurationWithResponse() { // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getMetricAnomalyDetectionConfigWithResponse#String } + public void listDetectionConfigurations() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listMetricAnomalyDetectionConfigs#String + final String metricId = "0b836da8-10e6-46cd-8f4f-28262e113a62"; + metricsAdvisorAdminAsyncClient.listMetricAnomalyDetectionConfigs(metricId) + .subscribe(detectionConfig -> { + System.out.printf("Detection config Id: %s%n", detectionConfig.getId()); + System.out.printf("Name: %s%n", detectionConfig.getName()); + System.out.printf("Description: %s%n", detectionConfig.getDescription()); + System.out.printf("MetricId: %s%n", detectionConfig.getMetricId()); + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listMetricAnomalyDetectionConfigs#String + } + /** * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#listMetricAnomalyDetectionConfigs(String, ListMetricAnomalyDetectionConfigsOptions)}. */ - public void listDetectionConfigurations() { + public void listDetectionConfigurationsWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listMetricAnomalyDetectionConfigs#String-ListMetricAnomalyDetectionConfigsOptions final String metricId = "0b836da8-10e6-46cd-8f4f-28262e113a62"; metricsAdvisorAdminAsyncClient.listMetricAnomalyDetectionConfigs(metricId, @@ -1385,4 +1402,264 @@ public void listAnomalyAlertConfigurations() { }); // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listAnomalyAlertConfigs#String-ListAnomalyAlertConfigsOptions } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#createDatasourceCredential(DatasourceCredentialEntity)}. + */ + public void createDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.createDatasourceCredential#DatasourceCredentialEntity + DatasourceCredentialEntity datasourceCredential; + final String name = "sample_name" + UUID.randomUUID(); + final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; + final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; + + datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets("kv", cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + + metricsAdvisorAdminAsyncClient.createDatasourceCredential(datasourceCredential) + .subscribe(credentialEntity -> { + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.createDatasourceCredential#DatasourceCredentialEntity + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#createDatasourceCredentialWithResponse(DatasourceCredentialEntity)}. + */ + public void createDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.createDatasourceCredentialWithResponse#DatasourceCredentialEntity + DatasourceCredentialEntity datasourceCredential; + final String name = "sample_name" + UUID.randomUUID(); + final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; + final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; + + datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets("kv", cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + + metricsAdvisorAdminAsyncClient.createDatasourceCredentialWithResponse(datasourceCredential) + .subscribe(credentialEntityWithResponse -> { + System.out.printf("Credential Entity creation operation status: %s%n", + credentialEntityWithResponse.getStatusCode()); + if (credentialEntityWithResponse.getValue() instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.createDatasourceCredentialWithResponse#DatasourceCredentialEntity + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#updateDatasourceCredential(DatasourceCredentialEntity)}. + */ + public void updateDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.updateDatasourceCredential#DatasourceCredentialEntity + String credentialId = ""; + metricsAdvisorAdminAsyncClient.getDatasourceCredential(credentialId) + .flatMap(existingDatasourceCredential -> { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV = null; + if (existingDatasourceCredential instanceof DatasourceServicePrincipalInKeyVault) { + actualCredentialSPInKV = (DatasourceServicePrincipalInKeyVault) existingDatasourceCredential; + } + return metricsAdvisorAdminAsyncClient.updateDatasourceCredential( + actualCredentialSPInKV.setDescription("set updated description")); + }) + .subscribe(credentialEntity -> { + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out.printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault updated description: %s%n", + actualCredentialSPInKV.getDescription()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.updateDatasourceCredential#DatasourceCredentialEntity + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#updateDatasourceCredentialWithResponse(DatasourceCredentialEntity)}. + */ + public void updateDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.updateDatasourceCredentialWithResponse#DatasourceCredentialEntity + String credentialId = ""; + metricsAdvisorAdminAsyncClient.getDatasourceCredential(credentialId) + .flatMap(existingDatasourceCredential -> { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV = null; + if (existingDatasourceCredential instanceof DatasourceServicePrincipalInKeyVault) { + actualCredentialSPInKV = (DatasourceServicePrincipalInKeyVault) existingDatasourceCredential; + } + return metricsAdvisorAdminAsyncClient.updateDatasourceCredentialWithResponse( + actualCredentialSPInKV.setDescription("set updated description")); + }) + .subscribe(credentialEntityWithResponse -> { + System.out.printf("Credential Entity creation operation status: %s%n", + credentialEntityWithResponse.getStatusCode()); + if (credentialEntityWithResponse.getValue() instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); + System.out.printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault updated description: %s%n", + actualCredentialSPInKV.getDescription()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.updateDatasourceCredentialWithResponse#DatasourceCredentialEntity + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#getDatasourceCredential(String)}. + */ + public void getDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getDatasourceCredential#String + final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; + + metricsAdvisorAdminAsyncClient.getDatasourceCredential(datasourceCredentialId) + .subscribe(credentialEntity -> { + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getDatasourceCredential#String + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#getDatasourceCredentialWithResponse(String)}. + */ + public void getDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getDatasourceCredentialWithResponse#String + final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; + + metricsAdvisorAdminAsyncClient.getDatasourceCredentialWithResponse(datasourceCredentialId) + .subscribe(credentialEntityWithResponse -> { + System.out.printf("Credential Entity creation operation status: %s%n", + credentialEntityWithResponse.getStatusCode()); + if (credentialEntityWithResponse.getValue() instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.getDatasourceCredentialWithResponse#String + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#deleteDatasourceCredential(String)}. + */ + public void deleteDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.deleteDatasourceCredential#String + final String datasourceCredentialId = "t00853f1-9080-447f-bacf-8dccf2e86f"; + metricsAdvisorAdminAsyncClient.deleteDataFeed(datasourceCredentialId); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.deleteDatasourceCredential#String + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#deleteDatasourceCredentialWithResponse(String)} + */ + public void deleteDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.deleteDatasourceCredentialWithResponse#String + final String datasourceCredentialId = "eh0854f1-8927-447f-bacf-8dccf2e86fwe"; + metricsAdvisorAdminAsyncClient.deleteDatasourceCredentialWithResponse(datasourceCredentialId) + .subscribe(response -> + System.out.printf("Datasource credential delete operation status : %s%n", response.getStatusCode())); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.deleteDatasourceCredentialWithResponse#String + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#listDatasourceCredentials()} + */ + public void listDatasourceCredentials() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDatasourceCredentials + metricsAdvisorAdminAsyncClient.listDatasourceCredentials() + .subscribe(datasourceCredentialEntity -> { + if (datasourceCredentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) datasourceCredentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDatasourceCredentials + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#listDatasourceCredentials(ListCredentialEntityOptions)} with options. + */ + public void listDatasourceCredentialsWithOptions() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDatasourceCredentials#ListCredentialEntityOptions + metricsAdvisorAdminAsyncClient.listDatasourceCredentials( + new ListCredentialEntityOptions() + .setMaxPageSize(3)) + .subscribe(datasourceCredentialEntity -> { + if (datasourceCredentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) datasourceCredentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient.listDatasourceCredentials#ListCredentialEntityOptions + } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientJavaDocCodeSnippets.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientJavaDocCodeSnippets.java index 421c288fa0c6..b94a76f0d8d1 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientJavaDocCodeSnippets.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientJavaDocCodeSnippets.java @@ -3,48 +3,51 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedRollupSettings; -import com.azure.ai.metricsadvisor.models.DataFeedRollupType; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedStatus; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedStatus; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions; -import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions; -import com.azure.ai.metricsadvisor.models.NotificationHook; -import com.azure.ai.metricsadvisor.models.ListDataFeedFilter; -import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions; -import com.azure.ai.metricsadvisor.models.ListDataFeedOptions; -import com.azure.ai.metricsadvisor.models.ListHookOptions; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricSeriesGroupDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricSingleSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.ListCredentialEntityOptions; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedFilter; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.ListHookOptions; +import com.azure.ai.metricsadvisor.administration.models.ListMetricAnomalyDetectionConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.MetricSeriesGroupDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSingleSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MySqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.SeverityCondition; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; -import com.azure.ai.metricsadvisor.models.SuppressCondition; -import com.azure.ai.metricsadvisor.models.WebNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.MySqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.SeverityCondition; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SuppressCondition; +import com.azure.ai.metricsadvisor.administration.models.WebNotificationHook; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.rest.PagedIterable; @@ -56,6 +59,7 @@ import java.time.OffsetDateTime; import java.util.Arrays; import java.util.List; +import java.util.UUID; import java.util.stream.Stream; /** @@ -296,7 +300,7 @@ public void listDataFeedWithOptions() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#createHook(NotificationHook)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#createHook(NotificationHook)}. */ public void createHook() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createHook#NotificationHook @@ -317,7 +321,7 @@ public void createHook() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#createHookWithResponse(NotificationHook)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#createHookWithResponse(NotificationHook, Context)}. */ public void createHookWithResponse() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createHookWithResponse#NotificationHook-Context @@ -340,7 +344,7 @@ public void createHookWithResponse() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#getHook(String)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#getHook(String)}. */ public void getHook() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getHook#String @@ -366,7 +370,7 @@ public void getHook() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#getHookWithResponse(String)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#getHookWithResponse(String, Context)}. */ public void getHookWithResponse() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getHookWithResponse#String-Context @@ -394,7 +398,7 @@ public void getHookWithResponse() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#updateHook(NotificationHook)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#updateHook(NotificationHook)}. */ public void updateHook() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateHook#NotificationHook @@ -417,7 +421,7 @@ public void updateHook() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#updateHookWithResponse(NotificationHook)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#updateHookWithResponse(NotificationHook, Context)}. */ public void updateHookWithResponse() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateHookWithResponse#NotificationHook-Context @@ -442,7 +446,7 @@ public void updateHookWithResponse() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#deleteHook(String)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#deleteHook(String)}. */ public void deleteHook() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteHook#String @@ -452,7 +456,7 @@ public void deleteHook() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#deleteHookWithResponse(String)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#deleteHookWithResponse(String, Context)}. */ public void deleteHookWithResponse() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteHookWithResponse#String-Context @@ -464,7 +468,7 @@ public void deleteHookWithResponse() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#listHooks()}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#listHooks()}. */ public void listHooks() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listHooks @@ -491,7 +495,7 @@ public void listHooks() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationAsyncClient#listHooks(ListHookOptions)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#listHooks(ListHookOptions, Context)}. */ public void listHooksWithOptions() { // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listHooks#ListHookOptions-Context @@ -1066,14 +1070,13 @@ public void getDetectionConfigurationWithResponse() { } /** - * Code snippet for {@link MetricsAdvisorAdministrationClient#listMetricAnomalyDetectionConfigs(String, ListMetricAnomalyDetectionConfigsOptions)}. + * Code snippet for {@link MetricsAdvisorAdministrationClient#listMetricAnomalyDetectionConfigs(String)}. */ public void listDetectionConfigurations() { - // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listMetricAnomalyDetectionConfigs#String-ListMetricAnomalyDetectionConfigsOptions + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listMetricAnomalyDetectionConfigs#String final String metricId = "0b836da8-10e6-46cd-8f4f-28262e113a62"; PagedIterable configsIterable - = metricsAdvisorAdminClient.listMetricAnomalyDetectionConfigs(metricId, - new ListMetricAnomalyDetectionConfigsOptions()); + = metricsAdvisorAdminClient.listMetricAnomalyDetectionConfigs(metricId); for (AnomalyDetectionConfiguration detectionConfig : configsIterable) { System.out.printf("Detection config Id: %s%n", detectionConfig.getId()); @@ -1081,7 +1084,7 @@ public void listDetectionConfigurations() { System.out.printf("Description: %s%n", detectionConfig.getDescription()); System.out.printf("MetricId: %s%n", detectionConfig.getMetricId()); } - // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listMetricAnomalyDetectionConfigs#String-ListMetricAnomalyDetectionConfigsOptions + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listMetricAnomalyDetectionConfigs#String } /** @@ -1426,4 +1429,262 @@ public void listAnomalyAlertConfigurationsWithContext() { }); // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listAnomalyAlertConfigs#String-ListAnomalyAlertConfigsOptions-Context } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#createDatasourceCredential(DatasourceCredentialEntity)}. + */ + public void createDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createDatasourceCredential#DatasourceCredentialEntity + DatasourceCredentialEntity datasourceCredential; + final String name = "sample_name" + UUID.randomUUID(); + final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; + final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; + + datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets("kv", cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + + DatasourceCredentialEntity credentialEntity = + metricsAdvisorAdminClient.createDatasourceCredential(datasourceCredential); + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createDatasourceCredential#DatasourceCredentialEntity + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#createDatasourceCredentialWithResponse(DatasourceCredentialEntity, Context)}. + */ + public void createDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createDatasourceCredentialWithResponse#DatasourceCredentialEntity-Context + DatasourceCredentialEntity datasourceCredential; + final String name = "sample_name" + UUID.randomUUID(); + final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; + final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; + + datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets("kv", cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + + Response credentialEntityWithResponse = + metricsAdvisorAdminClient.createDatasourceCredentialWithResponse(datasourceCredential, Context.NONE); + + System.out.printf("Credential Entity creation operation status: %s%n", + credentialEntityWithResponse.getStatusCode()); + if (credentialEntityWithResponse.getValue() instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.createDatasourceCredentialWithResponse#DatasourceCredentialEntity-Context + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#updateDatasourceCredential(DatasourceCredentialEntity)}. + */ + public void updateDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateDatasourceCredential#DatasourceCredentialEntity + final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; + DatasourceCredentialEntity existingDatasourceCredential = + metricsAdvisorAdminClient.getDatasourceCredential(datasourceCredentialId); + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV = null; + if (existingDatasourceCredential instanceof DatasourceServicePrincipalInKeyVault) { + actualCredentialSPInKV = (DatasourceServicePrincipalInKeyVault) existingDatasourceCredential; + } + + DatasourceCredentialEntity credentialEntity = + metricsAdvisorAdminClient.updateDatasourceCredential( + actualCredentialSPInKV.setDescription("set updated description")); + + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault updatedCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out.printf("Actual credential entity key vault endpoint: %s%n", + updatedCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault updated description: %s%n", + updatedCredentialSPInKV.getDescription()); + } + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateDatasourceCredential#DatasourceCredentialEntity + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#updateDatasourceCredentialWithResponse(DatasourceCredentialEntity, Context)}. + */ + public void updateDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateDatasourceCredentialWithResponse#DatasourceCredentialEntity-Context + final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; + DatasourceCredentialEntity existingDatasourceCredential = + metricsAdvisorAdminClient.getDatasourceCredential(datasourceCredentialId); + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV = null; + if (existingDatasourceCredential instanceof DatasourceServicePrincipalInKeyVault) { + actualCredentialSPInKV = (DatasourceServicePrincipalInKeyVault) existingDatasourceCredential; + } + Response credentialEntityWithResponse = + metricsAdvisorAdminClient.updateDatasourceCredentialWithResponse( + actualCredentialSPInKV.setDescription("set updated description"), Context.NONE); + + System.out.printf("Credential Entity creation operation status: %s%n", + credentialEntityWithResponse.getStatusCode()); + if (credentialEntityWithResponse.getValue() instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault updatedCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); + System.out.printf("Actual credential entity key vault endpoint: %s%n", + updatedCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault updated description: %s%n", + updatedCredentialSPInKV.getDescription()); + } + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.updateDatasourceCredentialWithResponse#DatasourceCredentialEntity-Context + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#getDatasourceCredential(String)}. + */ + public void getDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getDatasourceCredential#String + final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; + + DatasourceCredentialEntity credentialEntity = + metricsAdvisorAdminClient.getDatasourceCredential(datasourceCredentialId); + if (credentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getDatasourceCredential#String + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#getDatasourceCredentialWithResponse(String, Context)}. + */ + public void getDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getDatasourceCredentialWithResponse#String-Context + final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; + + Response credentialEntityWithResponse = + metricsAdvisorAdminClient.getDatasourceCredentialWithResponse(datasourceCredentialId, Context.NONE); + System.out.printf("Credential Entity creation operation status: %s%n", + credentialEntityWithResponse.getStatusCode()); + if (credentialEntityWithResponse.getValue() instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.getDatasourceCredentialWithResponse#String-Context + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#deleteDatasourceCredential(String)}. + */ + public void deleteDatasourceCredential() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteDatasourceCredential#String + final String datasourceCredentialId = "t00853f1-9080-447f-bacf-8dccf2e86f"; + metricsAdvisorAdminClient.deleteDataFeed(datasourceCredentialId); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteDatasourceCredential#String + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#deleteDataFeedWithResponse(String, Context)} + */ + public void deleteDatasourceCredentialWithResponse() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteDatasourceCredentialWithResponse#String-Context + final String datasourceCredentialId = "eh0854f1-8927-447f-bacf-8dccf2e86fwe"; + Response response = + metricsAdvisorAdminClient.deleteDatasourceCredentialWithResponse(datasourceCredentialId, Context.NONE); + System.out.printf("Datasource credential delete operation status : %s%n", response.getStatusCode()); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.deleteDatasourceCredentialWithResponse#String-Context + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#listDatasourceCredentials()} + */ + public void listDatasourceCredentials() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listDatasourceCredentials + metricsAdvisorAdminClient.listDatasourceCredentials() + .forEach(datasourceCredentialEntity -> { + if (datasourceCredentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) datasourceCredentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listDatasourceCredentials + } + + /** + * Code snippet for {@link MetricsAdvisorAdministrationClient#listDatasourceCredentials(ListCredentialEntityOptions, Context)} with options. + */ + public void listDatasourceCredentialsWithOptions() { + // BEGIN: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listDatasourceCredentials#ListCredentialEntityOptions-Context + metricsAdvisorAdminClient.listDatasourceCredentials( + new ListCredentialEntityOptions() + .setMaxPageSize(3), + Context.NONE) + .forEach(datasourceCredentialEntity -> { + if (datasourceCredentialEntity instanceof DatasourceServicePrincipalInKeyVault) { + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) datasourceCredentialEntity; + System.out + .printf("Actual credential entity key vault endpoint: %s%n", + actualCredentialSPInKV.getKeyVaultEndpoint()); + System.out.printf("Actual credential entity key vault client Id: %s%n", + actualCredentialSPInKV.getKeyVaultClientId()); + System.out.printf("Actual credential entity key vault secret name for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + System.out.printf("Actual credential entity key vault secret for data source: %s%n", + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } + }); + // END: com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient.listDatasourceCredentials#ListCredentialEntityOptions-Context + } + } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsAsyncSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsAsyncSample.java index a567643235ac..fa5577806a06 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsAsyncSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsAsyncSample.java @@ -3,15 +3,15 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; -import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.SeverityCondition; +import com.azure.ai.metricsadvisor.administration.models.SeverityCondition; import reactor.core.publisher.Mono; import java.util.Arrays; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsSample.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsSample.java index 174c8bb06f08..ff3b59e65d6b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsSample.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/samples/java/com/azure/ai/metricsadvisor/administration/MetricsAnomalyAlertConfigOperationsSample.java @@ -3,15 +3,15 @@ package com.azure.ai.metricsadvisor.administration; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; -import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.SeverityCondition; +import com.azure.ai.metricsadvisor.administration.models.SeverityCondition; import java.util.Arrays; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertAsyncTest.java index 4af1de26708a..2d89e63afabe 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertAsyncTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.AnomalyAlert; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; import com.azure.core.test.TestBase; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTest.java index a38f55dab0c7..547402022462 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.AnomalyAlert; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.test.TestBase; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTestBase.java index d9451ef9b907..94db40374d81 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTestBase.java @@ -6,7 +6,6 @@ import com.azure.ai.metricsadvisor.models.AlertQueryTimeMode; import com.azure.ai.metricsadvisor.models.AnomalyAlert; import com.azure.ai.metricsadvisor.models.ListAlertOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertAsyncTest.java index 933c2455e428..2a4924f017bf 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertAsyncTest.java @@ -4,13 +4,12 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.ErrorCodeException; -import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; import com.azure.core.http.HttpClient; import com.azure.core.test.TestBase; import com.azure.core.util.CoreUtils; @@ -221,8 +220,8 @@ public void deleteAnomalyAlertWithResponse(HttpClient httpClient, MetricsAdvisor // Act & Assert StepVerifier.create(client.getAnomalyAlertConfigWithResponse(createdAnomalyAlert.getId())) .verifyErrorSatisfies(throwable -> { - assertEquals(ErrorCodeException.class, throwable.getClass()); - final ErrorCodeException errorCodeException = (ErrorCodeException) throwable; + assertEquals(MetricsAdvisorResponseException.class, throwable.getClass()); + final MetricsAdvisorResponseException errorCodeException = (MetricsAdvisorResponseException) throwable; assertEquals(HttpResponseStatus.NOT_FOUND.code(), errorCodeException.getResponse().getStatusCode()); }); }); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTest.java index 4a6b98a5d3ad..9c053c0b8614 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTest.java @@ -4,13 +4,12 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.ErrorCodeException; -import com.azure.ai.metricsadvisor.models.ListAnomalyAlertConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; +import com.azure.ai.metricsadvisor.administration.models.ListAnomalyAlertConfigsOptions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfigurationsOperator; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; import com.azure.core.test.TestBase; @@ -209,10 +208,10 @@ public void deleteAnomalyAlertWithResponse(HttpClient httpClient, MetricsAdvisor assertEquals(response.getStatusCode(), HttpResponseStatus.NO_CONTENT.code()); // Act & Assert - Exception exception = assertThrows(ErrorCodeException.class, () -> + Exception exception = assertThrows(MetricsAdvisorResponseException.class, () -> client.getAnomalyAlertConfig(createdAnomalyAlert.getId())); - assertEquals(ErrorCodeException.class, exception.getClass()); - final ErrorCodeException errorCodeException = ((ErrorCodeException) exception); + assertEquals(MetricsAdvisorResponseException.class, exception.getClass()); + final MetricsAdvisorResponseException errorCodeException = ((MetricsAdvisorResponseException) exception); assertEquals(HttpResponseStatus.NOT_FOUND.code(), errorCodeException.getResponse().getStatusCode()); }); } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTestBase.java index fe6a5714601b..2c0a1f6858d0 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTestBase.java @@ -3,12 +3,12 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.AnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConditions; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertConfiguration; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertScope; -import com.azure.ai.metricsadvisor.models.MetricAnomalyAlertSnoozeCondition; -import com.azure.ai.metricsadvisor.models.MetricBoundaryCondition; +import com.azure.ai.metricsadvisor.administration.models.AnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConditions; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertConfiguration; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; +import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertSnoozeCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricBoundaryCondition; import com.azure.core.util.Configuration; import java.util.Collections; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesAsyncTest.java index a36bffe9f5a9..fc357227f1b2 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesAsyncTest.java @@ -3,7 +3,6 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; import com.azure.core.test.TestBase; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTest.java index 1c68dee3a30f..6cc8738fcbc6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTest.java @@ -3,7 +3,6 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTestBase.java index 689156f17cc9..2f32ca5f6b92 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTestBase.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.ListAnomalyDimensionValuesOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForAlertTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForAlertTestBase.java index 4e9d37b09585..cfb3f8bcff6d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForAlertTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForAlertTestBase.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.models.DataPointAnomaly; import com.azure.ai.metricsadvisor.models.ListAnomaliesAlertedOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForDetectionConfigTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForDetectionConfigTestBase.java index 5089993636f0..67776fd98a41 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForDetectionConfigTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyForDetectionConfigTestBase.java @@ -3,11 +3,10 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.AnomalySeverity; +import com.azure.ai.metricsadvisor.administration.models.AnomalySeverity; import com.azure.ai.metricsadvisor.models.DataPointAnomaly; import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedFilter; import com.azure.ai.metricsadvisor.models.ListAnomaliesDetectedOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedAsyncTest.java index f39b0a4e4090..ebf5d82f549e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedAsyncTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.AnomalyIncident; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; import com.azure.core.test.TestBase; @@ -41,7 +40,7 @@ public void listIncidentsDetected(HttpClient httpClient, MetricsAdvisorServiceVe MetricsAdvisorAsyncClient client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildAsyncClient(); PagedFlux incidentsFlux - = client.listIncidentsForDetectionConfig( + = client.listIncidents( ListIncidentsDetectedInput.INSTANCE.detectionConfigurationId, ListIncidentsDetectedInput.INSTANCE.startTime, ListIncidentsDetectedInput.INSTANCE.endTime, ListIncidentsDetectedInput.INSTANCE.options); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedTest.java index 95b5be7a937f..213c79c25792 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.AnomalyIncident; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.test.TestBase; @@ -39,7 +38,7 @@ public void listIncidentsDetected(HttpClient httpClient, MetricsAdvisorServiceVe MetricsAdvisorClient client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildClient(); PagedIterable incidentsIterable - = client.listIncidentsForDetectionConfig( + = client.listIncidents( ListIncidentsDetectedInput.INSTANCE.detectionConfigurationId, ListIncidentsDetectedInput.INSTANCE.startTime, ListIncidentsDetectedInput.INSTANCE.endTime, ListIncidentsDetectedInput.INSTANCE.options, Context.NONE); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertAsyncTest.java index dd37b2ae96e1..94dd2de4e17e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertAsyncTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.AnomalyIncident; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; import com.azure.core.test.TestBase; @@ -39,7 +38,7 @@ public void listIncidentsForAlert(HttpClient httpClient, MetricsAdvisorServiceVe MetricsAdvisorAsyncClient client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildAsyncClient(); PagedFlux incidentsFlux - = client.listIncidentsForAlert( + = client.listIncidents( ListIncidentsForAlertInput.INSTANCE.alertConfigurationId, ListIncidentsForAlertInput.INSTANCE.alertId, ListIncidentsForAlertInput.INSTANCE.options); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertTest.java index 393ee04a22ac..a87d5f0577ac 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertTest.java @@ -6,10 +6,10 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.AnomalyIncident; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.test.TestBase; +import com.azure.core.util.Context; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; @@ -42,10 +42,11 @@ public void listIncidentsForAlert(HttpClient httpClient, MetricsAdvisorServiceVe MetricsAdvisorClient client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildClient(); PagedIterable incidentsIterable - = client.listIncidentsForAlert( + = client.listIncidents( ListIncidentsForAlertInput.INSTANCE.alertConfigurationId, ListIncidentsForAlertInput.INSTANCE.alertId, - ListIncidentsForAlertInput.INSTANCE.options); + ListIncidentsForAlertInput.INSTANCE.options, + Context.NONE); int[] cnt = new int[1]; for (AnomalyIncident anomalyIncident : incidentsIterable) { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseAsyncTest.java index 4a43a6d04878..62a8ba7b511b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseAsyncTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.IncidentRootCause; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseTest.java index 6ef538aa139a..2ad8f4e17a95 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.IncidentRootCause; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/CredentialsTests.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/CredentialsTests.java index b6fcbaf612b0..f0be59e341bf 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/CredentialsTests.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/CredentialsTests.java @@ -13,19 +13,15 @@ public void testKeyUpdate() { final MetricsAdvisorKeyCredential credential = new MetricsAdvisorKeyCredential("sub-id-1", "key-1"); - Assertions.assertTrue(credential.getSubscriptionKey().equals("sub-id-1")); - Assertions.assertTrue(credential.getApiKey().equals("key-1")); + Assertions.assertTrue(credential.getKeys().getSubscriptionKey().equals("sub-id-1")); + Assertions.assertTrue(credential.getKeys().getApiKey().equals("key-1")); - credential.updateSubscriptionKey(null); - Assertions.assertNull(credential.getSubscriptionKey()); + credential.updateKey(null, null); + Assertions.assertNull(credential.getKeys().getSubscriptionKey()); + Assertions.assertNull(credential.getKeys().getApiKey()); - credential.updateApiKey(null); - Assertions.assertNull(credential.getApiKey()); - - credential.updateSubscriptionKey("sub-id-2"); - Assertions.assertTrue(credential.getSubscriptionKey().equals("sub-id-2")); - - credential.updateApiKey("key-2"); - Assertions.assertTrue(credential.getApiKey().equals("key-2")); + credential.updateKey("sub-id-2", "key-2"); + Assertions.assertTrue(credential.getKeys().getSubscriptionKey().equals("sub-id-2")); + Assertions.assertTrue(credential.getKeys().getApiKey().equals("key-2")); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedAsyncClientTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedAsyncClientTest.java index d6a7e29a176b..7e55312e5723 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedAsyncClientTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedAsyncClientTest.java @@ -4,15 +4,14 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; -import com.azure.ai.metricsadvisor.models.DataFeedStatus; -import com.azure.ai.metricsadvisor.models.ErrorCode; -import com.azure.ai.metricsadvisor.models.ErrorCodeException; -import com.azure.ai.metricsadvisor.models.ListDataFeedFilter; -import com.azure.ai.metricsadvisor.models.ListDataFeedOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedStatus; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorError; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedFilter; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedOptions; import com.azure.core.http.HttpClient; import com.azure.core.test.TestBase; import com.azure.core.util.CoreUtils; @@ -38,20 +37,20 @@ import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID_ERROR; -import static com.azure.ai.metricsadvisor.models.DataFeedGranularityType.DAILY; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_APP_INSIGHTS; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_BLOB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_COSMOS_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_DATA_EXPLORER; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_LOG_ANALYTICS; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_TABLE; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.INFLUX_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.MONGO_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.MYSQL_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.POSTGRE_SQL_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.SQL_SERVER_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedStatus.ACTIVE; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType.DAILY; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_APP_INSIGHTS; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_BLOB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_COSMOS_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_DATA_EXPLORER; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_LOG_ANALYTICS; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_TABLE; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.INFLUX_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.MONGO_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.MYSQL_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.POSTGRE_SQL_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.SQL_SERVER_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedStatus.ACTIVE; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -99,8 +98,8 @@ void testListDataFeed(HttpClient httpClient, MetricsAdvisorServiceVersion servic // Assert assertEquals(inputDataFeedList.size(), actualList.size()); - expectedDataFeedList.sort(Comparator.comparing(DataFeed::getSourceType)); - actualList.sort(Comparator.comparing(DataFeed::getSourceType)); + expectedDataFeedList.sort(Comparator.comparing(dataFeed -> dataFeed.getSourceType().toString())); + actualList.sort(Comparator.comparing(dataFeed -> dataFeed.getSourceType().toString())); final AtomicInteger i = new AtomicInteger(-1); final List dataFeedSourceTypes = Arrays.asList(AZURE_BLOB, SQL_SERVER_DB); expectedDataFeedList.forEach(expectedDataFeed -> validateDataFeedResult(expectedDataFeed, @@ -735,8 +734,8 @@ public void deleteDataFeedIdWithResponse(HttpClient httpClient, MetricsAdvisorSe // Act & Assert StepVerifier.create(client.getDataFeedWithResponse(createdDataFeed.getId())) .verifyErrorSatisfies(throwable -> { - assertEquals(ErrorCodeException.class, throwable.getClass()); - final ErrorCode errorCode = ((ErrorCodeException) throwable).getValue(); + assertEquals(MetricsAdvisorResponseException.class, throwable.getClass()); + final MetricsAdvisorError errorCode = ((MetricsAdvisorResponseException) throwable).getValue(); assertEquals(errorCode.getCode(), "ERROR_INVALID_PARAMETER"); assertEquals(errorCode.getMessage(), "datafeedId is invalid."); }); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedClientTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedClientTest.java index 1b6a6ffd40ac..10ae607db771 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedClientTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedClientTest.java @@ -4,19 +4,18 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; -import com.azure.ai.metricsadvisor.models.DataFeedStatus; -import com.azure.ai.metricsadvisor.models.ErrorCode; -import com.azure.ai.metricsadvisor.models.ErrorCodeException; -import com.azure.ai.metricsadvisor.models.ListDataFeedFilter; -import com.azure.ai.metricsadvisor.models.ListDataFeedOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; -import com.azure.ai.metricsadvisor.models.PostgreSqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedStatus; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorError; +import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedFilter; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.PostgreSqlDataFeedSource; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; @@ -45,20 +44,20 @@ import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID_ERROR; -import static com.azure.ai.metricsadvisor.models.DataFeedGranularityType.DAILY; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_APP_INSIGHTS; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_BLOB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_COSMOS_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_DATA_EXPLORER; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_LOG_ANALYTICS; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.AZURE_TABLE; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.INFLUX_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.MONGO_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.MYSQL_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.POSTGRE_SQL_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedSourceType.SQL_SERVER_DB; -import static com.azure.ai.metricsadvisor.models.DataFeedStatus.ACTIVE; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType.DAILY; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_APP_INSIGHTS; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_BLOB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_COSMOS_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_DATA_EXPLORER; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_LOG_ANALYTICS; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.AZURE_TABLE; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.INFLUX_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.MONGO_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.MYSQL_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.POSTGRE_SQL_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType.SQL_SERVER_DB; +import static com.azure.ai.metricsadvisor.administration.models.DataFeedStatus.ACTIVE; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -106,8 +105,8 @@ void testListDataFeed(HttpClient httpClient, MetricsAdvisorServiceVersion servic .collect(Collectors.toList()); assertEquals(inputDataFeedList.size(), actualList.size()); - expectedDataFeedList.sort(Comparator.comparing(DataFeed::getSourceType)); - actualList.sort(Comparator.comparing(DataFeed::getSourceType)); + expectedDataFeedList.sort(Comparator.comparing(dataFeed -> dataFeed.getSourceType().toString())); + actualList.sort(Comparator.comparing(dataFeed -> dataFeed.getSourceType().toString())); final AtomicInteger i = new AtomicInteger(-1); final List dataFeedSourceTypes = Arrays.asList(AZURE_BLOB, SQL_SERVER_DB); expectedDataFeedList.forEach(expectedDataFeed -> @@ -726,9 +725,9 @@ public void deleteDataFeedIdWithResponse(HttpClient httpClient, MetricsAdvisorSe client.deleteDataFeedWithResponse(createdDataFeed.getId(), Context.NONE).getStatusCode()); // Act & Assert - ErrorCodeException exception = assertThrows(ErrorCodeException.class, () -> + MetricsAdvisorResponseException exception = assertThrows(MetricsAdvisorResponseException.class, () -> client.getDataFeedWithResponse(createdDataFeed.getId(), Context.NONE)); - final ErrorCode errorCode = exception.getValue(); + final MetricsAdvisorError errorCode = exception.getValue(); assertEquals(errorCode.getCode(), "ERROR_INVALID_PARAMETER"); assertEquals(errorCode.getMessage(), "datafeedId is invalid."); }, SQL_SERVER_DB); @@ -781,8 +780,8 @@ public void createDataFeedDuplicateMetricName(HttpClient httpClient, MetricsAdvi creatDataFeedRunner(expectedDataFeed -> { expectedDataFeed.setSchema(new DataFeedSchema(Arrays.asList(dataFeedMetric, dataFeedMetric2))); // Act & Assert - final ErrorCodeException errorCodeException - = assertThrows(ErrorCodeException.class, () -> client.createDataFeed(expectedDataFeed)); + final MetricsAdvisorResponseException errorCodeException + = assertThrows(MetricsAdvisorResponseException.class, () -> client.createDataFeed(expectedDataFeed)); assertEquals("The metric name 'cost' is duplicate,please remove one.", errorCodeException.getValue().getMessage()); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationAsyncTest.java index cdd4510f0331..0b9aadeb762b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationAsyncTest.java @@ -4,9 +4,8 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.Response; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTest.java index da81403b8d62..d80716f28242 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTest.java @@ -4,9 +4,8 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTestBase.java index 9a3bfa79cdc9..e1a1504af8be 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTestBase.java @@ -3,10 +3,9 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionProgress; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionStatus; -import com.azure.ai.metricsadvisor.models.ListDataFeedIngestionOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; +import com.azure.ai.metricsadvisor.administration.models.ListDataFeedIngestionOptions; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; import org.junit.jupiter.api.Assertions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedTestBase.java index 0c6731f98450..181547040b37 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedTestBase.java @@ -3,33 +3,32 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.AzureAppInsightsDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureBlobDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureCosmosDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureDataExplorerDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureDataLakeStorageGen2DataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureLogAnalyticsDataFeedSource; -import com.azure.ai.metricsadvisor.models.AzureTableDataFeedSource; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedAutoRollUpMethod; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedMissingDataPointFillSettings; -import com.azure.ai.metricsadvisor.models.DataFeedOptions; -import com.azure.ai.metricsadvisor.models.DataFeedRollupSettings; -import com.azure.ai.metricsadvisor.models.DataFeedRollupType; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DataFeedSourceType; -import com.azure.ai.metricsadvisor.models.DataFeedMissingDataPointFillType; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.InfluxDBDataFeedSource; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; -import com.azure.ai.metricsadvisor.models.MongoDBDataFeedSource; -import com.azure.ai.metricsadvisor.models.MySqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.PostgreSqlDataFeedSource; -import com.azure.ai.metricsadvisor.models.SQLServerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureAppInsightsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureBlobDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureCosmosDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataExplorerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataLakeStorageGen2DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureLogAnalyticsDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureTableDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedAutoRollUpMethod; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMissingDataPointFillSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedOptions; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedRollupType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSourceType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMissingDataPointFillType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.models.InfluxDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.MongoDbDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.MySqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.PostgreSqlDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; import com.azure.core.http.HttpClient; import com.azure.core.util.Configuration; import org.junit.jupiter.api.Test; @@ -45,7 +44,11 @@ import static com.azure.ai.metricsadvisor.TestUtils.APP_INSIGHTS_APPLICATION_ID; import static com.azure.ai.metricsadvisor.TestUtils.APP_INSIGHTS_QUERY; import static com.azure.ai.metricsadvisor.TestUtils.AZURE_DATALAKEGEN2_ACCOUNT_KEY; +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_METRICS_ADVISOR_LOG_ANALYTICS_CLIENT_ID; +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_METRICS_ADVISOR_LOG_ANALYTICS_CLIENT_SECRET; import static com.azure.ai.metricsadvisor.TestUtils.AZURE_METRICS_ADVISOR_ENDPOINT; +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_METRICS_ADVISOR_TENANT_ID; +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_METRICS_ADVISOR_LOG_ANALYTICS_WORKSPACE_ID; import static com.azure.ai.metricsadvisor.TestUtils.BLOB_CONNECTION_STRING; import static com.azure.ai.metricsadvisor.TestUtils.BLOB_TEMPLATE; import static com.azure.ai.metricsadvisor.TestUtils.COSMOS_DB_CONNECTION_STRING; @@ -56,6 +59,7 @@ import static com.azure.ai.metricsadvisor.TestUtils.INFLUX_DB_CONNECTION_STRING; import static com.azure.ai.metricsadvisor.TestUtils.INFLUX_DB_PASSWORD; import static com.azure.ai.metricsadvisor.TestUtils.INGESTION_START_TIME; +import static com.azure.ai.metricsadvisor.TestUtils.LOG_ANALYTICS_QUERY; import static com.azure.ai.metricsadvisor.TestUtils.MONGO_COMMAND; import static com.azure.ai.metricsadvisor.TestUtils.MONGO_DB_CONNECTION_STRING; import static com.azure.ai.metricsadvisor.TestUtils.MYSQL_DB_CONNECTION_STRING; @@ -108,65 +112,56 @@ void listDataFeedRunner(Consumer> testRunner) { void creatDataFeedRunner(Consumer testRunner, DataFeedSourceType dataFeedSourceType) { // create data feeds DataFeed dataFeed; - switch (dataFeedSourceType) { - case AZURE_APP_INSIGHTS: - dataFeed = new DataFeed().setSource(new AzureAppInsightsDataFeedSource( - APP_INSIGHTS_APPLICATION_ID, APP_INSIGHTS_API_KEY, TestUtils.AZURE_CLOUD, APP_INSIGHTS_QUERY)); - break; - case AZURE_BLOB: - dataFeed = new DataFeed().setSource(new AzureBlobDataFeedSource(BLOB_CONNECTION_STRING, - TEST_DB_NAME, BLOB_TEMPLATE)); - break; - case AZURE_DATA_EXPLORER: - dataFeed = - new DataFeed().setSource(new AzureDataExplorerDataFeedSource(DATA_EXPLORER_CONNECTION_STRING, - DATA_EXPLORER_QUERY)); - break; - case AZURE_TABLE: - dataFeed = new DataFeed().setSource(new AzureTableDataFeedSource(TABLE_CONNECTION_STRING, - TABLE_QUERY, TEST_DB_NAME)); - break; - case INFLUX_DB: - dataFeed = new DataFeed().setSource(new InfluxDBDataFeedSource(INFLUX_DB_CONNECTION_STRING, - TEST_DB_NAME, "adreadonly", INFLUX_DB_PASSWORD, TEMPLATE_QUERY)); - break; - case MONGO_DB: - dataFeed = new DataFeed().setSource(new MongoDBDataFeedSource(MONGO_DB_CONNECTION_STRING, - TEST_DB_NAME, MONGO_COMMAND)); - break; - case MYSQL_DB: - dataFeed = new DataFeed().setSource(new MySqlDataFeedSource(MYSQL_DB_CONNECTION_STRING, - TEMPLATE_QUERY)); - break; - case POSTGRE_SQL_DB: - dataFeed = new DataFeed().setSource(new PostgreSqlDataFeedSource(POSTGRE_SQL_DB_CONNECTION_STRING, - TEMPLATE_QUERY)); - break; - case SQL_SERVER_DB: - dataFeed = new DataFeed().setSource(new SQLServerDataFeedSource(SQL_SERVER_CONNECTION_STRING, - TEMPLATE_QUERY)); - break; - case AZURE_COSMOS_DB: - dataFeed = new DataFeed().setSource(new AzureCosmosDataFeedSource(COSMOS_DB_CONNECTION_STRING, - TEMPLATE_QUERY, TEST_DB_NAME, TEST_DB_NAME)); - break; - case AZURE_DATA_LAKE_STORAGE_GEN2: - dataFeed = new DataFeed().setSource(new AzureDataLakeStorageGen2DataFeedSource( - "adsampledatalakegen2", - AZURE_DATALAKEGEN2_ACCOUNT_KEY, - TEST_DB_NAME, DIRECTORY_TEMPLATE, FILE_TEMPLATE)); - break; - case AZURE_LOG_ANALYTICS: - dataFeed = new DataFeed().setSource(new AzureLogAnalyticsDataFeedSource( - "tenant_id", - "client_id", - "client_secret", - "workspace_id", - TEMPLATE_QUERY)); - break; - default: - throw new IllegalStateException("Unexpected value: " + dataFeedSourceType); + if (dataFeedSourceType == DataFeedSourceType.AZURE_APP_INSIGHTS) { + dataFeed = new DataFeed().setSource(new AzureAppInsightsDataFeedSource( + APP_INSIGHTS_APPLICATION_ID, APP_INSIGHTS_API_KEY, TestUtils.AZURE_CLOUD, APP_INSIGHTS_QUERY)); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_BLOB) { + dataFeed = new DataFeed().setSource(AzureBlobDataFeedSource.fromBasicCredential( + BLOB_CONNECTION_STRING, + TEST_DB_NAME, BLOB_TEMPLATE)); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_DATA_EXPLORER) { + dataFeed = + new DataFeed().setSource(AzureDataExplorerDataFeedSource.fromBasicCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY)); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_TABLE) { + dataFeed = new DataFeed().setSource(new AzureTableDataFeedSource(TABLE_CONNECTION_STRING, + TABLE_QUERY, TEST_DB_NAME)); + } else if (dataFeedSourceType == DataFeedSourceType.INFLUX_DB) { + dataFeed = new DataFeed().setSource(new InfluxDbDataFeedSource(INFLUX_DB_CONNECTION_STRING, + TEST_DB_NAME, "adreadonly", INFLUX_DB_PASSWORD, TEMPLATE_QUERY)); + } else if (dataFeedSourceType == DataFeedSourceType.MONGO_DB) { + dataFeed = new DataFeed().setSource(new MongoDbDataFeedSource(MONGO_DB_CONNECTION_STRING, + TEST_DB_NAME, MONGO_COMMAND)); + } else if (dataFeedSourceType == DataFeedSourceType.MYSQL_DB) { + dataFeed = new DataFeed().setSource(new MySqlDataFeedSource(MYSQL_DB_CONNECTION_STRING, + TEMPLATE_QUERY)); + } else if (dataFeedSourceType == DataFeedSourceType.POSTGRE_SQL_DB) { + dataFeed = new DataFeed().setSource(new PostgreSqlDataFeedSource(POSTGRE_SQL_DB_CONNECTION_STRING, + TEMPLATE_QUERY)); + } else if (dataFeedSourceType == DataFeedSourceType.SQL_SERVER_DB) { + dataFeed = new DataFeed().setSource(SqlServerDataFeedSource.fromBasicCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY)); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_COSMOS_DB) { + dataFeed = new DataFeed().setSource(new AzureCosmosDbDataFeedSource(COSMOS_DB_CONNECTION_STRING, + TEMPLATE_QUERY, TEST_DB_NAME, TEST_DB_NAME)); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2) { + dataFeed = new DataFeed().setSource(AzureDataLakeStorageGen2DataFeedSource.fromBasicCredential( + "adsampledatalakegen2", + AZURE_DATALAKEGEN2_ACCOUNT_KEY, + TEST_DB_NAME, DIRECTORY_TEMPLATE, FILE_TEMPLATE)); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_LOG_ANALYTICS) { + dataFeed = new DataFeed().setSource(AzureLogAnalyticsDataFeedSource.fromBasicCredential( + AZURE_METRICS_ADVISOR_TENANT_ID, + AZURE_METRICS_ADVISOR_LOG_ANALYTICS_CLIENT_ID, + AZURE_METRICS_ADVISOR_LOG_ANALYTICS_CLIENT_SECRET, + AZURE_METRICS_ADVISOR_LOG_ANALYTICS_WORKSPACE_ID, + LOG_ANALYTICS_QUERY)); + } else { + throw new IllegalStateException("Unexpected value: " + dataFeedSourceType); } + testRunner.accept(dataFeed.setSchema(new DataFeedSchema(Arrays.asList( new DataFeedMetric().setName("cost").setDisplayName("cost"), new DataFeedMetric().setName("revenue").setDisplayName("revenue"))) @@ -198,124 +193,116 @@ void validateDataFeedResult(DataFeed expectedDataFeed, DataFeed actualDataFeed, private void validateDataFeedSource(DataFeed expectedDataFeed, DataFeed actualDataFeed, DataFeedSourceType dataFeedSourceType) { - switch (dataFeedSourceType) { - case AZURE_APP_INSIGHTS: - final AzureAppInsightsDataFeedSource expAzureAppInsightsDataFeedSource = - (AzureAppInsightsDataFeedSource) expectedDataFeed.getSource(); - final AzureAppInsightsDataFeedSource actualAzureAppInsightsDataFeedSource = - (AzureAppInsightsDataFeedSource) actualDataFeed.getSource(); - // ApiKey and applicationId are no longer returned from the service. - // assertNotNull(actualAzureAppInsightsDataFeedSource.getApiKey()); - // assertNotNull(actualAzureAppInsightsDataFeedSource.getApplicationId()); - assertEquals(expAzureAppInsightsDataFeedSource.getQuery(), - actualAzureAppInsightsDataFeedSource.getQuery()); - assertEquals(expAzureAppInsightsDataFeedSource.getAzureCloud(), - actualAzureAppInsightsDataFeedSource.getAzureCloud()); - break; - case AZURE_BLOB: - final AzureBlobDataFeedSource expBlobDataFeedSource = - (AzureBlobDataFeedSource) expectedDataFeed.getSource(); - final AzureBlobDataFeedSource actualBlobDataFeedSource = - (AzureBlobDataFeedSource) actualDataFeed.getSource(); - assertEquals(expBlobDataFeedSource.getBlobTemplate(), actualBlobDataFeedSource.getBlobTemplate()); - // connection string is no longer returned from the service. - // assertNotNull(actualBlobDataFeedSource.getConnectionString()); - assertEquals(expBlobDataFeedSource.getContainer(), actualBlobDataFeedSource.getContainer()); - break; - case AZURE_DATA_EXPLORER: - final AzureDataExplorerDataFeedSource expExplorerDataFeedSource = - (AzureDataExplorerDataFeedSource) expectedDataFeed.getSource(); - final AzureDataExplorerDataFeedSource actualExplorerDataFeedSource = - (AzureDataExplorerDataFeedSource) actualDataFeed.getSource(); - // assertNotNull(actualExplorerDataFeedSource.getConnectionString()); - assertEquals(expExplorerDataFeedSource.getQuery(), actualExplorerDataFeedSource.getQuery()); - break; - case AZURE_TABLE: - final AzureTableDataFeedSource expTableDataFeedSource = - (AzureTableDataFeedSource) expectedDataFeed.getSource(); - final AzureTableDataFeedSource actualTableDataFeedSource = - (AzureTableDataFeedSource) actualDataFeed.getSource(); - // assertNotNull(actualTableDataFeedSource.getConnectionString()); - assertEquals(expTableDataFeedSource.getTableName(), actualTableDataFeedSource.getTableName()); - assertEquals(expTableDataFeedSource.getQueryScript(), actualTableDataFeedSource.getQueryScript()); - break; - case INFLUX_DB: - final InfluxDBDataFeedSource expInfluxDataFeedSource = - (InfluxDBDataFeedSource) expectedDataFeed.getSource(); - final InfluxDBDataFeedSource actualInfluxDataFeedSource = - (InfluxDBDataFeedSource) actualDataFeed.getSource(); - assertNotNull(actualInfluxDataFeedSource.getConnectionString()); - assertEquals(expInfluxDataFeedSource.getDatabase(), actualInfluxDataFeedSource.getDatabase()); - // assertNotNull(actualInfluxDataFeedSource.getPassword()); - assertNotNull(actualInfluxDataFeedSource.getUserName()); - break; - case MONGO_DB: - final MongoDBDataFeedSource expMongoDataFeedSource = - (MongoDBDataFeedSource) expectedDataFeed.getSource(); - final MongoDBDataFeedSource actualMongoDataFeedSource = - (MongoDBDataFeedSource) actualDataFeed.getSource(); - // assertNotNull(actualMongoDataFeedSource.getConnectionString()); - assertEquals(expMongoDataFeedSource.getDatabase(), actualMongoDataFeedSource.getDatabase()); - assertEquals(expMongoDataFeedSource.getCommand(), actualMongoDataFeedSource.getCommand()); - break; - case MYSQL_DB: - final MySqlDataFeedSource expMySqlDataFeedSource = (MySqlDataFeedSource) expectedDataFeed.getSource(); - final MySqlDataFeedSource actualMySqlDataFeedSource = (MySqlDataFeedSource) actualDataFeed.getSource(); - // assertNotNull(actualMySqlDataFeedSource.getConnectionString()); - assertEquals(expMySqlDataFeedSource.getQuery(), actualMySqlDataFeedSource.getQuery()); - break; - case POSTGRE_SQL_DB: - final PostgreSqlDataFeedSource expPostGreDataFeedSource = - (PostgreSqlDataFeedSource) expectedDataFeed.getSource(); - final PostgreSqlDataFeedSource actualPostGreDataFeedSource = - (PostgreSqlDataFeedSource) actualDataFeed.getSource(); - // assertNotNull(actualPostGreDataFeedSource.getConnectionString()); - assertEquals(expPostGreDataFeedSource.getQuery(), actualPostGreDataFeedSource.getQuery()); - break; - case SQL_SERVER_DB: - final SQLServerDataFeedSource expSqlServerDataFeedSource = - (SQLServerDataFeedSource) expectedDataFeed.getSource(); - final SQLServerDataFeedSource actualSqlServerDataFeedSource = - (SQLServerDataFeedSource) actualDataFeed.getSource(); - // connection string is no longer returned from the service. - // assertNotNull(actualSqlServerDataFeedSource.getConnectionString()); - assertEquals(expSqlServerDataFeedSource.getQuery(), actualSqlServerDataFeedSource.getQuery()); - break; - case AZURE_COSMOS_DB: - final AzureCosmosDataFeedSource expCosmosDataFeedSource = - (AzureCosmosDataFeedSource) expectedDataFeed.getSource(); - final AzureCosmosDataFeedSource actualCosmosDataFeedSource = - (AzureCosmosDataFeedSource) actualDataFeed.getSource(); - assertEquals(expCosmosDataFeedSource.getCollectionId(), actualCosmosDataFeedSource.getCollectionId()); - // assertNotNull(actualCosmosDataFeedSource.getConnectionString()); - assertEquals(expCosmosDataFeedSource.getDatabase(), actualCosmosDataFeedSource.getDatabase()); - assertEquals(expCosmosDataFeedSource.getSqlQuery(), actualCosmosDataFeedSource.getSqlQuery()); - break; - case AZURE_DATA_LAKE_STORAGE_GEN2: - final AzureDataLakeStorageGen2DataFeedSource expDataLakeStorageGen2DataFeedSource = - (AzureDataLakeStorageGen2DataFeedSource) expectedDataFeed.getSource(); - final AzureDataLakeStorageGen2DataFeedSource actualDataLakeFeedSource = - (AzureDataLakeStorageGen2DataFeedSource) actualDataFeed.getSource(); - // assertNotNull(actualDataLakeFeedSource.getAccountKey()); - assertNotNull(actualDataLakeFeedSource.getAccountName()); - assertEquals(expDataLakeStorageGen2DataFeedSource.getDirectoryTemplate(), - actualDataLakeFeedSource.getDirectoryTemplate()); - assertEquals(expDataLakeStorageGen2DataFeedSource.getFileSystemName(), - actualDataLakeFeedSource.getFileSystemName()); - assertEquals(expDataLakeStorageGen2DataFeedSource.getFileTemplate(), - actualDataLakeFeedSource.getFileTemplate()); - break; - case AZURE_LOG_ANALYTICS: - final AzureLogAnalyticsDataFeedSource expLogAnalyticsDataFeedSource = - (AzureLogAnalyticsDataFeedSource) expectedDataFeed.getSource(); - final AzureLogAnalyticsDataFeedSource logAnalyticsDataFeedSource = - (AzureLogAnalyticsDataFeedSource) actualDataFeed.getSource(); - assertNotNull(logAnalyticsDataFeedSource.getQuery()); - assertEquals(expLogAnalyticsDataFeedSource.getClientId(), - logAnalyticsDataFeedSource.getClientId()); - break; - default: - throw new IllegalStateException("Unexpected value: " + dataFeedSourceType); + if (dataFeedSourceType == DataFeedSourceType.AZURE_APP_INSIGHTS) { + final AzureAppInsightsDataFeedSource expAzureAppInsightsDataFeedSource = + (AzureAppInsightsDataFeedSource) expectedDataFeed.getSource(); + final AzureAppInsightsDataFeedSource actualAzureAppInsightsDataFeedSource = + (AzureAppInsightsDataFeedSource) actualDataFeed.getSource(); + // ApiKey and applicationId are no longer returned from the service. + // assertNotNull(actualAzureAppInsightsDataFeedSource.getApiKey()); + // assertNotNull(actualAzureAppInsightsDataFeedSource.getApplicationId()); + assertEquals(expAzureAppInsightsDataFeedSource.getQuery(), + actualAzureAppInsightsDataFeedSource.getQuery()); + assertEquals(expAzureAppInsightsDataFeedSource.getAzureCloud(), + actualAzureAppInsightsDataFeedSource.getAzureCloud()); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_BLOB) { + final AzureBlobDataFeedSource expBlobDataFeedSource = + (AzureBlobDataFeedSource) expectedDataFeed.getSource(); + final AzureBlobDataFeedSource actualBlobDataFeedSource = + (AzureBlobDataFeedSource) actualDataFeed.getSource(); + assertEquals(expBlobDataFeedSource.getBlobTemplate(), actualBlobDataFeedSource.getBlobTemplate()); + // connection string is no longer returned from the service. + // assertNotNull(actualBlobDataFeedSource.getConnectionString()); + assertEquals(expBlobDataFeedSource.getContainer(), actualBlobDataFeedSource.getContainer()); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_DATA_EXPLORER) { + final AzureDataExplorerDataFeedSource expExplorerDataFeedSource = + (AzureDataExplorerDataFeedSource) expectedDataFeed.getSource(); + final AzureDataExplorerDataFeedSource actualExplorerDataFeedSource = + (AzureDataExplorerDataFeedSource) actualDataFeed.getSource(); + // assertNotNull(actualExplorerDataFeedSource.getConnectionString()); + assertEquals(expExplorerDataFeedSource.getQuery(), actualExplorerDataFeedSource.getQuery()); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_TABLE) { + final AzureTableDataFeedSource expTableDataFeedSource = + (AzureTableDataFeedSource) expectedDataFeed.getSource(); + final AzureTableDataFeedSource actualTableDataFeedSource = + (AzureTableDataFeedSource) actualDataFeed.getSource(); + // assertNotNull(actualTableDataFeedSource.getConnectionString()); + assertEquals(expTableDataFeedSource.getTableName(), actualTableDataFeedSource.getTableName()); + assertEquals(expTableDataFeedSource.getQueryScript(), actualTableDataFeedSource.getQueryScript()); + } else if (dataFeedSourceType == DataFeedSourceType.INFLUX_DB) { + final InfluxDbDataFeedSource expInfluxDataFeedSource = + (InfluxDbDataFeedSource) expectedDataFeed.getSource(); + final InfluxDbDataFeedSource actualInfluxDataFeedSource = + (InfluxDbDataFeedSource) actualDataFeed.getSource(); + assertNotNull(actualInfluxDataFeedSource.getConnectionString()); + assertEquals(expInfluxDataFeedSource.getDatabase(), actualInfluxDataFeedSource.getDatabase()); + // assertNotNull(actualInfluxDataFeedSource.getPassword()); + assertNotNull(actualInfluxDataFeedSource.getUserName()); + } else if (dataFeedSourceType == DataFeedSourceType.MONGO_DB) { + final MongoDbDataFeedSource expMongoDataFeedSource = + (MongoDbDataFeedSource) expectedDataFeed.getSource(); + final MongoDbDataFeedSource actualMongoDataFeedSource = + (MongoDbDataFeedSource) actualDataFeed.getSource(); + // assertNotNull(actualMongoDataFeedSource.getConnectionString()); + assertEquals(expMongoDataFeedSource.getDatabase(), actualMongoDataFeedSource.getDatabase()); + assertEquals(expMongoDataFeedSource.getCommand(), actualMongoDataFeedSource.getCommand()); + } else if (dataFeedSourceType == DataFeedSourceType.MYSQL_DB) { + final MySqlDataFeedSource expMySqlDataFeedSource = (MySqlDataFeedSource) expectedDataFeed.getSource(); + final MySqlDataFeedSource actualMySqlDataFeedSource = (MySqlDataFeedSource) actualDataFeed.getSource(); + // assertNotNull(actualMySqlDataFeedSource.getConnectionString()); + assertEquals(expMySqlDataFeedSource.getQuery(), actualMySqlDataFeedSource.getQuery()); + } else if (dataFeedSourceType == DataFeedSourceType.POSTGRE_SQL_DB) { + final PostgreSqlDataFeedSource expPostGreDataFeedSource = + (PostgreSqlDataFeedSource) expectedDataFeed.getSource(); + final PostgreSqlDataFeedSource actualPostGreDataFeedSource = + (PostgreSqlDataFeedSource) actualDataFeed.getSource(); + // assertNotNull(actualPostGreDataFeedSource.getConnectionString()); + assertEquals(expPostGreDataFeedSource.getQuery(), actualPostGreDataFeedSource.getQuery()); + } else if (dataFeedSourceType == DataFeedSourceType.SQL_SERVER_DB) { + final SqlServerDataFeedSource expSqlServerDataFeedSource = + (SqlServerDataFeedSource) expectedDataFeed.getSource(); + final SqlServerDataFeedSource actualSqlServerDataFeedSource = + (SqlServerDataFeedSource) actualDataFeed.getSource(); + // connection string is no longer returned from the service. + // assertNotNull(actualSqlServerDataFeedSource.getConnectionString()); + assertEquals(expSqlServerDataFeedSource.getQuery(), actualSqlServerDataFeedSource.getQuery()); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_COSMOS_DB) { + final AzureCosmosDbDataFeedSource expCosmosDataFeedSource = + (AzureCosmosDbDataFeedSource) expectedDataFeed.getSource(); + final AzureCosmosDbDataFeedSource actualCosmosDataFeedSource = + (AzureCosmosDbDataFeedSource) actualDataFeed.getSource(); + assertEquals(expCosmosDataFeedSource.getCollectionId(), actualCosmosDataFeedSource.getCollectionId()); + // assertNotNull(actualCosmosDataFeedSource.getConnectionString()); + assertEquals(expCosmosDataFeedSource.getDatabase(), actualCosmosDataFeedSource.getDatabase()); + assertEquals(expCosmosDataFeedSource.getSqlQuery(), actualCosmosDataFeedSource.getSqlQuery()); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_DATA_LAKE_STORAGE_GEN2) { + final AzureDataLakeStorageGen2DataFeedSource expDataLakeStorageGen2DataFeedSource = + (AzureDataLakeStorageGen2DataFeedSource) expectedDataFeed.getSource(); + final AzureDataLakeStorageGen2DataFeedSource actualDataLakeFeedSource = + (AzureDataLakeStorageGen2DataFeedSource) actualDataFeed.getSource(); + // assertNotNull(actualDataLakeFeedSource.getAccountKey()); + assertNotNull(actualDataLakeFeedSource.getAccountName()); + assertEquals(expDataLakeStorageGen2DataFeedSource.getDirectoryTemplate(), + actualDataLakeFeedSource.getDirectoryTemplate()); + assertEquals(expDataLakeStorageGen2DataFeedSource.getFileSystemName(), + actualDataLakeFeedSource.getFileSystemName()); + assertEquals(expDataLakeStorageGen2DataFeedSource.getFileTemplate(), + actualDataLakeFeedSource.getFileTemplate()); + } else if (dataFeedSourceType == DataFeedSourceType.AZURE_LOG_ANALYTICS) { + final AzureLogAnalyticsDataFeedSource expLogAnalyticsDataFeedSource = + (AzureLogAnalyticsDataFeedSource) expectedDataFeed.getSource(); + final AzureLogAnalyticsDataFeedSource logAnalyticsDataFeedSource = + (AzureLogAnalyticsDataFeedSource) actualDataFeed.getSource(); + assertNotNull(logAnalyticsDataFeedSource.getQuery()); + assertNotNull(logAnalyticsDataFeedSource.getClientId()); + assertNotNull(logAnalyticsDataFeedSource.getTenantId()); +// assertEquals(expLogAnalyticsDataFeedSource.getClientId(), +// logAnalyticsDataFeedSource.getClientId()); +// assertEquals(expLogAnalyticsDataFeedSource.getTenantId(), +// logAnalyticsDataFeedSource.getTenantId()); + assertEquals(expLogAnalyticsDataFeedSource.getQuery(), LOG_ANALYTICS_QUERY); + } else { + throw new IllegalStateException("Unexpected value: " + dataFeedSourceType); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsAsyncTest.java new file mode 100644 index 000000000000..b4f2f90267c0 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsAsyncTest.java @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor; + +import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; +import com.azure.ai.metricsadvisor.administration.models.AzureBlobDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataExplorerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataLakeStorageGen2DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DatasourceDataLakeGen2SharedKey; +import com.azure.ai.metricsadvisor.administration.models.DatasourceAuthenticationType; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipal; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.administration.models.DatasourceSqlServerConnectionString; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; +import com.azure.core.http.HttpClient; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import reactor.test.StepVerifier; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; + +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_DATALAKEGEN2_ACCOUNT_KEY; +import static com.azure.ai.metricsadvisor.TestUtils.BLOB_CONNECTION_STRING; +import static com.azure.ai.metricsadvisor.TestUtils.BLOB_TEMPLATE; +import static com.azure.ai.metricsadvisor.TestUtils.DATA_EXPLORER_CONNECTION_STRING; +import static com.azure.ai.metricsadvisor.TestUtils.DATA_EXPLORER_QUERY; +import static com.azure.ai.metricsadvisor.TestUtils.DIRECTORY_TEMPLATE; +import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +import static com.azure.ai.metricsadvisor.TestUtils.FILE_TEMPLATE; +import static com.azure.ai.metricsadvisor.TestUtils.SQL_SERVER_CONNECTION_STRING; +import static com.azure.ai.metricsadvisor.TestUtils.TEMPLATE_QUERY; +import static com.azure.ai.metricsadvisor.TestUtils.TEST_DB_NAME; + +public class DataFeedWithCredentialsAsyncTest extends DataFeedWithCredentialsTestBase { + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testSqlServer(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationAsyncClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + List credIds = new ArrayList<>(); + + final AtomicReference dataFeed = new AtomicReference<>(initDataFeed()); + try { + // Create SqlFeed with basic credentials in connection string. + dataFeed.get().setSource(SqlServerDataFeedSource.fromBasicCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY)); + + StepVerifier.create(client.createDataFeed(dataFeed.get())) + .assertNext(createdDataFeed -> { + dataFeed.set(createdDataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof SqlServerDataFeedSource); + Assertions.assertNull(((SqlServerDataFeedSource) createdDataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((SqlServerDataFeedSource) createdDataFeed.getSource()).getAuthenticationType()); + }) + .verifyComplete(); + + // Update SqlFeed to use MSI. + dataFeed.get() + .setSource(SqlServerDataFeedSource.fromManagedIdentityCredential(SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY)); + + StepVerifier.create(client.updateDataFeed(dataFeed.get())) + .assertNext(updatedDataFeed -> { + dataFeed.set(updatedDataFeed); + Assertions.assertTrue(updatedDataFeed.getSource() instanceof SqlServerDataFeedSource); + Assertions.assertNull(((SqlServerDataFeedSource) updatedDataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.MANAGED_IDENTITY, + ((SqlServerDataFeedSource) updatedDataFeed.getSource()).getAuthenticationType()); + }) + .verifyComplete(); + + + // Create SqlConnStr cred and update DataFeed to use it. + DataFeed d1 = sqlServerWithConnStringCred(client, dataFeed.get(), credIds); + dataFeed.set(d1); + + // Create SP credential and Update SqlFeed to use it. + DataFeed d2 = sqlServerWithServicePrincipalCred(client, dataFeed.get(), credIds); + dataFeed.set(d2); + + // Create SPInKV credential and Update SqlFeed to use it. + DataFeed d3 = sqlServerWithServicePrincipalInKVCred(client, dataFeed.get(), credIds); + dataFeed.set(d3); + } finally { + try { + StepVerifier.create(client.deleteDataFeed(dataFeed.get().getId())).verifyComplete(); + } finally { + credIds.forEach(credentialId -> + StepVerifier.create(client.deleteDatasourceCredential(credentialId)).verifyComplete()); + } + } + } + + private DataFeed sqlServerWithConnStringCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference sqlConStrCred + = new AtomicReference<>(initDatasourceSqlServerConnectionString()); + + StepVerifier.create(client.createDatasourceCredential(sqlConStrCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceSqlServerConnectionString); + credIds.add(createdCredential.getId()); + sqlConStrCred.set((DatasourceSqlServerConnectionString) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(SqlServerDataFeedSource.fromConnectionStringCredential( + TEMPLATE_QUERY, + sqlConStrCred.get().getId())); + + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateSqlServerFeedWithCredential(updatedDataFeed, sqlConStrCred.get()); + + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + private DataFeed sqlServerWithServicePrincipalCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference servicePrincipalCred + = new AtomicReference<>(initDatasourceServicePrincipal()); + + StepVerifier.create(client.createDatasourceCredential(servicePrincipalCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipal); + credIds.add(createdCredential.getId()); + servicePrincipalCred.set((DatasourceServicePrincipal) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(SqlServerDataFeedSource.fromServicePrincipalCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY, + servicePrincipalCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateSqlServerFeedWithCredential(updatedDataFeed, servicePrincipalCred.get()); + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + private DataFeed sqlServerWithServicePrincipalInKVCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference servicePrincipalInKVCred + = new AtomicReference<>(initDatasourceServicePrincipalInKeyVault()); + + StepVerifier.create(client.createDatasourceCredential(servicePrincipalInKVCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipalInKeyVault); + credIds.add(createdCredential.getId()); + servicePrincipalInKVCred.set((DatasourceServicePrincipalInKeyVault) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(SqlServerDataFeedSource.fromServicePrincipalInKeyVaultCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY, + servicePrincipalInKVCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateSqlServerFeedWithCredential(updatedDataFeed, servicePrincipalInKVCred.get()); + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testDataLakeGen2(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationAsyncClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + List credIds = new ArrayList<>(); + + final AtomicReference dataFeed = new AtomicReference<>(initDataFeed()); + try { + // Create DataLakeFeed with basic credentials in key. + dataFeed.get().setSource(AzureDataLakeStorageGen2DataFeedSource.fromBasicCredential( + "adsampledatalakegen2", + AZURE_DATALAKEGEN2_ACCOUNT_KEY, + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE)); + + StepVerifier.create(client.createDataFeed(dataFeed.get())) + .assertNext(createdDataFeed -> { + dataFeed.set(createdDataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof AzureDataLakeStorageGen2DataFeedSource); + Assertions.assertNull( + ((AzureDataLakeStorageGen2DataFeedSource) createdDataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((AzureDataLakeStorageGen2DataFeedSource) createdDataFeed.getSource()).getAuthenticationType()); + }) + .verifyComplete(); + + // Create SharedKey credential and Update DataLakeFeed to use it. + DataFeed d1 = dataLakeWithSharedKeyCred(client, dataFeed.get(), credIds); + dataFeed.set(d1); + + // Create SP credential and Update SqlFeed to use it. + DataFeed d2 = dataLakeWithServicePrincipalCred(client, dataFeed.get(), credIds); + dataFeed.set(d2); + + // Create SPInKV credential and Update SqlFeed to use it. + DataFeed d3 = dataLakeWithServicePrincipalInKVCred(client, dataFeed.get(), credIds); + dataFeed.set(d3); + } finally { + try { + StepVerifier.create(client.deleteDataFeed(dataFeed.get().getId())).verifyComplete(); + } finally { + credIds.forEach(credentialId -> + StepVerifier.create(client.deleteDatasourceCredential(credentialId)).verifyComplete()); + } + } + } + + private DataFeed dataLakeWithSharedKeyCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference sharedKeyCred + = new AtomicReference<>(initDataSourceDataLakeGen2SharedKey()); + + StepVerifier.create(client.createDatasourceCredential(sharedKeyCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceDataLakeGen2SharedKey); + credIds.add(createdCredential.getId()); + sharedKeyCred.set((DatasourceDataLakeGen2SharedKey) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromSharedKeyCredential("adsampledatalakegen2", + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE, + sharedKeyCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateDataLakeFeedWithCredential(updatedDataFeed, sharedKeyCred.get()); + }) + .verifyComplete(); + + return resultDataFeed.get(); + } + + private DataFeed dataLakeWithServicePrincipalCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference servicePrincipalCred + = new AtomicReference<>(initDatasourceServicePrincipal()); + + StepVerifier.create(client.createDatasourceCredential(servicePrincipalCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipal); + credIds.add(createdCredential.getId()); + servicePrincipalCred.set((DatasourceServicePrincipal) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromServicePrincipalCredential( + "adsampledatalakegen2", + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE, + servicePrincipalCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateDataLakeFeedWithCredential(updatedDataFeed, servicePrincipalCred.get()); + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + private DataFeed dataLakeWithServicePrincipalInKVCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference servicePrincipalInKVCred + = new AtomicReference<>(initDatasourceServicePrincipalInKeyVault()); + + StepVerifier.create(client.createDatasourceCredential(servicePrincipalInKVCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipalInKeyVault); + credIds.add(createdCredential.getId()); + servicePrincipalInKVCred.set((DatasourceServicePrincipalInKeyVault) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromServicePrincipalInKeyVaultCredential( + "adsampledatalakegen2", + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE, + servicePrincipalInKVCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateDataLakeFeedWithCredential(updatedDataFeed, servicePrincipalInKVCred.get()); + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testDataExplorer(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationAsyncClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + List credIds = new ArrayList<>(); + + final AtomicReference dataFeed = new AtomicReference<>(initDataFeed()); + try { + // Create SqlFeed with basic credentials in connection string. + dataFeed.get().setSource(AzureDataExplorerDataFeedSource.fromBasicCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY)); + + StepVerifier.create(client.createDataFeed(dataFeed.get())) + .assertNext(createdDataFeed -> { + dataFeed.set(createdDataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof AzureDataExplorerDataFeedSource); + Assertions.assertNull(((AzureDataExplorerDataFeedSource) createdDataFeed.getSource()) + .getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((AzureDataExplorerDataFeedSource) createdDataFeed.getSource()) + .getAuthenticationType()); + }) + .verifyComplete(); + + // Update DataExplorerFeed to use MSI. + dataFeed.get() + .setSource(AzureDataExplorerDataFeedSource.fromManagedIdentityCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY)); + + StepVerifier.create(client.updateDataFeed(dataFeed.get())) + .assertNext(updatedDataFeed -> { + dataFeed.set(updatedDataFeed); + Assertions.assertTrue(updatedDataFeed.getSource() instanceof AzureDataExplorerDataFeedSource); + Assertions.assertNull(((AzureDataExplorerDataFeedSource) updatedDataFeed.getSource()) + .getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.MANAGED_IDENTITY, + ((AzureDataExplorerDataFeedSource) updatedDataFeed.getSource()) + .getAuthenticationType()); + }) + .verifyComplete(); + + // Create SP credential and Update DataExplorerFeed to use it. + DataFeed d2 = dataExplorerWithServicePrincipalCred(client, dataFeed.get(), credIds); + dataFeed.set(d2); + + // Create SPInKV credential and Update DataExplorerFeed to use it. + DataFeed d3 = dataExplorerWithServicePrincipalInKVCred(client, dataFeed.get(), credIds); + dataFeed.set(d3); + } finally { + try { + StepVerifier.create(client.deleteDataFeed(dataFeed.get().getId())).verifyComplete(); + } finally { + credIds.forEach(credentialId -> + StepVerifier.create(client.deleteDatasourceCredential(credentialId)).verifyComplete()); + } + } + } + + private DataFeed dataExplorerWithServicePrincipalCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference servicePrincipalCred + = new AtomicReference<>(initDatasourceServicePrincipal()); + + StepVerifier.create(client.createDatasourceCredential(servicePrincipalCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipal); + credIds.add(createdCredential.getId()); + servicePrincipalCred.set((DatasourceServicePrincipal) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromServicePrincipalCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY, + servicePrincipalCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateDataExplorerFeedWithCredential(updatedDataFeed, servicePrincipalCred.get()); + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + private DataFeed dataExplorerWithServicePrincipalInKVCred(MetricsAdvisorAdministrationAsyncClient client, + DataFeed dataFeed, + List credIds) { + final AtomicReference servicePrincipalInKVCred + = new AtomicReference<>(initDatasourceServicePrincipalInKeyVault()); + + StepVerifier.create(client.createDatasourceCredential(servicePrincipalInKVCred.get())) + .assertNext(createdCredential -> { + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipalInKeyVault); + credIds.add(createdCredential.getId()); + servicePrincipalInKVCred.set((DatasourceServicePrincipalInKeyVault) createdCredential); + }) + .verifyComplete(); + + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromServicePrincipalInKeyVaultCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY, + servicePrincipalInKVCred.get().getId())); + + final AtomicReference resultDataFeed = new AtomicReference<>(); + StepVerifier.create(client.updateDataFeed(dataFeed)) + .assertNext(updatedDataFeed -> { + resultDataFeed.set(updatedDataFeed); + super.validateDataExplorerFeedWithCredential(updatedDataFeed, servicePrincipalInKVCred.get()); + }) + .verifyComplete(); + return resultDataFeed.get(); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testBlobStorage(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationAsyncClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + final AtomicReference dataFeed = new AtomicReference<>(initDataFeed()); + try { + // Create BlobFeed with basic credentials in connection string. + dataFeed.get().setSource(AzureBlobDataFeedSource.fromBasicCredential( + BLOB_CONNECTION_STRING, + TEST_DB_NAME, BLOB_TEMPLATE)); + + StepVerifier.create(client.createDataFeed(dataFeed.get())) + .assertNext(createdDataFeed -> { + dataFeed.set(createdDataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof AzureBlobDataFeedSource); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((AzureBlobDataFeedSource) createdDataFeed.getSource()).getAuthenticationType()); + }) + .verifyComplete(); + + // Update BlobFeed to use MSI. + dataFeed.get() + .setSource(AzureBlobDataFeedSource.fromManagedIdentityCredential(BLOB_CONNECTION_STRING, + TEST_DB_NAME, BLOB_TEMPLATE)); + + StepVerifier.create(client.updateDataFeed(dataFeed.get())) + .assertNext(updatedDataFeed -> { + dataFeed.set(updatedDataFeed); + Assertions.assertTrue(updatedDataFeed.getSource() instanceof AzureBlobDataFeedSource); + Assertions.assertEquals(DatasourceAuthenticationType.MANAGED_IDENTITY, + ((AzureBlobDataFeedSource) updatedDataFeed.getSource()).getAuthenticationType()); + }) + .verifyComplete(); + } finally { + StepVerifier.create(client.deleteDataFeed(dataFeed.get().getId())).verifyComplete(); + } + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTest.java new file mode 100644 index 000000000000..55545d3a70d8 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTest.java @@ -0,0 +1,382 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor; + +import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; +import com.azure.ai.metricsadvisor.administration.models.AzureBlobDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataExplorerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataLakeStorageGen2DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DatasourceDataLakeGen2SharedKey; +import com.azure.ai.metricsadvisor.administration.models.DatasourceAuthenticationType; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipal; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.administration.models.DatasourceSqlServerConnectionString; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; +import com.azure.core.http.HttpClient; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.ArrayList; +import java.util.List; + +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_DATALAKEGEN2_ACCOUNT_KEY; +import static com.azure.ai.metricsadvisor.TestUtils.BLOB_CONNECTION_STRING; +import static com.azure.ai.metricsadvisor.TestUtils.BLOB_TEMPLATE; +import static com.azure.ai.metricsadvisor.TestUtils.DATA_EXPLORER_CONNECTION_STRING; +import static com.azure.ai.metricsadvisor.TestUtils.DATA_EXPLORER_QUERY; +import static com.azure.ai.metricsadvisor.TestUtils.DIRECTORY_TEMPLATE; +import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +import static com.azure.ai.metricsadvisor.TestUtils.FILE_TEMPLATE; +import static com.azure.ai.metricsadvisor.TestUtils.SQL_SERVER_CONNECTION_STRING; +import static com.azure.ai.metricsadvisor.TestUtils.TEMPLATE_QUERY; +import static com.azure.ai.metricsadvisor.TestUtils.TEST_DB_NAME; + +public class DataFeedWithCredentialsTest extends DataFeedWithCredentialsTestBase { + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testSqlServer(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + List credIds = new ArrayList<>(); + + DataFeed dataFeed = super.initDataFeed(); + try { + // Create SqlFeed with basic credentials in connection string. + dataFeed.setSource(SqlServerDataFeedSource.fromBasicCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY)); + + DataFeed createdDataFeed = client.createDataFeed(dataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof SqlServerDataFeedSource); + Assertions.assertNull(((SqlServerDataFeedSource) createdDataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((SqlServerDataFeedSource) createdDataFeed.getSource()).getAuthenticationType()); + dataFeed = createdDataFeed; + + // Update SqlFeed to use MSI. + dataFeed + .setSource(SqlServerDataFeedSource.fromManagedIdentityCredential(SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY)); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + Assertions.assertTrue(updatedDataFeed.getSource() instanceof SqlServerDataFeedSource); + Assertions.assertNull(((SqlServerDataFeedSource) updatedDataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.MANAGED_IDENTITY, + ((SqlServerDataFeedSource) updatedDataFeed.getSource()).getAuthenticationType()); + dataFeed = updatedDataFeed; + + // Create SqlConnStr cred and update DataFeed to use it. + dataFeed = sqlServerWithConnStringCred(client, dataFeed, credIds); + + // Create SP credential and Update SqlFeed to use it. + dataFeed = sqlServerWithServicePrincipalCred(client, dataFeed, credIds); + + // Create SPInKV credential and Update SqlFeed to use it. + dataFeed = sqlServerWithServicePrincipalInKVCred(client, dataFeed, credIds); + } finally { + try { + client.deleteDataFeed(dataFeed.getId()); + } finally { + credIds.forEach(credentialId -> client.deleteDatasourceCredential(credentialId)); + } + } + } + + private DataFeed sqlServerWithConnStringCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceSqlServerConnectionString sqlConStrCred = initDatasourceSqlServerConnectionString(); + final DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(sqlConStrCred); + Assertions.assertTrue(createdCredential instanceof DatasourceSqlServerConnectionString); + credIds.add(createdCredential.getId()); + sqlConStrCred = (DatasourceSqlServerConnectionString) createdCredential; + + dataFeed.setSource(SqlServerDataFeedSource.fromConnectionStringCredential( + TEMPLATE_QUERY, + sqlConStrCred.getId())); + + final DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateSqlServerFeedWithCredential(updatedDataFeed, sqlConStrCred); + return updatedDataFeed; + } + + private DataFeed sqlServerWithServicePrincipalCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceServicePrincipal servicePrincipalCred = initDatasourceServicePrincipal(); + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(servicePrincipalCred); + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipal); + credIds.add(createdCredential.getId()); + servicePrincipalCred = ((DatasourceServicePrincipal) createdCredential); + + dataFeed.setSource(SqlServerDataFeedSource.fromServicePrincipalCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY, + servicePrincipalCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateSqlServerFeedWithCredential(updatedDataFeed, servicePrincipalCred); + return updatedDataFeed; + } + + private DataFeed sqlServerWithServicePrincipalInKVCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceServicePrincipalInKeyVault servicePrincipalInKVCred = initDatasourceServicePrincipalInKeyVault(); + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(servicePrincipalInKVCred); + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipalInKeyVault); + credIds.add(createdCredential.getId()); + servicePrincipalInKVCred = (DatasourceServicePrincipalInKeyVault) createdCredential; + + dataFeed.setSource(SqlServerDataFeedSource.fromServicePrincipalInKeyVaultCredential( + SQL_SERVER_CONNECTION_STRING, + TEMPLATE_QUERY, + servicePrincipalInKVCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateSqlServerFeedWithCredential(updatedDataFeed, servicePrincipalInKVCred); + return updatedDataFeed; + } + + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testDataLakeGen2(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + List credIds = new ArrayList<>(); + + DataFeed dataFeed = initDataFeed(); + try { + // Create DataLakeFeed with basic credentials in key. + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromBasicCredential( + "adsampledatalakegen2", + AZURE_DATALAKEGEN2_ACCOUNT_KEY, + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE)); + + DataFeed createdDataFeed = client.createDataFeed(dataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof AzureDataLakeStorageGen2DataFeedSource); + Assertions.assertNull( + ((AzureDataLakeStorageGen2DataFeedSource) createdDataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((AzureDataLakeStorageGen2DataFeedSource) createdDataFeed.getSource()).getAuthenticationType()); + dataFeed = createdDataFeed; + + // Create SharedKey credential and Update DataLakeFeed to use it. + dataFeed = dataLakeWithSharedKeyCred(client, dataFeed, credIds); + + // Create SP credential and Update SqlFeed to use it. + dataFeed = dataLakeWithServicePrincipalCred(client, dataFeed, credIds); + + // Create SPInKV credential and Update SqlFeed to use it. + dataFeed = dataLakeWithServicePrincipalInKVCred(client, dataFeed, credIds); + } finally { + try { + client.deleteDataFeed(dataFeed.getId()); + } finally { + credIds.forEach(credentialId -> + client.deleteDatasourceCredential(credentialId)); + } + } + } + + private DataFeed dataLakeWithSharedKeyCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceDataLakeGen2SharedKey sharedKeyCred = initDataSourceDataLakeGen2SharedKey(); + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(sharedKeyCred); + Assertions.assertTrue(createdCredential instanceof DatasourceDataLakeGen2SharedKey); + credIds.add(createdCredential.getId()); + sharedKeyCred = (DatasourceDataLakeGen2SharedKey) createdCredential; + + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromSharedKeyCredential("adsampledatalakegen2", + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE, + sharedKeyCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateDataLakeFeedWithCredential(updatedDataFeed, sharedKeyCred); + return updatedDataFeed; + } + + private DataFeed dataLakeWithServicePrincipalCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceServicePrincipal servicePrincipalCred = initDatasourceServicePrincipal(); + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(servicePrincipalCred); + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipal); + credIds.add(createdCredential.getId()); + servicePrincipalCred = (DatasourceServicePrincipal) createdCredential; + + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromServicePrincipalCredential( + "adsampledatalakegen2", + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE, + servicePrincipalCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateDataLakeFeedWithCredential(updatedDataFeed, servicePrincipalCred); + return updatedDataFeed; + } + + private DataFeed dataLakeWithServicePrincipalInKVCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceServicePrincipalInKeyVault servicePrincipalInKVCred = initDatasourceServicePrincipalInKeyVault(); + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(servicePrincipalInKVCred); + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipalInKeyVault); + credIds.add(createdCredential.getId()); + servicePrincipalInKVCred = (DatasourceServicePrincipalInKeyVault) createdCredential; + + dataFeed.setSource(AzureDataLakeStorageGen2DataFeedSource.fromServicePrincipalInKeyVaultCredential( + "adsampledatalakegen2", + TEST_DB_NAME, + DIRECTORY_TEMPLATE, + FILE_TEMPLATE, + servicePrincipalInKVCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateDataLakeFeedWithCredential(updatedDataFeed, servicePrincipalInKVCred); + return updatedDataFeed; + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testDataExplorer(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + List credIds = new ArrayList<>(); + + DataFeed dataFeed = initDataFeed(); + try { + // Create SqlFeed with basic credentials in connection string. + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromBasicCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY)); + + DataFeed createdDataFeed = client.createDataFeed(dataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof AzureDataExplorerDataFeedSource); + Assertions.assertNull(((AzureDataExplorerDataFeedSource) createdDataFeed.getSource()) + .getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((AzureDataExplorerDataFeedSource) createdDataFeed.getSource()) + .getAuthenticationType()); + dataFeed = createdDataFeed; + + + // Update DataExplorerFeed to use MSI. + dataFeed + .setSource(AzureDataExplorerDataFeedSource.fromManagedIdentityCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY)); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + Assertions.assertTrue(updatedDataFeed.getSource() instanceof AzureDataExplorerDataFeedSource); + Assertions.assertNull(((AzureDataExplorerDataFeedSource) updatedDataFeed.getSource()) + .getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.MANAGED_IDENTITY, + ((AzureDataExplorerDataFeedSource) updatedDataFeed.getSource()) + .getAuthenticationType()); + dataFeed = updatedDataFeed; + + + // Create SP credential and Update DataExplorerFeed to use it. + dataFeed = dataExplorerWithServicePrincipalCred(client, dataFeed, credIds); + + // Create SPInKV credential and Update DataExplorerFeed to use it. + dataFeed = dataExplorerWithServicePrincipalInKVCred(client, dataFeed, credIds); + } finally { + try { + client.deleteDataFeed(dataFeed.getId()); + } finally { + credIds.forEach(credentialId -> client.deleteDatasourceCredential(credentialId)); + } + } + } + + private DataFeed dataExplorerWithServicePrincipalCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceServicePrincipal servicePrincipalCred = initDatasourceServicePrincipal(); + + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(servicePrincipalCred); + + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipal); + credIds.add(createdCredential.getId()); + servicePrincipalCred = (DatasourceServicePrincipal) createdCredential; + + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromServicePrincipalCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY, + servicePrincipalCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateDataExplorerFeedWithCredential(updatedDataFeed, servicePrincipalCred); + return updatedDataFeed; + } + + private DataFeed dataExplorerWithServicePrincipalInKVCred(MetricsAdvisorAdministrationClient client, + DataFeed dataFeed, + List credIds) { + DatasourceServicePrincipalInKeyVault servicePrincipalInKVCred = initDatasourceServicePrincipalInKeyVault(); + DatasourceCredentialEntity createdCredential = client.createDatasourceCredential(servicePrincipalInKVCred); + Assertions.assertTrue(createdCredential instanceof DatasourceServicePrincipalInKeyVault); + credIds.add(createdCredential.getId()); + servicePrincipalInKVCred = (DatasourceServicePrincipalInKeyVault) createdCredential; + + + dataFeed.setSource(AzureDataExplorerDataFeedSource.fromServicePrincipalInKeyVaultCredential( + DATA_EXPLORER_CONNECTION_STRING, + DATA_EXPLORER_QUERY, + servicePrincipalInKVCred.getId())); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + super.validateDataExplorerFeedWithCredential(updatedDataFeed, servicePrincipalInKVCred); + return updatedDataFeed; + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + public void testBlobStorage(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final MetricsAdvisorAdministrationClient client + = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + DataFeed dataFeed = initDataFeed(); + try { + // Create BlobFeed with basic credentials in connection string. + dataFeed.setSource(AzureBlobDataFeedSource.fromBasicCredential( + BLOB_CONNECTION_STRING, + TEST_DB_NAME, BLOB_TEMPLATE)); + + DataFeed createdDataFeed = client.createDataFeed(dataFeed); + Assertions.assertTrue(createdDataFeed.getSource() instanceof AzureBlobDataFeedSource); + Assertions.assertEquals(DatasourceAuthenticationType.BASIC, + ((AzureBlobDataFeedSource) createdDataFeed.getSource()).getAuthenticationType()); + dataFeed = createdDataFeed; + + // Update BlobFeed to use MSI. + dataFeed + .setSource(AzureBlobDataFeedSource.fromManagedIdentityCredential(BLOB_CONNECTION_STRING, + TEST_DB_NAME, BLOB_TEMPLATE)); + + DataFeed updatedDataFeed = client.updateDataFeed(dataFeed); + Assertions.assertTrue(updatedDataFeed.getSource() instanceof AzureBlobDataFeedSource); + Assertions.assertEquals(DatasourceAuthenticationType.MANAGED_IDENTITY, + ((AzureBlobDataFeedSource) updatedDataFeed.getSource()).getAuthenticationType()); + dataFeed = updatedDataFeed; + } finally { + client.deleteDataFeed(dataFeed.getId()); + } + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTestBase.java new file mode 100644 index 000000000000..1cc8c68cb368 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedWithCredentialsTestBase.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor; + +import com.azure.ai.metricsadvisor.administration.models.AzureDataExplorerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureDataLakeStorageGen2DataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DatasourceDataLakeGen2SharedKey; +import com.azure.ai.metricsadvisor.administration.models.DatasourceAuthenticationType; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipal; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.administration.models.DatasourceSqlServerConnectionString; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; +import com.azure.core.http.HttpClient; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import java.util.Arrays; +import java.util.UUID; + +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_DATALAKEGEN2_ACCOUNT_KEY; +import static com.azure.ai.metricsadvisor.TestUtils.INGESTION_START_TIME; +import static com.azure.ai.metricsadvisor.TestUtils.SQL_SERVER_CONNECTION_STRING; + +public abstract class DataFeedWithCredentialsTestBase extends MetricsAdvisorAdministrationClientTestBase { + static final String SQL_CONNECTION_DATASOURCE_CRED_NAME_PREFIX = "java_create_data_source_cred_sql_con"; + static final String DATA_LAKE_GEN2_SHARED_KEY_DATASOURCE_CRED_NAME_PREFIX + = "java_create_data_source_cred_dlake_gen"; + static final String SP_DATASOURCE_CRED_NAME_PREFIX = "java_create_data_source_cred_sp"; + static final String SP_IN_KV_DATASOURCE_CRED_NAME_PREFIX = "java_create_data_source_cred_spkv"; + + @Test + abstract void testSqlServer(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + @Test + abstract void testDataLakeGen2(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + abstract void testDataExplorer(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + abstract void testBlobStorage(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + protected void validateSqlServerFeedWithCredential(DataFeed dataFeed, + DatasourceCredentialEntity credential) { + Assertions.assertTrue(dataFeed.getSource() instanceof SqlServerDataFeedSource); + if (credential instanceof DatasourceSqlServerConnectionString) { + Assertions.assertTrue(dataFeed.getSource() instanceof SqlServerDataFeedSource); + Assertions.assertEquals(credential.getId(), + ((SqlServerDataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING, + ((SqlServerDataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else if (credential instanceof DatasourceServicePrincipal) { + Assertions.assertEquals(credential.getId(), + ((SqlServerDataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.SERVICE_PRINCIPAL, + ((SqlServerDataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else if (credential instanceof DatasourceServicePrincipalInKeyVault) { + Assertions.assertEquals(credential.getId(), + ((SqlServerDataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV, + ((SqlServerDataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else { + throw new IllegalStateException("Unexpected cred type for SqlFeed credential: " + credential); + } + } + + protected void validateDataLakeFeedWithCredential(DataFeed dataFeed, + DatasourceCredentialEntity credential) { + Assertions.assertTrue(dataFeed.getSource() instanceof AzureDataLakeStorageGen2DataFeedSource); + if (credential instanceof DatasourceDataLakeGen2SharedKey) { + Assertions.assertEquals(credential.getId(), + ((AzureDataLakeStorageGen2DataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY, + ((AzureDataLakeStorageGen2DataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else if (credential instanceof DatasourceServicePrincipal) { + Assertions.assertEquals(credential.getId(), + ((AzureDataLakeStorageGen2DataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.SERVICE_PRINCIPAL, + ((AzureDataLakeStorageGen2DataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else if (credential instanceof DatasourceServicePrincipalInKeyVault) { + Assertions.assertEquals(credential.getId(), + ((AzureDataLakeStorageGen2DataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV, + ((AzureDataLakeStorageGen2DataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else { + throw new IllegalStateException("Unexpected cred type for DataLake credential: " + credential); + } + } + + protected void validateDataExplorerFeedWithCredential(DataFeed dataFeed, + DatasourceCredentialEntity credential) { + Assertions.assertTrue(dataFeed.getSource() instanceof AzureDataExplorerDataFeedSource); + if (credential instanceof DatasourceServicePrincipal) { + Assertions.assertEquals(credential.getId(), + ((AzureDataExplorerDataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.SERVICE_PRINCIPAL, + ((AzureDataExplorerDataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else if (credential instanceof DatasourceServicePrincipalInKeyVault) { + Assertions.assertEquals(credential.getId(), + ((AzureDataExplorerDataFeedSource) dataFeed.getSource()).getCredentialId()); + Assertions.assertEquals(DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV, + ((AzureDataExplorerDataFeedSource) dataFeed.getSource()).getAuthenticationType()); + } else { + throw new IllegalStateException("Unexpected cred type for DataExplorer credential: " + credential); + } + } + + protected DataFeed initDataFeed() { + return new DataFeed().setSchema(new DataFeedSchema(Arrays.asList( + new DataFeedMetric().setName("cost").setDisplayName("cost"), + new DataFeedMetric().setName("revenue").setDisplayName("revenue"))) + .setDimensions(Arrays.asList( + new DataFeedDimension().setName("city").setDisplayName("city"), + new DataFeedDimension().setName("category").setDisplayName("category")))) + .setName("java_create_data_feed_test_sample" + UUID.randomUUID()) + .setGranularity(new DataFeedGranularity().setGranularityType(DataFeedGranularityType.DAILY)) + .setIngestionSettings(new DataFeedIngestionSettings(INGESTION_START_TIME)); + } + + protected DatasourceSqlServerConnectionString initDatasourceSqlServerConnectionString() { + final String name = SQL_CONNECTION_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + return new DatasourceSqlServerConnectionString(name, SQL_SERVER_CONNECTION_STRING); + } + + protected DatasourceDataLakeGen2SharedKey initDataSourceDataLakeGen2SharedKey() { + final String name = DATA_LAKE_GEN2_SHARED_KEY_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + return new DatasourceDataLakeGen2SharedKey(name, AZURE_DATALAKEGEN2_ACCOUNT_KEY); + } + + protected DatasourceServicePrincipal initDatasourceServicePrincipal() { + final String name = SP_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + final String cId = "e70248b2-bffa-11eb-8529-0242ac130003"; + final String tId = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + return new DatasourceServicePrincipal(name, cId, tId, mockSecr); + } + + protected DatasourceServicePrincipalInKeyVault initDatasourceServicePrincipalInKeyVault() { + final StringBuilder kvEndpoint = new StringBuilder() + .append("https://") + .append(UUID.randomUUID()) + .append(".vault") + .append(".azure.net"); + final String name = SP_IN_KV_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + final String cId = "e70248b2-bffa-11eb-8529-0242ac130003"; + final String tId = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + + return new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets(kvEndpoint.toString(), cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialAsyncTest.java new file mode 100644 index 000000000000..99cc89b3559b --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialAsyncTest.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor; + +import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; +import com.azure.ai.metricsadvisor.administration.models.DatasourceAuthenticationType; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.core.http.HttpClient; +import com.azure.core.test.TestBase; +import com.azure.core.util.CoreUtils; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; + +import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; +import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class DatasourceCredentialAsyncTest extends DatasourceCredentialTestBase { + private MetricsAdvisorAdministrationAsyncClient client; + + @BeforeAll + static void beforeAll() { + TestBase.setupClass(); + StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); + } + + @AfterAll + static void afterAll() { + StepVerifier.resetDefaultTimeout(); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createSqlConnectionString(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> + // Act & Assert + StepVerifier.create(client.createDatasourceCredential(expectedCredential)) + .assertNext(createdCredential -> { + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); + }) + .verifyComplete(), DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + Mono deleteCredential = client.deleteDatasourceCredential(credentialId.get()); + StepVerifier.create(deleteCredential) + .verifyComplete(); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createDataLakeGen2SharedKey(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> + // Act & Assert + StepVerifier.create(client.createDatasourceCredential(expectedCredential)) + .assertNext(createdCredential -> { + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); + }) + .verifyComplete(), DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + Mono deleteCredential = client.deleteDatasourceCredential(credentialId.get()); + StepVerifier.create(deleteCredential) + .verifyComplete(); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createServicePrincipal(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> + // Act & Assert + StepVerifier.create(client.createDatasourceCredential(expectedCredential)) + .assertNext(createdCredential -> { + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.SERVICE_PRINCIPAL); + }) + .verifyComplete(), DatasourceAuthenticationType.SERVICE_PRINCIPAL); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + Mono deleteCredential = client.deleteDatasourceCredential(credentialId.get()); + StepVerifier.create(deleteCredential) + .verifyComplete(); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createServicePrincipalInKV(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> + // Act & Assert + StepVerifier.create(client.createDatasourceCredential(expectedCredential)) + .assertNext(createdCredential -> { + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); + }) + .verifyComplete(), DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + Mono deleteCredential = client.deleteDatasourceCredential(credentialId.get()); + StepVerifier.create(deleteCredential) + .verifyComplete(); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + void testListDataSourceCredentials(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + AtomicReference> createdCredentialIdList = new AtomicReference<>(); + try { + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildAsyncClient(); + + super.listDatasourceCredentialRunner(inputCredentialList -> { + final List ids = + inputCredentialList.stream() + .map(credential -> client.createDatasourceCredential(credential).block()) + .map(credential -> credential.getId()) + .collect(Collectors.toList()); + createdCredentialIdList.set(ids); + + List retrievedCredentialList = new ArrayList<>(); + StepVerifier.create(client.listDatasourceCredentials()) + .thenConsumeWhile(e -> { + retrievedCredentialList.add(e); + return retrievedCredentialList.size() < inputCredentialList.size(); + }) + .thenCancel().verify(); + + assertEquals(inputCredentialList.size(), retrievedCredentialList.size()); + }); + } finally { + if (!CoreUtils.isNullOrEmpty(createdCredentialIdList.get())) { + createdCredentialIdList.get().forEach(credentialId -> + StepVerifier.create(client.deleteDatasourceCredential(credentialId)).verifyComplete()); + } + } + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTest.java new file mode 100644 index 000000000000..e88fcf93a924 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTest.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor; + +import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; +import com.azure.ai.metricsadvisor.administration.models.DatasourceAuthenticationType; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.CoreUtils; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; + +import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class DatasourceCredentialTest extends DatasourceCredentialTestBase { + private MetricsAdvisorAdministrationClient client; + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createSqlConnectionString(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> { + // Act & Assert + DatasourceCredentialEntity createdCredential + = client.createDatasourceCredential(expectedCredential); + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); + }, DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + client.deleteDatasourceCredential(credentialId.get()); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createDataLakeGen2SharedKey(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> { + // Act & Assert + DatasourceCredentialEntity createdCredential + = client.createDatasourceCredential(expectedCredential); + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); + }, DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + client.deleteDatasourceCredential(credentialId.get()); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void createServicePrincipal(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> { + // Act & Assert + DatasourceCredentialEntity createdCredential + = client.createDatasourceCredential(expectedCredential); + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.SERVICE_PRINCIPAL); + }, DatasourceAuthenticationType.SERVICE_PRINCIPAL); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + client.deleteDatasourceCredential(credentialId.get()); + } + } + } + + @Override + void createServicePrincipalInKV(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + final AtomicReference credentialId = new AtomicReference<>(); + try { + // Arrange + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + super.creatDatasourceCredentialRunner(expectedCredential -> { + // Act & Assert + DatasourceCredentialEntity createdCredential + = client.createDatasourceCredential(expectedCredential); + credentialId.set(createdCredential.getId()); + super.validateCredentialResult(expectedCredential, + createdCredential, + DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); + }, DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); + + } finally { + if (!CoreUtils.isNullOrEmpty(credentialId.get())) { + client.deleteDatasourceCredential(credentialId.get()); + } + } + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") + @Override + void testListDataSourceCredentials(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + AtomicReference> createdCredentialIdList = new AtomicReference<>(); + try { + client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); + + super.listDatasourceCredentialRunner(inputCredentialList -> { + final List ids = + inputCredentialList.stream() + .map(credential -> client.createDatasourceCredential(credential)) + .map(credential -> credential.getId()) + .collect(Collectors.toList()); + createdCredentialIdList.set(ids); + + List retrievedCredentialList = new ArrayList<>(); + PagedIterable credentialsIterable = client.listDatasourceCredentials(); + for (DatasourceCredentialEntity credential: credentialsIterable) { + retrievedCredentialList.add(credential); + if (retrievedCredentialList.size() >= inputCredentialList.size()) { + break; + } + } + assertEquals(inputCredentialList.size(), retrievedCredentialList.size()); + }); + } finally { + if (!CoreUtils.isNullOrEmpty(createdCredentialIdList.get())) { + createdCredentialIdList.get().forEach(credentialId -> client.deleteDatasourceCredential(credentialId)); + } + } + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTestBase.java new file mode 100644 index 000000000000..96425ef1d8f4 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialTestBase.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.metricsadvisor; + +import com.azure.ai.metricsadvisor.administration.models.DatasourceDataLakeGen2SharedKey; +import com.azure.ai.metricsadvisor.administration.models.DatasourceAuthenticationType; +import com.azure.ai.metricsadvisor.administration.models.DatasourceCredentialEntity; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipal; +import com.azure.ai.metricsadvisor.administration.models.DatasourceServicePrincipalInKeyVault; +import com.azure.ai.metricsadvisor.administration.models.DatasourceSqlServerConnectionString; +import com.azure.core.http.HttpClient; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.function.Consumer; + +import static com.azure.ai.metricsadvisor.TestUtils.AZURE_DATALAKEGEN2_ACCOUNT_KEY; +import static com.azure.ai.metricsadvisor.TestUtils.SQL_SERVER_CONNECTION_STRING; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public abstract class DatasourceCredentialTestBase extends MetricsAdvisorAdministrationClientTestBase { + static final String SQL_CONNECTION_DATASOURCE_CRED_NAME_PREFIX = "java_create_data_source_cred_sql_con"; + static final String DATA_LAKE_GEN2_SHARED_KEY_DATASOURCE_CRED_NAME_PREFIX + = "java_create_data_source_cred_dlake_gen"; + static final String SP_DATASOURCE_CRED_NAME_PREFIX = "java_create_data_source_cred_sp"; + static final String SP_IN_KV_DATASOURCE_CRED_NAME_PREFIX = "java_create_data_source_cred_spkv"; + + @Test + abstract void createSqlConnectionString(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + @Test + abstract void createDataLakeGen2SharedKey(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + @Test + abstract void createServicePrincipal(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + @Test + abstract void createServicePrincipalInKV(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + @Test + abstract void testListDataSourceCredentials(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); + + void listDatasourceCredentialRunner(Consumer> testRunner) { + List list = new ArrayList<>(); + creatDatasourceCredentialRunner(datasource -> list.add(datasource), + DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); + creatDatasourceCredentialRunner(datasource -> list.add(datasource), + DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); + testRunner.accept(list); + } + + void creatDatasourceCredentialRunner(Consumer testRunner, + DatasourceAuthenticationType credentialType) { + DatasourceCredentialEntity datasourceCredential; + if (credentialType == DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING) { + final String name = SQL_CONNECTION_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + datasourceCredential = new DatasourceSqlServerConnectionString(name, SQL_SERVER_CONNECTION_STRING); + } else if (credentialType == DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY) { + final String name = DATA_LAKE_GEN2_SHARED_KEY_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + datasourceCredential = new DatasourceDataLakeGen2SharedKey(name, AZURE_DATALAKEGEN2_ACCOUNT_KEY); + } else if (credentialType == DatasourceAuthenticationType.SERVICE_PRINCIPAL) { + final String name = SP_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + final String cId = "e70248b2-bffa-11eb-8529-0242ac130003"; + final String tId = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + datasourceCredential = new DatasourceServicePrincipal(name, cId, tId, mockSecr); + } else if (credentialType == DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV) { + final StringBuilder kvEndpoint = new StringBuilder() + .append("https://") + .append(UUID.randomUUID()) + .append(".vault") + .append(".azure.net"); + final String name = SP_IN_KV_DATASOURCE_CRED_NAME_PREFIX + UUID.randomUUID(); + final String cId = "e70248b2-bffa-11eb-8529-0242ac130003"; + final String tId = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + final String mockSecr = "45389ded-5e07-4e52-b225-4ae8f905afb5"; + + datasourceCredential = new DatasourceServicePrincipalInKeyVault() + .setName(name) + .setKeyVaultForDatasourceSecrets(kvEndpoint.toString(), cId, mockSecr) + .setTenantId(tId) + .setSecretNameForDatasourceClientId("DSClientID_1") + .setSecretNameForDatasourceClientSecret("DSClientSer_1"); + } else { + throw new IllegalStateException("Unexpected value for DataSourceCredentialType: " + credentialType); + } + testRunner.accept(datasourceCredential); + } + + void validateCredentialResult(DatasourceCredentialEntity expectedCredential, + DatasourceCredentialEntity actualCredential, + DatasourceAuthenticationType credentialType) { + assertNotNull(actualCredential.getId()); + assertNotNull(actualCredential.getName()); + + if (credentialType == DatasourceAuthenticationType.AZURE_SQL_CONNECTION_STRING) { + Assertions.assertTrue(actualCredential instanceof DatasourceSqlServerConnectionString); + assertTrue(actualCredential.getName().startsWith(SQL_CONNECTION_DATASOURCE_CRED_NAME_PREFIX)); + } else if (credentialType == DatasourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY) { + Assertions.assertTrue(actualCredential instanceof DatasourceDataLakeGen2SharedKey); + assertTrue(actualCredential.getName().startsWith(DATA_LAKE_GEN2_SHARED_KEY_DATASOURCE_CRED_NAME_PREFIX)); + } else if (credentialType == DatasourceAuthenticationType.SERVICE_PRINCIPAL) { + Assertions.assertTrue(actualCredential instanceof DatasourceServicePrincipal); + assertTrue(actualCredential.getName().startsWith(SP_DATASOURCE_CRED_NAME_PREFIX)); + DatasourceServicePrincipal actualCredentialSP = (DatasourceServicePrincipal) actualCredential; + assertNotNull(actualCredentialSP.getClientId()); + assertNotNull(actualCredentialSP.getTenantId()); + assertEquals(((DatasourceServicePrincipal) expectedCredential).getClientId(), + actualCredentialSP.getClientId()); + assertEquals(((DatasourceServicePrincipal) expectedCredential).getTenantId(), + actualCredentialSP.getTenantId()); + } else if (credentialType == DatasourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV) { + Assertions.assertTrue(actualCredential instanceof DatasourceServicePrincipalInKeyVault); + assertTrue(actualCredential.getName().startsWith(SP_IN_KV_DATASOURCE_CRED_NAME_PREFIX)); + DatasourceServicePrincipalInKeyVault actualCredentialSPInKV + = (DatasourceServicePrincipalInKeyVault) actualCredential; + assertNotNull(actualCredentialSPInKV.getKeyVaultEndpoint()); + assertNotNull(actualCredentialSPInKV.getKeyVaultClientId()); + assertNotNull(actualCredentialSPInKV.getTenantId()); + assertNotNull(actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + assertNotNull(actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + assertEquals(((DatasourceServicePrincipalInKeyVault) expectedCredential).getKeyVaultClientId(), + actualCredentialSPInKV.getKeyVaultClientId()); + assertEquals(((DatasourceServicePrincipalInKeyVault) expectedCredential).getTenantId(), + actualCredentialSPInKV.getTenantId()); + assertEquals(((DatasourceServicePrincipalInKeyVault) expectedCredential) + .getSecretNameForDatasourceClientId(), + actualCredentialSPInKV.getSecretNameForDatasourceClientId()); + assertEquals(((DatasourceServicePrincipalInKeyVault) expectedCredential) + .getSecretNameForDatasourceClientSecret(), + actualCredentialSPInKV.getSecretNameForDatasourceClientSecret()); + } else { + throw new IllegalStateException("Unexpected value for DataSourceCredentialType: " + credentialType); + } + } +} diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationAsyncTest.java index 3d8b35b24f81..28a7d8e73fbf 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationAsyncTest.java @@ -4,11 +4,10 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.ListMetricAnomalyDetectionConfigsOptions; import com.azure.core.http.HttpClient; import com.azure.core.test.TestBase; import com.azure.core.util.CoreUtils; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTest.java index 51847d805174..0b47f27766ad 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTest.java @@ -4,11 +4,9 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.ListMetricAnomalyDetectionConfigsOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; import com.azure.core.http.HttpClient; import com.azure.core.test.TestBase; import com.azure.core.util.CoreUtils; @@ -143,7 +141,7 @@ public void createDetectionConfigurationForMultipleSeriesAndGroup(HttpClient htt assertNotNull(configuration); id.set(configuration.getId()); - client.listMetricAnomalyDetectionConfigs(costMetricId, new ListMetricAnomalyDetectionConfigsOptions()) + client.listMetricAnomalyDetectionConfigs(costMetricId) .forEach(config -> Assertions.assertNotNull(config)); } finally { if (!CoreUtils.isNullOrEmpty(id.get())) { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTestBase.java index 99c02102f775..d55b1630877e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTestBase.java @@ -4,26 +4,25 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; -import com.azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration; -import com.azure.ai.metricsadvisor.models.AnomalyDetectorDirection; -import com.azure.ai.metricsadvisor.models.ChangeThresholdCondition; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.DetectionConditionsOperator; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectionConfiguration; +import com.azure.ai.metricsadvisor.administration.models.AnomalyDetectorDirection; +import com.azure.ai.metricsadvisor.administration.models.ChangeThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.DetectionConditionsOperator; import com.azure.ai.metricsadvisor.models.DimensionKey; -import com.azure.ai.metricsadvisor.models.HardThresholdCondition; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.MetricSeriesGroupDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricWholeSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricSingleSeriesDetectionCondition; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; -import com.azure.ai.metricsadvisor.models.SQLServerDataFeedSource; -import com.azure.ai.metricsadvisor.models.SmartDetectionCondition; -import com.azure.ai.metricsadvisor.models.SuppressCondition; +import com.azure.ai.metricsadvisor.administration.models.HardThresholdCondition; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.MetricSeriesGroupDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricWholeSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.MetricSingleSeriesDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.SmartDetectionCondition; +import com.azure.ai.metricsadvisor.administration.models.SuppressCondition; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; @@ -789,7 +788,8 @@ protected DataFeed createDataFeed(HttpClient httpClient, MetricsAdvisorAdministrationClient client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion).buildClient(); - DataFeed dataFeed = new DataFeed().setSource(new SQLServerDataFeedSource(SQL_SERVER_CONNECTION_STRING, + DataFeed dataFeed = new DataFeed().setSource(SqlServerDataFeedSource.fromBasicCredential( + SQL_SERVER_CONNECTION_STRING, TEMPLATE_QUERY)); dataFeed.setSchema(new DataFeedSchema(Arrays.asList( new DataFeedMetric().setName("cost").setDisplayName("cost"), diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackAsyncTest.java index 673671569a14..f4e7e2121fb6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackAsyncTest.java @@ -9,7 +9,6 @@ import com.azure.ai.metricsadvisor.models.ListMetricFeedbackFilter; import com.azure.ai.metricsadvisor.models.ListMetricFeedbackOptions; import com.azure.ai.metricsadvisor.models.MetricFeedback; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.test.TestBase; import com.azure.core.util.Context; @@ -69,7 +68,7 @@ void testListMetricFeedback(HttpClient httpClient, MetricsAdvisorServiceVersion List actualMetricFeedbackList = new ArrayList<>(); List expectedMetricFeedbackList = inputMetricFeedbackList.stream().map(metricFeedback -> - client.addFeeddback(METRIC_ID, metricFeedback) + client.addFeedback(METRIC_ID, metricFeedback) .block()) .collect(Collectors.toList()); @@ -161,7 +160,7 @@ void testListMetricFeedbackFilterByDimensionFilter(HttpClient httpClient, Metric // Arrange client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildAsyncClient(); creatMetricFeedbackRunner(inputMetricFeedback -> { - final MetricFeedback feedbackAdded = client.addFeeddback(METRIC_ID, inputMetricFeedback).block(); + final MetricFeedback feedbackAdded = client.addFeedback(METRIC_ID, inputMetricFeedback).block(); final OffsetDateTime firstFeedbackCreatedTime = feedbackAdded.getCreatedTime(); // Act & Assert @@ -216,7 +215,7 @@ void testListMetricFeedbackFilterStartTime(HttpClient httpClient, MetricsAdvisor // Arrange client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildAsyncClient(); creatMetricFeedbackRunner(inputMetricFeedback -> { - final MetricFeedback createdMetricFeedback = client.addFeeddback(METRIC_ID, inputMetricFeedback).block(); + final MetricFeedback createdMetricFeedback = client.addFeedback(METRIC_ID, inputMetricFeedback).block(); // Act & Assert StepVerifier.create(client.listFeedback(METRIC_ID, @@ -276,7 +275,7 @@ public void getMetricFeedbackValidId(HttpClient httpClient, MetricsAdvisorServic creatMetricFeedbackRunner(expectedMetricFeedback -> { // Act & Assert MetricFeedback createdMetricFeedback - = client.addFeeddback(METRIC_ID, expectedMetricFeedback).block(); + = client.addFeedback(METRIC_ID, expectedMetricFeedback).block(); // Act & Assert StepVerifier.create(client.getFeedbackWithResponse(createdMetricFeedback.getId())) .assertNext(metricFeedbackResponse -> { @@ -300,7 +299,7 @@ public void createCommentMetricFeedback(HttpClient httpClient, MetricsAdvisorSer creatMetricFeedbackRunner(expectedMetricFeedback -> // Act & Assert - StepVerifier.create(client.addFeeddback(METRIC_ID, expectedMetricFeedback)) + StepVerifier.create(client.addFeedback(METRIC_ID, expectedMetricFeedback)) .assertNext(createdMetricFeedback -> validateMetricFeedbackResult(expectedMetricFeedback, createdMetricFeedback, COMMENT)) .verifyComplete(), COMMENT); @@ -317,7 +316,7 @@ public void createAnomalyFeedback(HttpClient httpClient, MetricsAdvisorServiceVe creatMetricFeedbackRunner(expectedMetricFeedback -> // Act & Assert - StepVerifier.create(client.addFeeddback(METRIC_ID, expectedMetricFeedback)) + StepVerifier.create(client.addFeedback(METRIC_ID, expectedMetricFeedback)) .assertNext(createdMetricFeedback -> validateMetricFeedbackResult(expectedMetricFeedback, createdMetricFeedback, ANOMALY)) .verifyComplete(), ANOMALY); @@ -334,7 +333,7 @@ public void createPeriodMetricFeedback(HttpClient httpClient, MetricsAdvisorServ creatMetricFeedbackRunner(expectedMetricFeedback -> // Act & Assert - StepVerifier.create(client.addFeeddback(METRIC_ID, expectedMetricFeedback)) + StepVerifier.create(client.addFeedback(METRIC_ID, expectedMetricFeedback)) .assertNext(createdMetricFeedback -> validateMetricFeedbackResult(expectedMetricFeedback, createdMetricFeedback, PERIOD)) .verifyComplete(), PERIOD); @@ -350,7 +349,7 @@ public void createChangePointMetricFeedback(HttpClient httpClient, MetricsAdviso client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildAsyncClient(); creatMetricFeedbackRunner(expectedMetricFeedback -> // Act & Assert - StepVerifier.create(client.addFeeddback(METRIC_ID, expectedMetricFeedback)) + StepVerifier.create(client.addFeedback(METRIC_ID, expectedMetricFeedback)) .assertNext(createdMetricFeedback -> validateMetricFeedbackResult(expectedMetricFeedback, createdMetricFeedback, CHANGE_POINT)) .verifyComplete(), CHANGE_POINT); } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTest.java index 3b43f04cf857..c451a4adb6d7 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTest.java @@ -9,7 +9,6 @@ import com.azure.ai.metricsadvisor.models.ListMetricFeedbackFilter; import com.azure.ai.metricsadvisor.models.ListMetricFeedbackOptions; import com.azure.ai.metricsadvisor.models.MetricFeedback; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTestBase.java index a43b65d2376f..797f34149670 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTestBase.java @@ -12,7 +12,6 @@ import com.azure.ai.metricsadvisor.models.MetricCommentFeedback; import com.azure.ai.metricsadvisor.models.MetricFeedback; import com.azure.ai.metricsadvisor.models.MetricPeriodFeedback; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.ai.metricsadvisor.models.PeriodType; import com.azure.core.http.HttpClient; import com.azure.core.util.Configuration; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentDetectedTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentDetectedTestBase.java index 6f0debd65512..81cc245a4a52 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentDetectedTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentDetectedTestBase.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.models.AnomalyIncident; import com.azure.ai.metricsadvisor.models.ListIncidentsDetectedOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentForAlertTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentForAlertTestBase.java index 7e081c958b46..570e65fd487b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentForAlertTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/IncidentForAlertTestBase.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.models.AnomalyIncident; import com.azure.ai.metricsadvisor.models.ListIncidentsAlertedOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataAsyncTest.java index 18f34981fba3..0776693b1a45 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataAsyncTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.MetricEnrichedSeriesData; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; import com.azure.core.test.TestBase; @@ -40,8 +39,9 @@ public void getEnrichedSeriesData(HttpClient httpClient, MetricsAdvisorServiceVe MetricsAdvisorAsyncClient client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildAsyncClient(); PagedFlux enrichedDataFlux - = client.listMetricEnrichedSeriesData(GetEnrichedSeriesDataInput.INSTANCE.getSeriesKeys(), + = client.listMetricEnrichedSeriesData( GetEnrichedSeriesDataInput.INSTANCE.detectionConfigurationId, + GetEnrichedSeriesDataInput.INSTANCE.getSeriesKeys(), GetEnrichedSeriesDataInput.INSTANCE.startTime, GetEnrichedSeriesDataInput.INSTANCE.endTime); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTest.java index ff2817d7164b..bdb875d8c818 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTest.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.MetricEnrichedSeriesData; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.test.TestBase; @@ -42,8 +41,9 @@ public void getEnrichedSeriesData(HttpClient httpClient, MetricsAdvisorServiceVe MetricsAdvisorClient client = getMetricsAdvisorBuilder(httpClient, serviceVersion).buildClient(); PagedIterable enrichedDataIterable - = client.listMetricEnrichedSeriesData(GetEnrichedSeriesDataInput.INSTANCE.getSeriesKeys(), + = client.listMetricEnrichedSeriesData( GetEnrichedSeriesDataInput.INSTANCE.detectionConfigurationId, + GetEnrichedSeriesDataInput.INSTANCE.getSeriesKeys(), GetEnrichedSeriesDataInput.INSTANCE.startTime, GetEnrichedSeriesDataInput.INSTANCE.endTime); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTestBase.java index c1471723accf..e2d033356ba9 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTestBase.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.models.DimensionKey; import com.azure.ai.metricsadvisor.models.MetricEnrichedSeriesData; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.Assertions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdminClientBuilderTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdminClientBuilderTest.java index 29fc0c5dc06b..522ea50475f7 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdminClientBuilderTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdminClientBuilderTest.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClientBuilder; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.FixedDelay; import com.azure.core.http.policy.HttpLogDetailLevel; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java index 737ffb7c227a..423f977924e1 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClientBuilder; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; @@ -24,6 +23,12 @@ protected void beforeTest() { MetricsAdvisorAdministrationClientBuilder getMetricsAdvisorAdministrationBuilder(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { + return getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, false); + } + + MetricsAdvisorAdministrationClientBuilder getMetricsAdvisorAdministrationBuilder(HttpClient httpClient, + MetricsAdvisorServiceVersion serviceVersion, + boolean useKeyCredential) { MetricsAdvisorAdministrationClientBuilder builder = new MetricsAdvisorAdministrationClientBuilder() .endpoint(getEndpoint()) .httpClient(httpClient == null ? interceptorManager.getPlaybackClient() : httpClient) @@ -34,7 +39,13 @@ MetricsAdvisorAdministrationClientBuilder getMetricsAdvisorAdministrationBuilder if (getTestMode() == TestMode.PLAYBACK) { builder.credential(new MetricsAdvisorKeyCredential("subscription_key", "api_key")); } else { - builder.credential(new DefaultAzureCredentialBuilder().build()); + if (useKeyCredential) { + builder.credential(new MetricsAdvisorKeyCredential( + Configuration.getGlobalConfiguration().get("AZURE_METRICS_ADVISOR_SUBSCRIPTION_KEY"), + Configuration.getGlobalConfiguration().get("AZURE_METRICS_ADVISOR_API_KEY"))); + } else { + builder.credential(new DefaultAzureCredentialBuilder().build()); + } } return builder; } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilderTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilderTest.java index ba4422553e5e..5701fda0c099 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilderTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientBuilderTest.java @@ -5,7 +5,6 @@ import com.azure.ai.metricsadvisor.models.ListMetricFeedbackOptions; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.FixedDelay; import com.azure.core.http.policy.HttpLogDetailLevel; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java index 87927f0d9124..20e6ecce6723 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java @@ -4,7 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesAsyncTest.java index 9b2d8e62fd76..8c29273badae 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesAsyncTest.java @@ -8,7 +8,6 @@ import com.azure.ai.metricsadvisor.models.ListMetricDimensionValuesOptions; import com.azure.ai.metricsadvisor.models.ListMetricSeriesDefinitionOptions; import com.azure.ai.metricsadvisor.models.MetricSeriesDefinition; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesTest.java index b2dc2c001152..f90fc4cbf9a6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesTest.java @@ -8,7 +8,6 @@ import com.azure.ai.metricsadvisor.models.ListMetricDimensionValuesOptions; import com.azure.ai.metricsadvisor.models.ListMetricSeriesDefinitionOptions; import com.azure.ai.metricsadvisor.models.MetricSeriesDefinition; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; import com.azure.core.http.HttpClient; import com.azure.core.util.Context; import org.junit.jupiter.api.AfterAll; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookAsyncTest.java index 964702a1fee5..5d37ad9e2c85 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookAsyncTest.java @@ -4,9 +4,8 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; -import com.azure.ai.metricsadvisor.models.NotificationHook; -import com.azure.ai.metricsadvisor.models.ListHookOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.ListHookOptions; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedResponse; import com.azure.core.test.TestBase; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTest.java index f50ef0f9fe29..78add9251e18 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTest.java @@ -4,9 +4,8 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; -import com.azure.ai.metricsadvisor.models.NotificationHook; -import com.azure.ai.metricsadvisor.models.ListHookOptions; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.ListHookOptions; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedResponse; import com.azure.core.util.Context; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTestBase.java index 51cfb693b37e..ad2a19f7407f 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTestBase.java @@ -3,10 +3,9 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.EmailNotificationHook; -import com.azure.ai.metricsadvisor.models.NotificationHook; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; -import com.azure.ai.metricsadvisor.models.WebNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.EmailNotificationHook; +import com.azure.ai.metricsadvisor.administration.models.NotificationHook; +import com.azure.ai.metricsadvisor.administration.models.WebNotificationHook; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpHeaders; import com.azure.core.http.rest.PagedResponse; diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/TestUtils.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/TestUtils.java index 0b6d510868b0..8ac83099adf8 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/TestUtils.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/TestUtils.java @@ -3,16 +3,15 @@ package com.azure.ai.metricsadvisor; -import com.azure.ai.metricsadvisor.models.AzureBlobDataFeedSource; -import com.azure.ai.metricsadvisor.models.DataFeed; -import com.azure.ai.metricsadvisor.models.DataFeedDimension; -import com.azure.ai.metricsadvisor.models.DataFeedGranularity; -import com.azure.ai.metricsadvisor.models.DataFeedGranularityType; -import com.azure.ai.metricsadvisor.models.DataFeedIngestionSettings; -import com.azure.ai.metricsadvisor.models.DataFeedMetric; -import com.azure.ai.metricsadvisor.models.DataFeedSchema; -import com.azure.ai.metricsadvisor.models.MetricsAdvisorServiceVersion; -import com.azure.ai.metricsadvisor.models.SQLServerDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.AzureBlobDataFeedSource; +import com.azure.ai.metricsadvisor.administration.models.DataFeed; +import com.azure.ai.metricsadvisor.administration.models.DataFeedDimension; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularity; +import com.azure.ai.metricsadvisor.administration.models.DataFeedGranularityType; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionSettings; +import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; +import com.azure.ai.metricsadvisor.administration.models.DataFeedSchema; +import com.azure.ai.metricsadvisor.administration.models.SqlServerDataFeedSource; import com.azure.core.http.HttpClient; import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; @@ -53,6 +52,8 @@ public final class TestUtils { + "let endtime=starttime + gran; requests | where timestamp >= starttime and timestamp < endtime " + "| summarize request_count = count(), duration_avg_ms = avg(duration), duration_95th_ms = percentile" + "(duration, 95), duration_max_ms = max(duration) by resultCode"; + static final String LOG_ANALYTICS_QUERY = "where StartTime >=datetime(@StartTime) and EndTime =datetime(@StartTime) and EndTime =datetime(@StartTime) and EndTime = StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"Basic\"}", + "Date" : "Wed, 02 Jun 2021 00:26:06 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "9efbfdee-c6ac-48d8-8736-0b027436891d", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "be63dad3-34bb-486c-bd80-36179f6be4f2", + "content-length" : "1343", + "x-envoy-upstream-service-time" : "6028", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "be63dad3-34bb-486c-bd80-36179f6be4f2", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"cd8a939e-95e9-4c09-8c54-f7cf0057b7ea\",\"dataFeedName\":\"java_create_data_feed_test_sample58e92a8c-313b-46b3-8a17-87026ff74d0d\",\"metrics\":[{\"metricId\":\"377ddcf3-d780-4873-8eda-f232f877070c\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3b089a71-8427-4bb5-ad0c-a84872834026\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:26:05Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:26:12 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "e2494194-91bc-45f2-b7a2-493fcb7dd6cd" + }, + "Response" : { + "x-request-id" : "44897a47-805c-42be-9c52-443ca323e0d0", + "content-length" : "1343", + "x-envoy-upstream-service-time" : "305", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "44897a47-805c-42be-9c52-443ca323e0d0", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"cd8a939e-95e9-4c09-8c54-f7cf0057b7ea\",\"dataFeedName\":\"java_create_data_feed_test_sample58e92a8c-313b-46b3-8a17-87026ff74d0d\",\"metrics\":[{\"metricId\":\"377ddcf3-d780-4873-8eda-f232f877070c\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3b089a71-8427-4bb5-ad0c-a84872834026\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:26:05Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:26:12 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "62a6d8e1-c029-4eb6-bb70-f8e80a359d8e", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "7878489d-7966-46fc-b612-07a460458d19", + "content-length" : "0", + "x-envoy-upstream-service-time" : "481", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "7878489d-7966-46fc-b612-07a460458d19", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:26:13 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/eca55e2d-7a27-45aa-946e-811242d1e389" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/eca55e2d-7a27-45aa-946e-811242d1e389", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3a768649-51e4-4000-a688-37d89eb5b170" + }, + "Response" : { + "x-request-id" : "bb547261-6a5c-4217-98c4-2eeb7023741e", + "content-length" : "360", + "x-envoy-upstream-service-time" : "109", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "bb547261-6a5c-4217-98c4-2eeb7023741e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"eca55e2d-7a27-45aa-946e-811242d1e389\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sp48fd712e-3a7e-498f-9e58-480d4c582cbb\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Wed, 02 Jun 2021 00:26:13 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "11d8932a-db25-4938-9324-18e299b7a901", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "a92597a0-a702-4ba9-b1b7-ba0112ddf029", + "content-length" : "1398", + "x-envoy-upstream-service-time" : "997", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a92597a0-a702-4ba9-b1b7-ba0112ddf029", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"cd8a939e-95e9-4c09-8c54-f7cf0057b7ea\",\"dataFeedName\":\"java_create_data_feed_test_sample58e92a8c-313b-46b3-8a17-87026ff74d0d\",\"metrics\":[{\"metricId\":\"377ddcf3-d780-4873-8eda-f232f877070c\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3b089a71-8427-4bb5-ad0c-a84872834026\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:26:05Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"eca55e2d-7a27-45aa-946e-811242d1e389\"}", + "Date" : "Wed, 02 Jun 2021 00:26:14 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "4eaa4eb8-bbf0-4066-b75e-fce24147f17e" + }, + "Response" : { + "x-request-id" : "362bbdfe-ea9b-4fc3-93a6-269eefb22173", + "content-length" : "1398", + "x-envoy-upstream-service-time" : "279", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "362bbdfe-ea9b-4fc3-93a6-269eefb22173", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"cd8a939e-95e9-4c09-8c54-f7cf0057b7ea\",\"dataFeedName\":\"java_create_data_feed_test_sample58e92a8c-313b-46b3-8a17-87026ff74d0d\",\"metrics\":[{\"metricId\":\"377ddcf3-d780-4873-8eda-f232f877070c\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3b089a71-8427-4bb5-ad0c-a84872834026\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:26:05Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"eca55e2d-7a27-45aa-946e-811242d1e389\"}", + "Date" : "Wed, 02 Jun 2021 00:26:14 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "d7bec7bf-a23f-46d6-bb66-7e6390332c4f", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "603bbdce-94be-4a17-bd74-314d31c9d0d1", + "content-length" : "0", + "x-envoy-upstream-service-time" : "520", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "603bbdce-94be-4a17-bd74-314d31c9d0d1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:26:15 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/aab1c72f-bac0-4bb6-8070-94523697a53d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/aab1c72f-bac0-4bb6-8070-94523697a53d", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f433351c-c69c-42fe-9e31-38ee1f626fa0" + }, + "Response" : { + "x-request-id" : "302bbb74-9e1a-4922-a880-9f771913e481", + "content-length" : "549", + "x-envoy-upstream-service-time" : "160", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "302bbb74-9e1a-4922-a880-9f771913e481", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"aab1c72f-bac0-4bb6-8070-94523697a53d\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkvc5272a80-ceb6-48f4-bf4f-aed7fa9f4243\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://8a4545f4-9116-472d-ada8-8378174a8b04.vault.azure.net\"}}", + "Date" : "Wed, 02 Jun 2021 00:26:15 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3e2bfbcb-a336-4f46-a163-0523ebfb13c1", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "5c813f64-89e0-495d-92ea-cdf2adf50abd", + "content-length" : "1402", + "x-envoy-upstream-service-time" : "6083", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5c813f64-89e0-495d-92ea-cdf2adf50abd", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"cd8a939e-95e9-4c09-8c54-f7cf0057b7ea\",\"dataFeedName\":\"java_create_data_feed_test_sample58e92a8c-313b-46b3-8a17-87026ff74d0d\",\"metrics\":[{\"metricId\":\"377ddcf3-d780-4873-8eda-f232f877070c\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3b089a71-8427-4bb5-ad0c-a84872834026\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:26:05Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"aab1c72f-bac0-4bb6-8070-94523697a53d\"}", + "Date" : "Wed, 02 Jun 2021 00:26:21 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "ebd857ff-3885-445c-957e-5bfc75433806" + }, + "Response" : { + "x-request-id" : "3a2607c5-9094-4e1d-92a4-561e2dfcb525", + "content-length" : "1402", + "x-envoy-upstream-service-time" : "210", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "3a2607c5-9094-4e1d-92a4-561e2dfcb525", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"cd8a939e-95e9-4c09-8c54-f7cf0057b7ea\",\"dataFeedName\":\"java_create_data_feed_test_sample58e92a8c-313b-46b3-8a17-87026ff74d0d\",\"metrics\":[{\"metricId\":\"377ddcf3-d780-4873-8eda-f232f877070c\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3b089a71-8427-4bb5-ad0c-a84872834026\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:26:05Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"aab1c72f-bac0-4bb6-8070-94523697a53d\"}", + "Date" : "Wed, 02 Jun 2021 00:26:22 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/cd8a939e-95e9-4c09-8c54-f7cf0057b7ea", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "280afee4-46e4-409b-bbc8-21e08489a5d2" + }, + "Response" : { + "x-request-id" : "9daaba1a-e604-442b-ab6f-7870b212bf10", + "content-length" : "0", + "x-envoy-upstream-service-time" : "596", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "9daaba1a-e604-442b-ab6f-7870b212bf10", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:26:22 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/eca55e2d-7a27-45aa-946e-811242d1e389", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "b878d541-2d0f-49e0-881c-cc628d7fda2b" + }, + "Response" : { + "x-request-id" : "14618c0b-7684-4dca-bb45-9af34182a1dd", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5251", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "14618c0b-7684-4dca-bb45-9af34182a1dd", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:26:28 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/aab1c72f-bac0-4bb6-8070-94523697a53d", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "30478a7f-ccaf-47c9-a33c-833506770ddd" + }, + "Response" : { + "x-request-id" : "bc6cc3cd-93c2-4e65-96fa-edb90b46f630", + "content-length" : "0", + "x-envoy-upstream-service-time" : "221", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "bc6cc3cd-93c2-4e65-96fa-edb90b46f630", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:26:28 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testDataLakeGen2[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testDataLakeGen2[1].json new file mode 100644 index 000000000000..aba2659b64db --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testDataLakeGen2[1].json @@ -0,0 +1,377 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "44e29844-5869-4512-892c-982d6f884956", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "f23a07ed-cfbc-4ea9-b82f-2ca592aac035", + "content-length" : "0", + "x-envoy-upstream-service-time" : "6103", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "f23a07ed-cfbc-4ea9-b82f-2ca592aac035", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:49:14 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8ad780f6-64b6-4a70-868f-e87bc75870fc" + }, + "Response" : { + "x-request-id" : "e70c56bf-3cef-47f5-aa82-7bc50573f3df", + "content-length" : "1308", + "x-envoy-upstream-service-time" : "197", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e70c56bf-3cef-47f5-aa82-7bc50573f3df", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"Basic\"}", + "Date" : "Tue, 01 Jun 2021 23:49:15 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "ede5bfb3-6922-49bf-9b01-42d0ed4f9c9a", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "d5c83269-629b-4372-a17d-56aa0157a3b2", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5553", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "d5c83269-629b-4372-a17d-56aa0157a3b2", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:49:20 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/21293813-1e8b-465d-902a-22cad62fb666" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/21293813-1e8b-465d-902a-22cad62fb666", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "4a781f13-fb1e-416a-973c-6610373d77c1" + }, + "Response" : { + "x-request-id" : "86291a63-e7f5-40f4-b554-09af57c19aba", + "content-length" : "273", + "x-envoy-upstream-service-time" : "231", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "86291a63-e7f5-40f4-b554-09af57c19aba", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"21293813-1e8b-465d-902a-22cad62fb666\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen3247933c-f37e-402f-a744-9a6e9e9448e5\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}}", + "Date" : "Tue, 01 Jun 2021 23:49:21 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3547a02b-6399-4dcd-9dea-1ac65e6e33ec", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "69a26805-b928-4b66-81e5-20f695998164", + "content-length" : "1378", + "x-envoy-upstream-service-time" : "6101", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "69a26805-b928-4b66-81e5-20f695998164", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"DataLakeGen2SharedKey\",\"credentialId\":\"21293813-1e8b-465d-902a-22cad62fb666\"}", + "Date" : "Tue, 01 Jun 2021 23:49:26 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "803196b2-2d46-4ab1-9bad-166c8f8b08bc" + }, + "Response" : { + "x-request-id" : "efb06d36-e0b7-4392-b4e3-b95c51f2efec", + "content-length" : "1378", + "x-envoy-upstream-service-time" : "5221", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "efb06d36-e0b7-4392-b4e3-b95c51f2efec", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"DataLakeGen2SharedKey\",\"credentialId\":\"21293813-1e8b-465d-902a-22cad62fb666\"}", + "Date" : "Tue, 01 Jun 2021 23:49:32 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "afe976c1-d6f5-4645-b21c-e1c9e1c9e15a", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "71f3039a-5ec6-4ec2-af5c-88eecb8f9fec", + "content-length" : "0", + "x-envoy-upstream-service-time" : "626", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "71f3039a-5ec6-4ec2-af5c-88eecb8f9fec", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:49:34 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/75b9a2e1-ce8e-48c8-9f60-630eb3d24526" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/75b9a2e1-ce8e-48c8-9f60-630eb3d24526", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "93a2e10e-a39e-4ac2-9226-6e1dc489897f" + }, + "Response" : { + "x-request-id" : "4930cf9e-44f4-4eab-bb20-573b786975d4", + "content-length" : "360", + "x-envoy-upstream-service-time" : "140", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "4930cf9e-44f4-4eab-bb20-573b786975d4", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"75b9a2e1-ce8e-48c8-9f60-630eb3d24526\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sp14fb519b-bf6b-4217-b7f8-33d44b805732\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Tue, 01 Jun 2021 23:49:34 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "206defde-35f9-49bf-af73-7d3652331de6", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "22f93323-e442-43b4-b89b-4aeaa0dbe95b", + "content-length" : "1373", + "x-envoy-upstream-service-time" : "1051", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "22f93323-e442-43b4-b89b-4aeaa0dbe95b", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"75b9a2e1-ce8e-48c8-9f60-630eb3d24526\"}", + "Date" : "Tue, 01 Jun 2021 23:49:35 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "dfe6e9b0-c584-4c57-a3ec-badf9d0fb27b" + }, + "Response" : { + "x-request-id" : "b2ca16bb-99ce-4c5d-9c1d-954980de509b", + "content-length" : "1373", + "x-envoy-upstream-service-time" : "5187", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "b2ca16bb-99ce-4c5d-9c1d-954980de509b", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"75b9a2e1-ce8e-48c8-9f60-630eb3d24526\"}", + "Date" : "Tue, 01 Jun 2021 23:49:40 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "6305d126-26c7-4f7c-93ef-eba8fb461dab", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "3e043d3d-3149-437a-b257-befd98a5da77", + "content-length" : "0", + "x-envoy-upstream-service-time" : "508", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "3e043d3d-3149-437a-b257-befd98a5da77", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:49:40 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d2ecd9a7-a9ad-462b-9127-fff7b5091f7c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d2ecd9a7-a9ad-462b-9127-fff7b5091f7c", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "4b0615b9-f4c0-4f8e-a25b-9d69f7bf9a70" + }, + "Response" : { + "x-request-id" : "e8caf50b-29ac-4fc9-8ecb-57a2e8a6a9dd", + "content-length" : "549", + "x-envoy-upstream-service-time" : "5104", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e8caf50b-29ac-4fc9-8ecb-57a2e8a6a9dd", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"d2ecd9a7-a9ad-462b-9127-fff7b5091f7c\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkve895021d-25e4-494f-a407-380002e86039\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://75f7dcec-8b91-480d-96f3-de77dc5f7e18.vault.azure.net\"}}", + "Date" : "Tue, 01 Jun 2021 23:49:46 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "21f4b55d-7122-400a-88ed-4e2a1ed70673", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "de4701c9-1b55-4340-b34a-1ee043550146", + "content-length" : "1377", + "x-envoy-upstream-service-time" : "1153", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "de4701c9-1b55-4340-b34a-1ee043550146", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"d2ecd9a7-a9ad-462b-9127-fff7b5091f7c\"}", + "Date" : "Tue, 01 Jun 2021 23:49:47 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8eaeabe9-762e-474a-8016-bfcaf83b287f" + }, + "Response" : { + "x-request-id" : "644e764e-95ae-434f-ba31-1c2ed55a16b0", + "content-length" : "1377", + "x-envoy-upstream-service-time" : "5239", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "644e764e-95ae-434f-ba31-1c2ed55a16b0", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"28761019-b879-48f3-9384-a979c12e7548\",\"dataFeedName\":\"java_create_data_feed_test_samplea6fa6e7a-5a57-447b-b9c6-b092711b8b00\",\"metrics\":[{\"metricId\":\"0fe9382a-0349-4a8e-97f5-c3f8d7820c4e\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"1afc9aee-39a5-47e8-96a4-aca99bc903df\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:49:14Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"d2ecd9a7-a9ad-462b-9127-fff7b5091f7c\"}", + "Date" : "Tue, 01 Jun 2021 23:49:52 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/28761019-b879-48f3-9384-a979c12e7548", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "507b1092-53a6-462c-a583-9def1f4439f5" + }, + "Response" : { + "x-request-id" : "561d07a2-db4a-4e1b-ba70-401267394ceb", + "content-length" : "0", + "x-envoy-upstream-service-time" : "398", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "561d07a2-db4a-4e1b-ba70-401267394ceb", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:49:53 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/21293813-1e8b-465d-902a-22cad62fb666", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "056245e0-d817-46ff-a19c-aec71680f76c" + }, + "Response" : { + "x-request-id" : "50cc2465-3305-4b05-bcf3-8cccc6ccd341", + "content-length" : "0", + "x-envoy-upstream-service-time" : "194", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "50cc2465-3305-4b05-bcf3-8cccc6ccd341", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:49:53 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/75b9a2e1-ce8e-48c8-9f60-630eb3d24526", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "63e8c848-4a87-463e-8d8e-ff4d0998dd19" + }, + "Response" : { + "x-request-id" : "2edb1fe8-b04d-4886-9071-bd11610dc7d3", + "content-length" : "0", + "x-envoy-upstream-service-time" : "200", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "2edb1fe8-b04d-4886-9071-bd11610dc7d3", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:49:53 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d2ecd9a7-a9ad-462b-9127-fff7b5091f7c", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "226013c3-9009-4dd0-9997-19d64ec48e09" + }, + "Response" : { + "x-request-id" : "9ab88bcf-746b-427e-b4fb-c64d6e338082", + "content-length" : "0", + "x-envoy-upstream-service-time" : "255", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "9ab88bcf-746b-427e-b4fb-c64d6e338082", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:49:53 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testSqlServer[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testSqlServer[1].json new file mode 100644 index 000000000000..3bf3b4d825b9 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsAsyncTest.testSqlServer[1].json @@ -0,0 +1,420 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "51a364ea-f3e6-4c58-b979-46c1cfda8991", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "0feb8833-81a2-49ba-aa91-d87597aeec49", + "content-length" : "0", + "x-envoy-upstream-service-time" : "6154", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "0feb8833-81a2-49ba-aa91-d87597aeec49", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:42:28 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "63141deb-95fc-47b3-bdbc-4bc3459b38f3" + }, + "Response" : { + "x-request-id" : "a2118327-a2ad-4ba1-8e0f-8601cb2cc7a9", + "content-length" : "1229", + "x-envoy-upstream-service-time" : "206", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a2118327-a2ad-4ba1-8e0f-8601cb2cc7a9", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"Basic\"}", + "Date" : "Tue, 01 Jun 2021 23:42:28 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8e0dded2-e5d9-446e-913c-c705f3267bfc", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "884853f3-a49d-4f4a-b047-3ec36a7fe930", + "content-length" : "1239", + "x-envoy-upstream-service-time" : "6237", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "884853f3-a49d-4f4a-b047-3ec36a7fe930", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Tue, 01 Jun 2021 23:42:35 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "bacff21a-3c69-4e2c-a89b-cb71ab51caa1" + }, + "Response" : { + "x-request-id" : "5ee836c6-cc03-4ce4-8aa2-f170e3d2b5c3", + "content-length" : "1239", + "x-envoy-upstream-service-time" : "5234", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5ee836c6-cc03-4ce4-8aa2-f170e3d2b5c3", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Tue, 01 Jun 2021 23:42:40 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "00688a87-ceda-41f0-b5ab-8f15264bf818", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "5075c3aa-38f7-4407-85b2-4d1815ffb184", + "content-length" : "0", + "x-envoy-upstream-service-time" : "617", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5075c3aa-38f7-4407-85b2-4d1815ffb184", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:42:41 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/8d5b1fe4-35da-47f0-90c3-70d54d4b4562" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/8d5b1fe4-35da-47f0-90c3-70d54d4b4562", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "e1973bf8-e23b-4735-b55c-66f0e7a1cdba" + }, + "Response" : { + "x-request-id" : "ed781100-2591-45b9-ab7c-cfc034e99aae", + "content-length" : "274", + "x-envoy-upstream-service-time" : "94", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "ed781100-2591-45b9-ab7c-cfc034e99aae", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"8d5b1fe4-35da-47f0-90c3-70d54d4b4562\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_conb9a54556-f179-4f89-9f84-a8d0d682aae8\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}", + "Date" : "Tue, 01 Jun 2021 23:42:41 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "beef156e-ecab-4c77-af28-1bd1e6af34e6", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "150e82a0-07ae-4027-a5ce-702fe95bfab5", + "content-length" : "1302", + "x-envoy-upstream-service-time" : "6059", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "150e82a0-07ae-4027-a5ce-702fe95bfab5", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"AzureSQLConnectionString\",\"credentialId\":\"8d5b1fe4-35da-47f0-90c3-70d54d4b4562\"}", + "Date" : "Tue, 01 Jun 2021 23:42:48 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "6623deb4-1c77-49bb-b4bd-6e12bdfc7937" + }, + "Response" : { + "x-request-id" : "e658f35c-aabf-4303-ae0c-ec4c99995b0c", + "content-length" : "1302", + "x-envoy-upstream-service-time" : "229", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e658f35c-aabf-4303-ae0c-ec4c99995b0c", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"AzureSQLConnectionString\",\"credentialId\":\"8d5b1fe4-35da-47f0-90c3-70d54d4b4562\"}", + "Date" : "Tue, 01 Jun 2021 23:42:48 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3a0e9a89-17d3-47ce-9f83-e13ada5dbece", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "b20f121d-4870-4f5e-a1b3-168b9cbd95df", + "content-length" : "0", + "x-envoy-upstream-service-time" : "612", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "b20f121d-4870-4f5e-a1b3-168b9cbd95df", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:42:48 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/22d9dd0c-d948-428b-9811-0ba9ddfcd817" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/22d9dd0c-d948-428b-9811-0ba9ddfcd817", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8f88ade2-ab13-421b-ace0-7deddc11a899" + }, + "Response" : { + "x-request-id" : "5c2d1384-b478-427a-a0f4-e723a53becd2", + "content-length" : "360", + "x-envoy-upstream-service-time" : "106", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5c2d1384-b478-427a-a0f4-e723a53becd2", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"22d9dd0c-d948-428b-9811-0ba9ddfcd817\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sp5f242df3-7853-42f6-b26a-169c32189927\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Tue, 01 Jun 2021 23:42:48 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "218d834e-db37-49a1-9ef4-165b94fb69a2", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "5b9cc807-db7f-420d-b309-4ed20580e70a", + "content-length" : "1294", + "x-envoy-upstream-service-time" : "1133", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5b9cc807-db7f-420d-b309-4ed20580e70a", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"22d9dd0c-d948-428b-9811-0ba9ddfcd817\"}", + "Date" : "Tue, 01 Jun 2021 23:42:50 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "0debb8bb-12c5-4b53-87cb-0c17f5f8bc3b" + }, + "Response" : { + "x-request-id" : "bb410b63-8e52-41df-98ef-3774f190d32d", + "content-length" : "1294", + "x-envoy-upstream-service-time" : "294", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "bb410b63-8e52-41df-98ef-3774f190d32d", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"22d9dd0c-d948-428b-9811-0ba9ddfcd817\"}", + "Date" : "Tue, 01 Jun 2021 23:42:50 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "bacb4cf1-2133-4df2-98b1-b1dda976ad84", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "7f8b4e48-acc3-4484-8f4d-e77fd8ad2e9e", + "content-length" : "0", + "x-envoy-upstream-service-time" : "549", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "7f8b4e48-acc3-4484-8f4d-e77fd8ad2e9e", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Tue, 01 Jun 2021 23:42:51 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/2184faf5-4684-47d6-ab08-a9bf84960330" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/2184faf5-4684-47d6-ab08-a9bf84960330", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8b336fc4-e7ee-4e5b-9821-05689769f4f1" + }, + "Response" : { + "x-request-id" : "ec932643-c95a-4948-93c0-66b1401f0e6a", + "content-length" : "549", + "x-envoy-upstream-service-time" : "5162", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "ec932643-c95a-4948-93c0-66b1401f0e6a", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"2184faf5-4684-47d6-ab08-a9bf84960330\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkv409b06bf-e25b-4a75-9162-c68bc39d2e48\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://3c3fb196-4817-4a3e-b1ae-fb66aec2315d.vault.azure.net\"}}", + "Date" : "Tue, 01 Jun 2021 23:42:56 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "deb9c901-8de6-44c4-a361-ac661852d755", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "d4f56b28-708d-4a9f-9d27-12fc6128bde0", + "content-length" : "1298", + "x-envoy-upstream-service-time" : "974", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "d4f56b28-708d-4a9f-9d27-12fc6128bde0", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"2184faf5-4684-47d6-ab08-a9bf84960330\"}", + "Date" : "Tue, 01 Jun 2021 23:42:57 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "9178bb18-9f89-47e0-85e4-a1182f88e1b5" + }, + "Response" : { + "x-request-id" : "fb37162b-f2f7-4f68-8fcd-c5ef8951273e", + "content-length" : "1298", + "x-envoy-upstream-service-time" : "283", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "fb37162b-f2f7-4f68-8fcd-c5ef8951273e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"f0361e6e-8234-4eb7-8a7e-366cc625d4b9\",\"dataFeedName\":\"java_create_data_feed_test_sample549648d1-7ba6-4151-8a8f-b4d06c351ebf\",\"metrics\":[{\"metricId\":\"315ba333-a229-49ef-8f8f-e7359428c1f0\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"90824c6d-2f54-4728-86c3-b4c8588bce61\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-01T23:42:28Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"2184faf5-4684-47d6-ab08-a9bf84960330\"}", + "Date" : "Tue, 01 Jun 2021 23:42:57 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0361e6e-8234-4eb7-8a7e-366cc625d4b9", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "18c9d6f9-c5ba-4b5c-8bda-19a5885ba0fd" + }, + "Response" : { + "x-request-id" : "86f818f7-609b-4c38-9596-5f3218970846", + "content-length" : "0", + "x-envoy-upstream-service-time" : "544", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "86f818f7-609b-4c38-9596-5f3218970846", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:42:58 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/8d5b1fe4-35da-47f0-90c3-70d54d4b4562", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "23d9ee10-b6af-4a8c-8fe0-5ea91d9e830e" + }, + "Response" : { + "x-request-id" : "23092eac-5e19-4085-82bc-4b8413d4dbc6", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5226", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "23092eac-5e19-4085-82bc-4b8413d4dbc6", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:43:03 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/22d9dd0c-d948-428b-9811-0ba9ddfcd817", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "b52058a7-9e9e-4640-a890-1abfb7e4ff4c" + }, + "Response" : { + "x-request-id" : "799f83d9-61b1-4e0c-87ba-d39206a4abd8", + "content-length" : "0", + "x-envoy-upstream-service-time" : "225", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "799f83d9-61b1-4e0c-87ba-d39206a4abd8", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:43:03 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/2184faf5-4684-47d6-ab08-a9bf84960330", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "b509f752-fb2e-432f-8a1a-ec6ba3a8b6ae" + }, + "Response" : { + "x-request-id" : "4a88d164-f4cd-41f2-9bfc-998bf346dfac", + "content-length" : "0", + "x-envoy-upstream-service-time" : "193", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "4a88d164-f4cd-41f2-9bfc-998bf346dfac", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 01 Jun 2021 23:43:03 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testBlobStorage[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testBlobStorage[1].json new file mode 100644 index 000000000000..2bd4d6c3605a --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testBlobStorage[1].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "c3c104d4-14fb-45cd-9b93-f6f85a477122", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "acbb9593-8167-4ea7-afbd-386d458ef1ba", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5940", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "acbb9593-8167-4ea7-afbd-386d458ef1ba", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:44 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dc2aceec-17ea-4f4c-9c09-3de176de8f4e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dc2aceec-17ea-4f4c-9c09-3de176de8f4e", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "008df2ca-6100-467e-bd16-27d30d9abe6a" + }, + "Response" : { + "x-request-id" : "f2207eb7-f2a6-4aa7-9be9-c9c9a5215567", + "content-length" : "1236", + "x-envoy-upstream-service-time" : "5199", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "f2207eb7-f2a6-4aa7-9be9-c9c9a5215567", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dc2aceec-17ea-4f4c-9c09-3de176de8f4e\",\"dataFeedName\":\"java_create_data_feed_test_sample6694b9ae-e08d-4c5d-97e6-377ea2f2118d\",\"metrics\":[{\"metricId\":\"0ce97fb3-38d4-4df5-b479-b91d116222e7\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"dd3d183e-a763-445c-a8f2-496540789e5e\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureBlob\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"container\":\"adsample\",\"blobTemplate\":\"%Y/%m/%d/%h/JsonFormatV2.json\"},\"authenticationType\":\"Basic\"}", + "Date" : "Wed, 02 Jun 2021 00:30:50 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dc2aceec-17ea-4f4c-9c09-3de176de8f4e", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3c2552ef-807e-4d89-8b44-ea31f53462a2", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "69a408f1-fcb3-4ece-b826-7eee42367f26", + "content-length" : "1246", + "x-envoy-upstream-service-time" : "1128", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "69a408f1-fcb3-4ece-b826-7eee42367f26", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dc2aceec-17ea-4f4c-9c09-3de176de8f4e\",\"dataFeedName\":\"java_create_data_feed_test_sample6694b9ae-e08d-4c5d-97e6-377ea2f2118d\",\"metrics\":[{\"metricId\":\"0ce97fb3-38d4-4df5-b479-b91d116222e7\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"dd3d183e-a763-445c-a8f2-496540789e5e\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureBlob\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"container\":\"adsample\",\"blobTemplate\":\"%Y/%m/%d/%h/JsonFormatV2.json\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:30:50 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dc2aceec-17ea-4f4c-9c09-3de176de8f4e", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "d210fb34-1a3c-4d07-b25d-74444927b4d6" + }, + "Response" : { + "x-request-id" : "a1597da5-3eaa-4bf4-9d26-acb4fd856583", + "content-length" : "1246", + "x-envoy-upstream-service-time" : "175", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a1597da5-3eaa-4bf4-9d26-acb4fd856583", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dc2aceec-17ea-4f4c-9c09-3de176de8f4e\",\"dataFeedName\":\"java_create_data_feed_test_sample6694b9ae-e08d-4c5d-97e6-377ea2f2118d\",\"metrics\":[{\"metricId\":\"0ce97fb3-38d4-4df5-b479-b91d116222e7\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"dd3d183e-a763-445c-a8f2-496540789e5e\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureBlob\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"container\":\"adsample\",\"blobTemplate\":\"%Y/%m/%d/%h/JsonFormatV2.json\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:30:51 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dc2aceec-17ea-4f4c-9c09-3de176de8f4e", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "058b9709-06eb-47e6-b144-abdb6931cad8" + }, + "Response" : { + "x-request-id" : "6aa20aff-829d-4632-a809-1f8fa074527d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "501", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "6aa20aff-829d-4632-a809-1f8fa074527d", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:30:51 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataExplorer[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataExplorer[1].json new file mode 100644 index 000000000000..091f74a09234 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataExplorer[1].json @@ -0,0 +1,316 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "42e1baea-3ef1-43e3-85ad-77c10ae09d9b", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "8cb86b30-7214-4505-b83d-56c283749e32", + "content-length" : "0", + "x-envoy-upstream-service-time" : "854", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "8cb86b30-7214-4505-b83d-56c283749e32", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:39 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "2439ca35-ceb7-4e5d-9261-7b30f0f40f9a" + }, + "Response" : { + "x-request-id" : "ae523518-82d1-40c9-affc-99f62e6c5500", + "content-length" : "1333", + "x-envoy-upstream-service-time" : "5212", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "ae523518-82d1-40c9-affc-99f62e6c5500", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"Basic\"}", + "Date" : "Wed, 02 Jun 2021 00:30:45 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "7f5e0f39-4718-4ebf-b5f2-0fa7617ca662", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "c4a2ee9b-f64e-4e86-9592-a898a94adf36", + "content-length" : "1343", + "x-envoy-upstream-service-time" : "932", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "c4a2ee9b-f64e-4e86-9592-a898a94adf36", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:30:46 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8fe5a4f2-0f20-4d7c-8255-b5c6a2f94f83" + }, + "Response" : { + "x-request-id" : "e64f4781-931f-4f9f-bcd9-4707840cfd47", + "content-length" : "1343", + "x-envoy-upstream-service-time" : "5208", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e64f4781-931f-4f9f-bcd9-4707840cfd47", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:30:51 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "49e71574-1a44-4644-bfda-13b356c8996b", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "a5980737-0ee9-46dc-abbb-6262bfa2580d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "351", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a5980737-0ee9-46dc-abbb-6262bfa2580d", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:51 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/fbe58c18-af15-4ccb-b7a7-eddb43d1c8b3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/fbe58c18-af15-4ccb-b7a7-eddb43d1c8b3", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "b773e1a6-24a8-4652-98a3-54412c869801" + }, + "Response" : { + "x-request-id" : "c2d87564-3b1e-4543-8bf0-4cd82f0e108d", + "content-length" : "360", + "x-envoy-upstream-service-time" : "143", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "c2d87564-3b1e-4543-8bf0-4cd82f0e108d", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"fbe58c18-af15-4ccb-b7a7-eddb43d1c8b3\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spcf14e3fb-4f4b-4d55-847a-bcb62c501316\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Wed, 02 Jun 2021 00:30:52 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "a0e1915e-6b81-44ea-ba0c-90a18d099ea1", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "9a52c6bd-967a-4948-983a-f79d6c1f2870", + "content-length" : "1398", + "x-envoy-upstream-service-time" : "1026", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "9a52c6bd-967a-4948-983a-f79d6c1f2870", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"fbe58c18-af15-4ccb-b7a7-eddb43d1c8b3\"}", + "Date" : "Wed, 02 Jun 2021 00:30:52 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "90fbf847-63ce-4fea-badc-c175062195ca" + }, + "Response" : { + "x-request-id" : "f7c912e3-b846-405c-981e-8eed8bb0ac2b", + "content-length" : "1398", + "x-envoy-upstream-service-time" : "5220", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "f7c912e3-b846-405c-981e-8eed8bb0ac2b", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"fbe58c18-af15-4ccb-b7a7-eddb43d1c8b3\"}", + "Date" : "Wed, 02 Jun 2021 00:30:58 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "21659838-d2d2-437e-800a-380533f6d51c", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "9712f494-5332-48fb-b644-bb3822d8ba55", + "content-length" : "0", + "x-envoy-upstream-service-time" : "324", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "9712f494-5332-48fb-b644-bb3822d8ba55", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:59 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d2ec3254-6e15-4862-a228-b22502ab2bc1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d2ec3254-6e15-4862-a228-b22502ab2bc1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "cf18c03a-dda5-4415-a079-378157e93112" + }, + "Response" : { + "x-request-id" : "8ae339d3-f4ac-4422-a5f9-762a276ad352", + "content-length" : "549", + "x-envoy-upstream-service-time" : "79", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "8ae339d3-f4ac-4422-a5f9-762a276ad352", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"d2ec3254-6e15-4862-a228-b22502ab2bc1\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkv7731d8ac-bc24-4e63-acae-f5873daaa994\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://0c999727-775b-4eac-9dad-543217d615ca.vault.azure.net\"}}", + "Date" : "Wed, 02 Jun 2021 00:30:58 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "83e8b7d6-d176-4581-aa23-f6f9393ee406", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "b96e7ac6-ba25-4edf-bce8-7a0ea496d01f", + "content-length" : "1402", + "x-envoy-upstream-service-time" : "950", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "b96e7ac6-ba25-4edf-bce8-7a0ea496d01f", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"d2ec3254-6e15-4862-a228-b22502ab2bc1\"}", + "Date" : "Wed, 02 Jun 2021 00:30:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "473b9f6e-757a-45e3-b8a4-5d84dfb9a70e" + }, + "Response" : { + "x-request-id" : "cc86aceb-b746-4cab-a5b3-699afe1d5b3e", + "content-length" : "1402", + "x-envoy-upstream-service-time" : "175", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "cc86aceb-b746-4cab-a5b3-699afe1d5b3e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"986abb54-0ff2-4382-993a-c439c36aedda\",\"dataFeedName\":\"java_create_data_feed_test_sample99b2d1f8-0708-45ab-8ad3-5a2f9b3a782d\",\"metrics\":[{\"metricId\":\"19572902-49ff-4d75-b121-bbeb6a5d669f\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"0c7fa807-44ee-4827-adee-4681d5daa730\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataExplorer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:39Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"let StartDateTime = datetime(@StartTime);let EndDateTime = StartDateTime + 1d;adsample| where Timestamp >= StartDateTime and Timestamp < EndDateTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"d2ec3254-6e15-4862-a228-b22502ab2bc1\"}", + "Date" : "Wed, 02 Jun 2021 00:31:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/986abb54-0ff2-4382-993a-c439c36aedda", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f20f750f-0e67-477c-969a-272e4ac266ee" + }, + "Response" : { + "x-request-id" : "4020ac57-28eb-4325-9b14-4813b9e77d6f", + "content-length" : "0", + "x-envoy-upstream-service-time" : "430", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "4020ac57-28eb-4325-9b14-4813b9e77d6f", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:00 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/fbe58c18-af15-4ccb-b7a7-eddb43d1c8b3", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "16a3b181-08f2-4595-9d0f-178c17a5b6b9" + }, + "Response" : { + "x-request-id" : "fd8a3b22-763b-4ca2-9a9f-9177febe1dd6", + "content-length" : "0", + "x-envoy-upstream-service-time" : "70", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "fd8a3b22-763b-4ca2-9a9f-9177febe1dd6", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:00 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/d2ec3254-6e15-4862-a228-b22502ab2bc1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f1073a58-cc01-45ae-af80-ea7a2ef704d9" + }, + "Response" : { + "x-request-id" : "cfb9bf8c-16a2-4ca8-958c-90ec70e199a3", + "content-length" : "0", + "x-envoy-upstream-service-time" : "71", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "cfb9bf8c-16a2-4ca8-958c-90ec70e199a3", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:00 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataLakeGen2[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataLakeGen2[1].json new file mode 100644 index 000000000000..42bb16610f87 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testDataLakeGen2[1].json @@ -0,0 +1,377 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "198ec31c-c9cc-4ceb-bdeb-bcf60be6e205", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "1302a066-6646-4466-8a51-c11ee8fc313d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "960", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "1302a066-6646-4466-8a51-c11ee8fc313d", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:33:37 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "fcd7f6e9-8e89-4e80-a14b-3e7914391760" + }, + "Response" : { + "x-request-id" : "55bc615a-3f96-4aea-9be8-ecc850e380a5", + "content-length" : "1308", + "x-envoy-upstream-service-time" : "262", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "55bc615a-3f96-4aea-9be8-ecc850e380a5", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"Basic\"}", + "Date" : "Wed, 02 Jun 2021 00:33:38 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "fc471b73-2965-456b-b7a6-e45ac8e42100", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "90536e4d-bbab-49be-8854-7537c4ee578b", + "content-length" : "0", + "x-envoy-upstream-service-time" : "390", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "90536e4d-bbab-49be-8854-7537c4ee578b", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:33:38 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/11cfc127-e774-40cf-b1f3-ec406842322d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/11cfc127-e774-40cf-b1f3-ec406842322d", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "06d13a20-c25f-40a0-aa15-6fc1b354c89d" + }, + "Response" : { + "x-request-id" : "3fd78424-5a70-49ea-b9f8-c19bffe5b9b8", + "content-length" : "273", + "x-envoy-upstream-service-time" : "5110", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "3fd78424-5a70-49ea-b9f8-c19bffe5b9b8", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"11cfc127-e774-40cf-b1f3-ec406842322d\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gene2e5abe1-a005-419a-a3b7-50387f74bf58\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}}", + "Date" : "Wed, 02 Jun 2021 00:33:43 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "800e6af1-c124-42f7-bb6f-f9b79b9dd3c4", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "35acc402-c3f8-439d-8ff5-9db89e76ffca", + "content-length" : "1378", + "x-envoy-upstream-service-time" : "5854", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "35acc402-c3f8-439d-8ff5-9db89e76ffca", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"DataLakeGen2SharedKey\",\"credentialId\":\"11cfc127-e774-40cf-b1f3-ec406842322d\"}", + "Date" : "Wed, 02 Jun 2021 00:33:48 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "a1ab479b-7e86-4a53-b089-9e90986a4d8e" + }, + "Response" : { + "x-request-id" : "ba34bb1d-6cdb-4991-95c5-ec4dcbb4cd15", + "content-length" : "1378", + "x-envoy-upstream-service-time" : "297", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "ba34bb1d-6cdb-4991-95c5-ec4dcbb4cd15", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"DataLakeGen2SharedKey\",\"credentialId\":\"11cfc127-e774-40cf-b1f3-ec406842322d\"}", + "Date" : "Wed, 02 Jun 2021 00:33:50 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "e76f3071-a7c3-4bbe-ba9d-edd4d378cea2", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "04ef4f2f-eca5-4f08-8db1-867444203007", + "content-length" : "0", + "x-envoy-upstream-service-time" : "587", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "04ef4f2f-eca5-4f08-8db1-867444203007", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:33:51 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/f0b4f08b-c901-4c03-bc29-5d4b57e370f7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/f0b4f08b-c901-4c03-bc29-5d4b57e370f7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "94acd6fd-28fe-4dc9-8a6a-a6f0a934f296" + }, + "Response" : { + "x-request-id" : "72710e32-1352-489a-89d9-c45812ec7929", + "content-length" : "360", + "x-envoy-upstream-service-time" : "5130", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "72710e32-1352-489a-89d9-c45812ec7929", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"f0b4f08b-c901-4c03-bc29-5d4b57e370f7\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spb3930369-ec12-481d-83f7-d292311a143c\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Wed, 02 Jun 2021 00:33:56 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f884c3b7-d277-405a-b2d4-0cd50899f21e", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "15ea513d-7cf9-4ce9-ae34-9c8d0bb2fb17", + "content-length" : "1373", + "x-envoy-upstream-service-time" : "5903", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "15ea513d-7cf9-4ce9-ae34-9c8d0bb2fb17", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"f0b4f08b-c901-4c03-bc29-5d4b57e370f7\"}", + "Date" : "Wed, 02 Jun 2021 00:34:01 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "044e121c-4ee9-4eb8-901c-03a976674987" + }, + "Response" : { + "x-request-id" : "cc1d8dc3-1eda-43d5-a5ac-0c8c9ca7831e", + "content-length" : "1373", + "x-envoy-upstream-service-time" : "5198", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "cc1d8dc3-1eda-43d5-a5ac-0c8c9ca7831e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"f0b4f08b-c901-4c03-bc29-5d4b57e370f7\"}", + "Date" : "Wed, 02 Jun 2021 00:34:06 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "5446c008-a5be-4cdf-973b-20dc9c63e3a9", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "69fd977e-520a-49bb-95d6-fad5deee32e1", + "content-length" : "0", + "x-envoy-upstream-service-time" : "369", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "69fd977e-520a-49bb-95d6-fad5deee32e1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:34:07 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/e3483a80-9556-4f94-a681-632cdf6c39c2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/e3483a80-9556-4f94-a681-632cdf6c39c2", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "ea187b90-7071-4e23-8644-50ec2abede67" + }, + "Response" : { + "x-request-id" : "2df50655-2528-4a3f-8569-e4c875e3acff", + "content-length" : "549", + "x-envoy-upstream-service-time" : "164", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "2df50655-2528-4a3f-8569-e4c875e3acff", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"e3483a80-9556-4f94-a681-632cdf6c39c2\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkvc0906c9d-a47f-476e-abe7-3f1ca2f23cfb\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://d980b6c7-9bb8-4486-89ab-5dab5a24e62d.vault.azure.net\"}}", + "Date" : "Wed, 02 Jun 2021 00:34:07 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8e27d810-7698-472a-9b97-83a6bcb7b3b7", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "991a9816-77d3-4c76-8f60-ea5fb1d8a711", + "content-length" : "1377", + "x-envoy-upstream-service-time" : "6079", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "991a9816-77d3-4c76-8f60-ea5fb1d8a711", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"e3483a80-9556-4f94-a681-632cdf6c39c2\"}", + "Date" : "Wed, 02 Jun 2021 00:34:14 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "4be2143f-21c9-4f52-91d9-958e6393b088" + }, + "Response" : { + "x-request-id" : "bad9b36a-539f-4eaa-9807-55cf049bcde5", + "content-length" : "1377", + "x-envoy-upstream-service-time" : "5225", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "bad9b36a-539f-4eaa-9807-55cf049bcde5", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"2f6deb68-bcb4-43f9-b32a-12cd1006e46a\",\"dataFeedName\":\"java_create_data_feed_test_samplec3a902be-9b05-4ce1-ad38-30b566097a18\",\"metrics\":[{\"metricId\":\"e8b324fc-f5b2-402b-833e-3d44de806963\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"3c9bd24c-4aae-420c-8b74-96614bb1541f\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"AzureDataLakeStorageGen2\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:33:37Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"fileTemplate\":\"adsample.json\",\"accountName\":\"REDACTED\",\"directoryTemplate\":\"%Y/%m/%d\",\"fileSystemName\":\"adsample\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"e3483a80-9556-4f94-a681-632cdf6c39c2\"}", + "Date" : "Wed, 02 Jun 2021 00:34:19 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/2f6deb68-bcb4-43f9-b32a-12cd1006e46a", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "1423ce4a-ab2c-40c5-8ce0-7a7767a1bc81" + }, + "Response" : { + "x-request-id" : "0fc9c00b-9f87-4f08-83c5-014f10c4cf3b", + "content-length" : "0", + "x-envoy-upstream-service-time" : "417", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "0fc9c00b-9f87-4f08-83c5-014f10c4cf3b", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:34:19 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/11cfc127-e774-40cf-b1f3-ec406842322d", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "abafe521-fc65-44e0-81cb-6d4397b75be2" + }, + "Response" : { + "x-request-id" : "1d2dc9cd-6baf-4062-9dfd-d97e9dc6be3c", + "content-length" : "0", + "x-envoy-upstream-service-time" : "224", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "1d2dc9cd-6baf-4062-9dfd-d97e9dc6be3c", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:34:20 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f0b4f08b-c901-4c03-bc29-5d4b57e370f7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "efbcf655-3260-4dc3-8ff0-9ff66e1fc62f" + }, + "Response" : { + "x-request-id" : "db4ae64a-8e1c-45a1-b377-cb4b4f590eab", + "content-length" : "0", + "x-envoy-upstream-service-time" : "109", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "db4ae64a-8e1c-45a1-b377-cb4b4f590eab", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:34:20 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/e3483a80-9556-4f94-a681-632cdf6c39c2", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "e38e8910-6a86-4a90-9f5c-067196c7fec7" + }, + "Response" : { + "x-request-id" : "15269c17-f1e5-42eb-a5f7-23ce5130e4da", + "content-length" : "0", + "x-envoy-upstream-service-time" : "198", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "15269c17-f1e5-42eb-a5f7-23ce5130e4da", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:34:20 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testSqlServer[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testSqlServer[1].json new file mode 100644 index 000000000000..d7c4dcdda966 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DataFeedWithCredentialsTest.testSqlServer[1].json @@ -0,0 +1,420 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "1ee5eae2-5610-4747-88a9-8bd17c814842", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "0d8f4dba-5283-4fd2-b2a1-6e4c2e08b4a6", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5717", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "0d8f4dba-5283-4fd2-b2a1-6e4c2e08b4a6", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:45 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "711984ef-95c3-4e97-a992-6168bfed40dc" + }, + "Response" : { + "x-request-id" : "e0e483ae-8aeb-46ef-acdb-8f3b9449b8d6", + "content-length" : "1229", + "x-envoy-upstream-service-time" : "215", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e0e483ae-8aeb-46ef-acdb-8f3b9449b8d6", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"Basic\"}", + "Date" : "Wed, 02 Jun 2021 00:30:44 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3ea0ef01-9721-455a-a6ed-21728c4273a2", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "ac77a968-5750-4eae-99ec-d962f284613d", + "content-length" : "1239", + "x-envoy-upstream-service-time" : "962", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "ac77a968-5750-4eae-99ec-d962f284613d", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:30:45 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "89979aa2-3cd2-4fdc-ad80-e2cb0d5c1ba0" + }, + "Response" : { + "x-request-id" : "6c27db77-faaa-46e0-9492-aee38c1862a4", + "content-length" : "1239", + "x-envoy-upstream-service-time" : "281", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "6c27db77-faaa-46e0-9492-aee38c1862a4", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ManagedIdentity\"}", + "Date" : "Wed, 02 Jun 2021 00:30:46 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "32c5ccc8-c3a3-462d-844c-47d05de369af", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "fe00ec94-66f6-4eb4-b149-f7afac03b81c", + "content-length" : "0", + "x-envoy-upstream-service-time" : "483", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "fe00ec94-66f6-4eb4-b149-f7afac03b81c", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:46 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/f2ed2284-b04c-4d2d-abf0-37833ac17138" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/f2ed2284-b04c-4d2d-abf0-37833ac17138", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "557052a0-1a7d-4c2a-b14b-1c240c542ff6" + }, + "Response" : { + "x-request-id" : "9c900a16-d0b0-440b-95e8-50b7494d4c17", + "content-length" : "274", + "x-envoy-upstream-service-time" : "5185", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "9c900a16-d0b0-440b-95e8-50b7494d4c17", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"f2ed2284-b04c-4d2d-abf0-37833ac17138\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_conac257eb3-b21c-484a-ad64-4c015dafe882\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}", + "Date" : "Wed, 02 Jun 2021 00:30:52 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3c12dba2-a3bc-4e91-8dd0-98e560b957c7", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "cef223da-7558-4f57-863a-fbfa965bf76f", + "content-length" : "1302", + "x-envoy-upstream-service-time" : "828", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "cef223da-7558-4f57-863a-fbfa965bf76f", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"AzureSQLConnectionString\",\"credentialId\":\"f2ed2284-b04c-4d2d-abf0-37833ac17138\"}", + "Date" : "Wed, 02 Jun 2021 00:30:52 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "a1cad5f6-4303-486d-b9ce-3493cbc72e37" + }, + "Response" : { + "x-request-id" : "25816479-5d69-48c9-8265-e17c06e18069", + "content-length" : "1302", + "x-envoy-upstream-service-time" : "206", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "25816479-5d69-48c9-8265-e17c06e18069", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"AzureSQLConnectionString\",\"credentialId\":\"f2ed2284-b04c-4d2d-abf0-37833ac17138\"}", + "Date" : "Wed, 02 Jun 2021 00:30:52 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "54b6bd84-2806-4d4e-87aa-5f92b903cfed", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "908468ae-3f40-4542-903b-bae9d539de09", + "content-length" : "0", + "x-envoy-upstream-service-time" : "487", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "908468ae-3f40-4542-903b-bae9d539de09", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:30:53 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/25dc9420-4545-4b27-ae9c-2a301d2a0d27" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/25dc9420-4545-4b27-ae9c-2a301d2a0d27", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f51f8561-b0ab-4069-a902-2dbb848458a2" + }, + "Response" : { + "x-request-id" : "1976cbe9-d974-4b62-922d-5fd008bd8e2b", + "content-length" : "360", + "x-envoy-upstream-service-time" : "77", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "1976cbe9-d974-4b62-922d-5fd008bd8e2b", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"25dc9420-4545-4b27-ae9c-2a301d2a0d27\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spb6eadb7b-8051-4dc6-9807-eed293a8b283\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Wed, 02 Jun 2021 00:30:53 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "30d76315-cfe5-4d9a-a038-5cbc7cec1b2f", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "6a606fcf-0b7d-4541-9c31-dbb327cd20ae", + "content-length" : "1294", + "x-envoy-upstream-service-time" : "6301", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "6a606fcf-0b7d-4541-9c31-dbb327cd20ae", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"25dc9420-4545-4b27-ae9c-2a301d2a0d27\"}", + "Date" : "Wed, 02 Jun 2021 00:30:59 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "9594f0f3-99bd-4d9f-b39d-82a8dc825ae3" + }, + "Response" : { + "x-request-id" : "1b5af22b-92dc-4385-972c-3054d4d9c8ed", + "content-length" : "1294", + "x-envoy-upstream-service-time" : "175", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "1b5af22b-92dc-4385-972c-3054d4d9c8ed", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipal\",\"credentialId\":\"25dc9420-4545-4b27-ae9c-2a301d2a0d27\"}", + "Date" : "Wed, 02 Jun 2021 00:31:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "0ceb3fd5-3636-4a59-a7f8-c0aa36fabd01", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "7bb42a13-7501-4511-bb2a-024e7be1de2c", + "content-length" : "0", + "x-envoy-upstream-service-time" : "249", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "7bb42a13-7501-4511-bb2a-024e7be1de2c", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Wed, 02 Jun 2021 00:31:00 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ef787c41-2d6e-4a27-8180-1c1d0c63e032" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ef787c41-2d6e-4a27-8180-1c1d0c63e032", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "be341636-e7f4-4be4-98cb-b6f34c0bf3be" + }, + "Response" : { + "x-request-id" : "f00a2acc-c093-43de-834d-027fcc99a3ea", + "content-length" : "549", + "x-envoy-upstream-service-time" : "5125", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "f00a2acc-c093-43de-834d-027fcc99a3ea", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"ef787c41-2d6e-4a27-8180-1c1d0c63e032\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkva00b3ff8-a48b-4370-80c2-9d2b222dd023\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://dbd4c453-c7fc-4602-b083-6ed0401cc01d.vault.azure.net\"}}", + "Date" : "Wed, 02 Jun 2021 00:31:06 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "68930554-1085-4200-b858-9abc280b70c2", + "Content-Type" : "application/merge-patch+json" + }, + "Response" : { + "x-request-id" : "10d467a7-b8ab-4ef1-8ecd-879617ed7f36", + "content-length" : "1298", + "x-envoy-upstream-service-time" : "1228", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "10d467a7-b8ab-4ef1-8ecd-879617ed7f36", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"ef787c41-2d6e-4a27-8180-1c1d0c63e032\"}", + "Date" : "Wed, 02 Jun 2021 00:31:07 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f0113a6f-b10d-41fd-b8d6-9aee0d0045dd" + }, + "Response" : { + "x-request-id" : "0a6dc923-cfce-4e58-ba30-e7ac805451e5", + "content-length" : "1298", + "x-envoy-upstream-service-time" : "182", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "0a6dc923-cfce-4e58-ba30-e7ac805451e5", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataFeedId\":\"dfd579a0-1626-45d7-8f52-e0f7fa05ebe7\",\"dataFeedName\":\"java_create_data_feed_test_sample4dfd6bd4-960e-444f-914a-b800c44548ad\",\"metrics\":[{\"metricId\":\"ca2619cd-3b84-432b-970e-db088dcae2dd\",\"metricName\":\"cost\",\"metricDisplayName\":\"cost\",\"metricDescription\":\"\"},{\"metricId\":\"b550e735-3b0f-4baa-9790-d1be357f8dae\",\"metricName\":\"revenue\",\"metricDisplayName\":\"revenue\",\"metricDescription\":\"\"}],\"dimension\":[{\"dimensionName\":\"category\",\"dimensionDisplayName\":\"category\"},{\"dimensionName\":\"city\",\"dimensionDisplayName\":\"city\"}],\"dataStartFrom\":\"2019-10-01T00:00:00Z\",\"dataSourceType\":\"SqlServer\",\"timestampColumn\":\"\",\"startOffsetInSeconds\":0,\"maxQueryPerMinute\":30.0,\"granularityName\":\"Daily\",\"needRollup\":\"NoRollup\",\"fillMissingPointType\":\"PreviousValue\",\"fillMissingPointValue\":0.0,\"rollUpMethod\":\"None\",\"dataFeedDescription\":\"\",\"stopRetryAfterInSeconds\":-1,\"minRetryIntervalInSeconds\":-1,\"maxConcurrency\":0,\"viewMode\":\"Private\",\"admins\":[\"kaghiya@microsoft.com\"],\"viewers\":[],\"creator\":\"kaghiya@microsoft.com\",\"status\":\"Active\",\"createdTime\":\"2021-06-02T00:30:44Z\",\"isAdmin\":true,\"actionLinkTemplate\":\"\",\"dataSourceParameter\":{\"query\":\"select * from adsample2 where Timestamp = @StartTime\"},\"authenticationType\":\"ServicePrincipalInKV\",\"credentialId\":\"ef787c41-2d6e-4a27-8180-1c1d0c63e032\"}", + "Date" : "Wed, 02 Jun 2021 00:31:06 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/dfd579a0-1626-45d7-8f52-e0f7fa05ebe7", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "032b64ba-bbfa-4468-9fc2-93109c9b1c80" + }, + "Response" : { + "x-request-id" : "aaafb06d-90a1-4323-bb98-eda153d8b6b9", + "content-length" : "0", + "x-envoy-upstream-service-time" : "393", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "aaafb06d-90a1-4323-bb98-eda153d8b6b9", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:07 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/f2ed2284-b04c-4d2d-abf0-37833ac17138", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "dc8421c9-8783-4adf-9f7b-3a0158e3fc7b" + }, + "Response" : { + "x-request-id" : "7ba42a55-d376-4428-ac43-7a94f2647581", + "content-length" : "0", + "x-envoy-upstream-service-time" : "73", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "7ba42a55-d376-4428-ac43-7a94f2647581", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:07 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/25dc9420-4545-4b27-ae9c-2a301d2a0d27", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "c00e5654-86c5-468a-8f95-8df032cc4fb9" + }, + "Response" : { + "x-request-id" : "b6f6e0d2-ed10-44e5-92cf-b4647deb3167", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5123", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "b6f6e0d2-ed10-44e5-92cf-b4647deb3167", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:12 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/ef787c41-2d6e-4a27-8180-1c1d0c63e032", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "0b627063-d07e-42af-8e3f-4de9225d42bb" + }, + "Response" : { + "x-request-id" : "dc115ce2-84ab-4080-9719-41a1f56a0203", + "content-length" : "0", + "x-envoy-upstream-service-time" : "104", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "dc115ce2-84ab-4080-9719-41a1f56a0203", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Wed, 02 Jun 2021 00:31:12 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createDataLakeGen2SharedKey[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createDataLakeGen2SharedKey[1].json new file mode 100644 index 000000000000..f546c0c8b962 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createDataLakeGen2SharedKey[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "c858ce81-83a9-48dc-ab7f-732e6f4535b0", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "33435dfb-c7bc-43b6-83f0-51150896de25", + "content-length" : "0", + "x-envoy-upstream-service-time" : "630", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "33435dfb-c7bc-43b6-83f0-51150896de25", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/6926fdfc-e681-45e8-84d0-2655e99b9287" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/6926fdfc-e681-45e8-84d0-2655e99b9287", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "cf6f925d-06c9-4b24-8875-18f778c28fc9" + }, + "Response" : { + "x-request-id" : "e634ea7f-821b-40a6-9c09-1380048cec27", + "content-length" : "273", + "x-envoy-upstream-service-time" : "73", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e634ea7f-821b-40a6-9c09-1380048cec27", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"6926fdfc-e681-45e8-84d0-2655e99b9287\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gencaa6de72-0a11-4adb-b5f2-7e7e237629f9\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}}", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/6926fdfc-e681-45e8-84d0-2655e99b9287", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f4005c65-9631-4e64-b961-29629001b3aa" + }, + "Response" : { + "x-request-id" : "83a58de8-5b0d-4169-8cdc-d192cf27a567", + "content-length" : "0", + "x-envoy-upstream-service-time" : "221", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "83a58de8-5b0d-4169-8cdc-d192cf27a567", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 28 May 2021 23:21:27 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipalInKV[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipalInKV[1].json new file mode 100644 index 000000000000..9b14b90283f3 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipalInKV[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "30077b8b-dabe-4250-8232-4ac13e804d71", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "5c1d9b33-ef34-4c7b-b98c-fb4f0a6857a1", + "content-length" : "0", + "x-envoy-upstream-service-time" : "790", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5c1d9b33-ef34-4c7b-b98c-fb4f0a6857a1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ab346b60-e5d1-4325-9e06-24d00779a1aa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ab346b60-e5d1-4325-9e06-24d00779a1aa", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "a90d2513-6d1a-4db4-9906-479cdb652886" + }, + "Response" : { + "x-request-id" : "d8f091f4-06eb-45fc-8fee-44053d470f01", + "content-length" : "549", + "x-envoy-upstream-service-time" : "95", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "d8f091f4-06eb-45fc-8fee-44053d470f01", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"ab346b60-e5d1-4325-9e06-24d00779a1aa\",\"dataSourceCredentialName\":\"java_create_data_source_cred_spkv5ec975c9-310d-4dd9-9e37-d9ccc869038f\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipalInKV\",\"parameters\":{\"servicePrincipalSecretNameInKV\":\"DSClientSer_1\",\"servicePrincipalIdNameInKV\":\"DSClientID_1\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\",\"keyVaultClientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"keyVaultEndpoint\":\"https://ee8844ad-6346-44b8-850e-645fea3b671c.vault.azure.net\"}}", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ab346b60-e5d1-4325-9e06-24d00779a1aa", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "1ff0b0c7-c7c6-4e77-bcd6-2d861d2d0ec4" + }, + "Response" : { + "x-request-id" : "a0d959d1-f3cd-49ca-9d9c-129bb9b9eaa0", + "content-length" : "0", + "x-envoy-upstream-service-time" : "287", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a0d959d1-f3cd-49ca-9d9c-129bb9b9eaa0", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 28 May 2021 23:21:27 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipal[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipal[1].json new file mode 100644 index 000000000000..fe5ac8a32e62 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createServicePrincipal[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8f67574e-2c11-4582-9ebc-4938962a412b", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "34877a06-7c95-470f-b55d-a0e77744584d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "609", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "34877a06-7c95-470f-b55d-a0e77744584d", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/22f859a9-d4cb-4da7-a1a3-fa5525b5f087" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/22f859a9-d4cb-4da7-a1a3-fa5525b5f087", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "183ca635-9874-40a7-86c6-845aba015bf3" + }, + "Response" : { + "x-request-id" : "965ba100-24fa-47f4-ba95-304d32a1b382", + "content-length" : "360", + "x-envoy-upstream-service-time" : "94", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "965ba100-24fa-47f4-ba95-304d32a1b382", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"22f859a9-d4cb-4da7-a1a3-fa5525b5f087\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sp4f5badfe-d146-452a-8ad2-eb3404990824\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/22f859a9-d4cb-4da7-a1a3-fa5525b5f087", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "55870836-22bf-4910-bba3-1620fa5545f8" + }, + "Response" : { + "x-request-id" : "92f4dc62-5ed2-48f8-ab7e-bd26c1171ada", + "content-length" : "0", + "x-envoy-upstream-service-time" : "233", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "92f4dc62-5ed2-48f8-ab7e-bd26c1171ada", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 28 May 2021 23:21:28 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createSqlConnectionString[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createSqlConnectionString[1].json new file mode 100644 index 000000000000..1dc11fa840cf --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.createSqlConnectionString[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "979f81f2-e478-4d11-89fd-5dcc26aca14f", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "284444b2-ec82-424d-9192-b5808ffdf793", + "content-length" : "0", + "x-envoy-upstream-service-time" : "615", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "284444b2-ec82-424d-9192-b5808ffdf793", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Fri, 28 May 2021 23:21:26 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/94199c4b-6e3d-42b9-88c3-db5940a00ae1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/94199c4b-6e3d-42b9-88c3-db5940a00ae1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "8a89b77c-e6c1-4b8a-8691-3f540c7e41c5" + }, + "Response" : { + "x-request-id" : "65a3355f-ed34-415c-aa8a-305edcf928e7", + "content-length" : "274", + "x-envoy-upstream-service-time" : "85", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "65a3355f-ed34-415c-aa8a-305edcf928e7", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"94199c4b-6e3d-42b9-88c3-db5940a00ae1\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_conf6fc9443-5e5f-4c3e-b6dd-0273d4656e7f\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/94199c4b-6e3d-42b9-88c3-db5940a00ae1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "b5c53dd6-2dd5-4feb-99ef-84d29cd81442" + }, + "Response" : { + "x-request-id" : "a6c3bc02-4af2-40cc-971c-5e8802c6a84a", + "content-length" : "0", + "x-envoy-upstream-service-time" : "220", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a6c3bc02-4af2-40cc-971c-5e8802c6a84a", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 28 May 2021 23:21:28 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.testListDataSourceCredentials[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.testListDataSourceCredentials[1].json new file mode 100644 index 000000000000..727608b93cab --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialAsyncTest.testListDataSourceCredentials[1].json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "29cc73d5-363f-4bb5-85d3-44ef43eb8fdf", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "659c4338-901f-4efa-881e-77da75cd6ba2", + "content-length" : "0", + "x-envoy-upstream-service-time" : "703", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "659c4338-901f-4efa-881e-77da75cd6ba2", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/0f42af0f-9097-4521-a34c-c48e0d36b160" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/0f42af0f-9097-4521-a34c-c48e0d36b160", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "fc60527a-43d6-482c-a58e-fc2f0163e76d" + }, + "Response" : { + "x-request-id" : "48a7902a-f9d2-4b0d-9faf-9ce0b90fddd4", + "content-length" : "274", + "x-envoy-upstream-service-time" : "92", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "48a7902a-f9d2-4b0d-9faf-9ce0b90fddd4", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"0f42af0f-9097-4521-a34c-c48e0d36b160\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_concd37bfa3-b36f-4edc-b236-d0a6379dc798\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f8da5b4a-21e4-4c35-88ff-ec98fd9f0dd0", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "178114e8-9c23-42c1-a27a-2e3588e62b07", + "content-length" : "0", + "x-envoy-upstream-service-time" : "425", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "178114e8-9c23-42c1-a27a-2e3588e62b07", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Fri, 28 May 2021 23:21:28 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/3622237d-0a48-4b98-84a0-88f72f5dc9d0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/3622237d-0a48-4b98-84a0-88f72f5dc9d0", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "713ecc30-7218-466e-8ed7-3ce7b1d2ee14" + }, + "Response" : { + "x-request-id" : "a92ba042-8c5a-4ea2-b756-444c5e3990f8", + "content-length" : "273", + "x-envoy-upstream-service-time" : "77", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "a92ba042-8c5a-4ea2-b756-444c5e3990f8", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"3622237d-0a48-4b98-84a0-88f72f5dc9d0\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen22c8ee50-bbcd-4d1f-ae74-092a868558bc\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}}", + "Date" : "Fri, 28 May 2021 23:21:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "d92087cc-c800-4294-982e-45e5b9f1da90" + }, + "Response" : { + "x-request-id" : "2bb5e18f-609d-4911-a19d-72a90d4390ba", + "content-length" : "577", + "x-envoy-upstream-service-time" : "115", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "2bb5e18f-609d-4911-a19d-72a90d4390ba", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"value\":[{\"dataSourceCredentialId\":\"3622237d-0a48-4b98-84a0-88f72f5dc9d0\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen22c8ee50-bbcd-4d1f-ae74-092a868558bc\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}},{\"dataSourceCredentialId\":\"0f42af0f-9097-4521-a34c-c48e0d36b160\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_concd37bfa3-b36f-4edc-b236-d0a6379dc798\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}],\"@nextLink\":null}", + "Date" : "Fri, 28 May 2021 23:21:28 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/0f42af0f-9097-4521-a34c-c48e0d36b160", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "069be3f7-b347-44de-8ad7-cb80c452b080" + }, + "Response" : { + "x-request-id" : "d0fc2bcc-abf0-421a-abfd-ce5ce82e8d13", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5224", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "d0fc2bcc-abf0-421a-abfd-ce5ce82e8d13", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 28 May 2021 23:21:33 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/3622237d-0a48-4b98-84a0-88f72f5dc9d0", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "a79c3ef8-4307-4aa6-adc8-bccc9ee2245a" + }, + "Response" : { + "x-request-id" : "e1b9441d-3956-485f-ae2f-5f32e6622e05", + "content-length" : "0", + "x-envoy-upstream-service-time" : "212", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e1b9441d-3956-485f-ae2f-5f32e6622e05", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 28 May 2021 23:21:34 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createDataLakeGen2SharedKey[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createDataLakeGen2SharedKey[1].json new file mode 100644 index 000000000000..0a4ab963e4b7 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createDataLakeGen2SharedKey[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "6e7e549e-cd2f-40de-be8d-ecfa4337726e", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "e8570861-877f-4ef2-8aaa-6d54f4a80296", + "content-length" : "0", + "x-envoy-upstream-service-time" : "1729", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "e8570861-877f-4ef2-8aaa-6d54f4a80296", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Sun, 30 May 2021 20:54:03 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/5d0183f6-83dc-4b92-8ac6-f1233cb41de4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/5d0183f6-83dc-4b92-8ac6-f1233cb41de4", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "c6e71453-ec55-498e-a50a-678d86e13113" + }, + "Response" : { + "x-request-id" : "060fecb8-0a3a-4fdd-85a6-1f4a8fd4be6d", + "content-length" : "273", + "x-envoy-upstream-service-time" : "5099", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "060fecb8-0a3a-4fdd-85a6-1f4a8fd4be6d", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"5d0183f6-83dc-4b92-8ac6-f1233cb41de4\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen39c3071d-eb62-4308-ad4a-5d8ea0fdb956\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}}", + "Date" : "Sun, 30 May 2021 20:54:08 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/5d0183f6-83dc-4b92-8ac6-f1233cb41de4", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "48705b38-58f9-4201-835c-a9dff302e28b" + }, + "Response" : { + "x-request-id" : "bda1e65e-276e-4820-9089-5c2c2682925d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "102", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "bda1e65e-276e-4820-9089-5c2c2682925d", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Sun, 30 May 2021 20:54:09 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createServicePrincipal[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createServicePrincipal[1].json new file mode 100644 index 000000000000..2de6b2e04352 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createServicePrincipal[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "6a36cc72-387c-4426-8c1a-9806c9609d16", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "73e3782e-602c-4dd6-968b-0113be809412", + "content-length" : "0", + "x-envoy-upstream-service-time" : "937", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "73e3782e-602c-4dd6-968b-0113be809412", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Sun, 30 May 2021 20:54:03 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/5990ec59-17ed-4074-bb3d-27dec31cdedf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/5990ec59-17ed-4074-bb3d-27dec31cdedf", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "12a6e9e1-fc3d-4c02-bb2d-ae2f2c26a2d0" + }, + "Response" : { + "x-request-id" : "22e902d0-7584-489a-9843-43db17909549", + "content-length" : "360", + "x-envoy-upstream-service-time" : "121", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "22e902d0-7584-489a-9843-43db17909549", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"5990ec59-17ed-4074-bb3d-27dec31cdedf\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sp2ee27523-fd2b-4926-8b60-00e7be4409dd\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}}", + "Date" : "Sun, 30 May 2021 20:54:03 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/5990ec59-17ed-4074-bb3d-27dec31cdedf", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "f1a060ef-0149-4444-be99-85397c5e6e68" + }, + "Response" : { + "x-request-id" : "0e3454ed-18e1-40b2-9dc9-a8ff591cdc5d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "6472", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "0e3454ed-18e1-40b2-9dc9-a8ff591cdc5d", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Sun, 30 May 2021 20:54:10 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createSqlConnectionString[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createSqlConnectionString[1].json new file mode 100644 index 000000000000..2d6f9e87f888 --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.createSqlConnectionString[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "63c2b691-9ba4-4df3-9910-c1fc9ba1ae53", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "d722bb87-4d54-4c77-80fa-376c2ba53297", + "content-length" : "0", + "x-envoy-upstream-service-time" : "869", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "d722bb87-4d54-4c77-80fa-376c2ba53297", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Sun, 30 May 2021 20:54:02 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ec082162-976a-4a5e-b551-1c06c9cc00f2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/ec082162-976a-4a5e-b551-1c06c9cc00f2", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "3b2786da-3284-48f6-ae0e-967ec9d81a1e" + }, + "Response" : { + "x-request-id" : "189630ce-20e9-4ab8-98d0-cfbdba2a511e", + "content-length" : "274", + "x-envoy-upstream-service-time" : "5204", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "189630ce-20e9-4ab8-98d0-cfbdba2a511e", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"ec082162-976a-4a5e-b551-1c06c9cc00f2\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_con035a726d-e30e-4605-8a6d-c7ca5171ff5e\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}", + "Date" : "Sun, 30 May 2021 20:54:08 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/ec082162-976a-4a5e-b551-1c06c9cc00f2", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "7e9ba395-1e3e-4b0e-9b84-5c3010e7a867" + }, + "Response" : { + "x-request-id" : "9855ee79-b023-47d4-b5de-98053da35f8d", + "content-length" : "0", + "x-envoy-upstream-service-time" : "134", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "9855ee79-b023-47d4-b5de-98053da35f8d", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Sun, 30 May 2021 20:54:08 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.testListDataSourceCredentials[1].json b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.testListDataSourceCredentials[1].json new file mode 100644 index 000000000000..3f40cdabd9af --- /dev/null +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/resources/session-records/DatasourceCredentialTest.testListDataSourceCredentials[1].json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "08bc45ed-94e1-47dd-93e1-119ff8d49248", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "3b3decd2-703a-4e41-bc81-2b8f0dd12d86", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5614", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "3b3decd2-703a-4e41-bc81-2b8f0dd12d86", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Sun, 30 May 2021 20:54:07 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/9cb17d61-1df3-487c-bc27-9873d91a075c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/9cb17d61-1df3-487c-bc27-9873d91a075c", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "00c60870-a127-4072-867f-5589e12929c2" + }, + "Response" : { + "x-request-id" : "abeb14f7-6ca2-408b-828a-db7c920b9360", + "content-length" : "274", + "x-envoy-upstream-service-time" : "1602", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "abeb14f7-6ca2-408b-828a-db7c920b9360", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"9cb17d61-1df3-487c-bc27-9873d91a075c\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_conc5002d76-5960-41e4-88ab-042018e21e1b\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}", + "Date" : "Sun, 30 May 2021 20:54:09 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "38cfcbd8-8287-4b76-8444-1e531ab7d728", + "Content-Type" : "application/json" + }, + "Response" : { + "x-request-id" : "1daefb05-16dc-421c-b455-ab202798b0be", + "content-length" : "0", + "x-envoy-upstream-service-time" : "5821", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "1daefb05-16dc-421c-b455-ab202798b0be", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Sun, 30 May 2021 20:54:15 GMT", + "Location" : "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d945027f-a656-4dae-b4aa-ab158ebe2b0b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials/d945027f-a656-4dae-b4aa-ab158ebe2b0b", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "fe7818da-09c0-45f2-922d-62dada2e5995" + }, + "Response" : { + "x-request-id" : "ca979713-56df-4763-9b5c-5f8a71247835", + "content-length" : "273", + "x-envoy-upstream-service-time" : "83", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "ca979713-56df-4763-9b5c-5f8a71247835", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"dataSourceCredentialId\":\"d945027f-a656-4dae-b4aa-ab158ebe2b0b\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen07680095-1cbd-451d-a71a-8fa1d39ac498\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}}", + "Date" : "Sun, 30 May 2021 20:54:15 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/credentials", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "1f9e4a51-23d2-48f9-9d94-5001a7d5d161" + }, + "Response" : { + "x-request-id" : "88440ea7-0314-47cf-8aca-8ba7f26f3ed2", + "content-length" : "1762", + "x-envoy-upstream-service-time" : "151", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "88440ea7-0314-47cf-8aca-8ba7f26f3ed2", + "retry-after" : "0", + "StatusCode" : "200", + "Body" : "{\"value\":[{\"dataSourceCredentialId\":\"d945027f-a656-4dae-b4aa-ab158ebe2b0b\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen07680095-1cbd-451d-a71a-8fa1d39ac498\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}},{\"dataSourceCredentialId\":\"9cb17d61-1df3-487c-bc27-9873d91a075c\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_conc5002d76-5960-41e4-88ab-042018e21e1b\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}},{\"dataSourceCredentialId\":\"5d0183f6-83dc-4b92-8ac6-f1233cb41de4\",\"dataSourceCredentialName\":\"java_create_data_source_cred_dlake_gen39c3071d-eb62-4308-ad4a-5d8ea0fdb956\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"DataLakeGen2SharedKey\",\"parameters\":{}},{\"dataSourceCredentialId\":\"5990ec59-17ed-4074-bb3d-27dec31cdedf\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sp2ee27523-fd2b-4926-8b60-00e7be4409dd\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"ServicePrincipal\",\"parameters\":{\"clientId\":\"e70248b2-bffa-11eb-8529-0242ac130003\",\"tenantId\":\"45389ded-5e07-4e52-b225-4ae8f905afb5\"}},{\"dataSourceCredentialId\":\"ec082162-976a-4a5e-b551-1c06c9cc00f2\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_con035a726d-e30e-4605-8a6d-c7ca5171ff5e\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}},{\"dataSourceCredentialId\":\"4b6d4711-2987-4eb3-ac29-979e6153c44a\",\"dataSourceCredentialName\":\"java_create_data_source_cred_sql_con9269bbe9-cc7a-4b74-9cd1-cbd79ef6ff56\",\"dataSourceCredentialDescription\":\"\",\"dataSourceCredentialType\":\"AzureSQLConnectionString\",\"parameters\":{}}],\"@nextLink\":null}", + "Date" : "Sun, 30 May 2021 20:54:15 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/9cb17d61-1df3-487c-bc27-9873d91a075c", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "67368a54-b230-4b02-a28b-9d437b37af90" + }, + "Response" : { + "x-request-id" : "5ff2f1da-2557-4d34-a222-091862beffe2", + "content-length" : "0", + "x-envoy-upstream-service-time" : "6440", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "5ff2f1da-2557-4d34-a222-091862beffe2", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Sun, 30 May 2021 20:54:22 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://REDACTED.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds/d945027f-a656-4dae-b4aa-ab158ebe2b0b", + "Headers" : { + "User-Agent" : "azsdk-java-azure-ai-metricsadvisor/1.0.0-beta.4 (1.8.0_221; Mac OS X; 10.16)", + "x-ms-client-request-id" : "1c58d893-d9ee-4ce7-859a-b66749dabc3b" + }, + "Response" : { + "x-request-id" : "09864fa6-324c-4e7d-8018-4c576051c9c0", + "content-length" : "0", + "x-envoy-upstream-service-time" : "78", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload", + "x-content-type-options" : "nosniff", + "apim-request-id" : "09864fa6-324c-4e7d-8018-4c576051c9c0", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Sun, 30 May 2021 20:54:22 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/swagger/README.md b/sdk/metricsadvisor/azure-ai-metricsadvisor/swagger/README.md index f59e1ae93905..a8129c354408 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/swagger/README.md +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/swagger/README.md @@ -32,11 +32,19 @@ add-context-parameter: true models-subpackage: implementation.models context-client-method-parameter: true custom-types-subpackage: models -custom-types: AnomalyDetectorDirection,AnomalyStatus,AnomalyValue,ChangePointValue,ChangeThresholdCondition,DataFeedIngestionProgress,DataFeedDimension,EnrichmentStatus,FeedbackType,HardThresholdCondition,AnomalyIncidentStatus,IngestionStatusType,DataFeedMetric,PeriodType,AnomalySeverity,SeverityCondition,SmartDetectionCondition,SnoozeScope,SuppressCondition,AlertQueryTimeMode,TopNGroupScope,DataFeedIngestionStatus,MetricAnomalyAlertSnoozeCondition,MetricSeriesDefinition,FeedbackQueryTimeMode,AnomalyAlert,DataFeedGranularityType,DataFeedRollupType,DataFeedAutoRollUpMethod,DataFeedStatus,ErrorCodeException,ErrorCode +custom-types: AnomalyDetectorDirection,AnomalyStatus,AnomalyValue,ChangePointValue,ChangeThresholdCondition,DataFeedIngestionProgress,DataFeedDimension,EnrichmentStatus,FeedbackType,HardThresholdCondition,AnomalyIncidentStatus,IngestionStatusType,DataFeedMetric,PeriodType,AnomalySeverity,SeverityCondition,SmartDetectionCondition,SnoozeScope,SuppressCondition,AlertQueryTimeMode,TopNGroupScope,DataFeedIngestionStatus,MetricAnomalyAlertSnoozeCondition,MetricSeriesDefinition,FeedbackQueryTimeMode,AnomalyAlert,DataFeedGranularityType,DataFeedRollupType,DataFeedAutoRollUpMethod,DataFeedStatus,MetricsAdvisorErrorCodeException,MetricsAdvisorErrorCode ``` ### Generated types renamed and moved to model +#### ErrorCode -> MetricsAdvisorErrorCode +```yaml +directive: + - rename-model: + from: ErrorCode + to: MetricsAdvisorErrorCode +``` + #### TimeMode -> AlertQueryTimeMode ```yaml directive: @@ -291,7 +299,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -363,7 +371,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -435,7 +443,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -507,7 +515,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -579,7 +587,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -651,7 +659,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -723,7 +731,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, @@ -795,7 +803,7 @@ directive: "default": { "description": "Client error or server error (4xx or 5xx)", "schema": { - "$ref": "#/definitions/ErrorCode" + "$ref": "#/definitions/MetricsAdvisorErrorCode" } } }, diff --git a/sdk/metricsadvisor/tests.yml b/sdk/metricsadvisor/tests.yml index ace116080b6d..d27e25df4f9a 100644 --- a/sdk/metricsadvisor/tests.yml +++ b/sdk/metricsadvisor/tests.yml @@ -30,5 +30,6 @@ stages: AZURE_METRICS_ADVISOR_AZURE_MONGODB_CONNECTION_STRING: $(metricsadvisor-test-azure-mongodb-connection-string) AZURE_METRICS_ADVISOR_MYSQL_CONNECTION_STRING: $(metricsadvisor-test-mysql-connection-string) AZURE_METRICS_ADVISOR_POSTGRESQL_CONNECTION_STRING: $(metricsadvisor-test-postgresql-connection-string) - AZURE_METRICS_ADVISOR_ELASTICSEARCH_AUTH_HEADER: $(metricsadvisor-test-elasticsearch-auth-header) - AZURE_METRICS_ADVISOR_ELASTICSEARCH_HOST: $(metricsadvisor-test-elasticsearch-host) + AZURE_METRICS_ADVISOR_LOG_ANALYTICS_WORKSPACE_ID: $(metricsadvisor-test-loganalytics-workspace-id) + AZURE_METRICS_ADVISOR_LOG_ANALYTICS_CLIENT_ID: $(metricsadvisor-test-loganalytics-client-id) + AZURE_METRICS_ADVISOR_LOG_ANALYTICS_CLIENT_SECRET: $(metricsadvisor-test-loganalytics-client-secret) From 13ca8d110fde2421872a8e57c196fd60e5f8b64c Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Fri, 4 Jun 2021 11:53:22 -0700 Subject: [PATCH 41/53] Update AMQP Error Context and adding more AMQP error codes (#22060) * Adding documentation to potential Amqp errors. * Making valueMap for AmqpResponseCode final. * Update AmqpErrorContext to contain ErrorInfo. * Add revapi.json suppression. The serialization itself is compatible based on "Compatible changes" in https://docs.oracle.com/javase/6/docs/platform/serialization/spec/version.html#6678 * Adding test case. * Adding more error conditions. --- .../src/main/resources/revapi/revapi.json | 6 +++ .../amqp/exception/AmqpErrorCondition.java | 52 ++++++++++++++++++- .../core/amqp/exception/AmqpErrorContext.java | 47 +++++++++++++++-- .../core/amqp/exception/AmqpException.java | 2 + .../core/amqp/exception/AmqpResponseCode.java | 6 +-- .../amqp/exception/AmqpErrorContextTest.java | 34 ++++++++++++ 6 files changed, 139 insertions(+), 8 deletions(-) diff --git a/eng/code-quality-reports/src/main/resources/revapi/revapi.json b/eng/code-quality-reports/src/main/resources/revapi/revapi.json index 8c253d921880..024c7488286f 100644 --- a/eng/code-quality-reports/src/main/resources/revapi/revapi.json +++ b/eng/code-quality-reports/src/main/resources/revapi/revapi.json @@ -506,6 +506,12 @@ "code": "java.annotation.attributeValueChanged", "new": "@interface com.azure.core.annotation.JsonFlatten", "justification": "Changes made the annotation more permissive on the target types." + }, + { + "code": "java.field.serialVersionUIDUnchanged", + "old": "field com.azure.core.amqp.exception.AmqpErrorContext.serialVersionUID", + "new": "field com.azure.core.amqp.exception.AmqpErrorContext.serialVersionUID", + "justification": "The field ErrorInfo was added to AmqpErrorContext, but no existing fields were removed or changed." } ] } diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpErrorCondition.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpErrorCondition.java index fdf9de731921..13a6e9b40c28 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpErrorCondition.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpErrorCondition.java @@ -104,7 +104,7 @@ public enum AmqpErrorCondition { */ PROTON_IO("proton:io"), /** - * A connection error occurred. + * A connection error occurred. A valid frame header cannot be formed from the incoming byte stream. */ CONNECTION_FRAMING_ERROR("amqp:connection:framing-error"), /** @@ -139,7 +139,50 @@ public enum AmqpErrorCondition { /** * Error condition when a subscription client tries to create a rule with the name of an already existing rule. */ - ENTITY_ALREADY_EXISTS("com.microsoft:entity-already-exists"); + ENTITY_ALREADY_EXISTS("com.microsoft:entity-already-exists"), + + /** + * The container is no longer available on the current connection. The peer SHOULD attempt reconnection to the + * container using the details provided in the info map. + * + * The address provided cannot be resolved to a terminus at the current container. The info map MAY contain the + * following information to allow the client to locate the attach to the terminus. + * + * hostname: + * the hostname of the container. This is the value that SHOULD be supplied in the hostname field of the open frame, + * and during the SASL and TLS negotiation (if used). + * + * network-host: + * the DNS hostname or IP address of the machine hosting the container. + * + * port: + * the port number on the machine hosting the container. + */ + CONNECTION_REDIRECT("amqp:connection:redirect"), + + /** + * The address provided cannot be resolved to a terminus at the current container. The info map MAY contain the + * following information to allow the client to locate the attach to the terminus. + * + * hostname: + * the hostname of the container hosting the terminus. This is the value that SHOULD be supplied in the hostname + * field of the open frame, and during SASL and TLS negotiation (if used). + * + * network-host: + * the DNS hostname or IP address of the machine hosting the container. + * + * port: + * the port number on the machine hosting the container. + * + * address: + * the address of the terminus at the container. + */ + LINK_REDIRECT("amqp:link:redirect"), + + /** + * The peer sent more message transfers than currently allowed on the link. + */ + TRANSFER_LIMIT_EXCEEDED("amqp:link:transfer-limit-exceeded"); private static final Map ERROR_CONSTANT_MAP = new HashMap<>(); private final String errorCondition; @@ -150,6 +193,11 @@ public enum AmqpErrorCondition { } } + /** + * Creates an instance with the error condition header. + * + * @param errorCondition Error condition header value. + */ AmqpErrorCondition(String errorCondition) { this.errorCondition = errorCondition; } diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpErrorContext.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpErrorContext.java index b6336124bdc2..6bc219624af2 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpErrorContext.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpErrorContext.java @@ -8,11 +8,14 @@ import com.azure.core.util.CoreUtils; import java.io.Serializable; +import java.util.Collections; import java.util.Locale; +import java.util.Map; +import java.util.Objects; /** - * Provides context for an {@link AmqpException} that occurs in an {@link AmqpConnection}, {@link AmqpSession}, - * or {@link AmqpLink}. + * Provides context for an {@link AmqpException} that occurs in an {@link AmqpConnection}, {@link AmqpSession}, or + * {@link AmqpLink}. * * @see AmqpException * @see SessionErrorContext @@ -24,11 +27,13 @@ public class AmqpErrorContext implements Serializable { private static final long serialVersionUID = -2819764407122954922L; private final String namespace; + private final Map errorInfo; /** * Creates a new instance with the provided {@code namespace}. * * @param namespace The service namespace of the error. + * * @throws IllegalArgumentException when {@code namespace} is {@code null} or empty. */ public AmqpErrorContext(String namespace) { @@ -37,6 +42,24 @@ public AmqpErrorContext(String namespace) { } this.namespace = namespace; + this.errorInfo = null; + } + + /** + * Creates a new instance with the provided {@code namespace}. + * + * @param namespace The service namespace of the error. + * @param errorInfo Additional information associated with the error. + * + * @throws IllegalArgumentException when {@code namespace} is {@code null} or empty. + */ + public AmqpErrorContext(String namespace, Map errorInfo) { + if (CoreUtils.isNullOrEmpty(namespace)) { + throw new IllegalArgumentException("'namespace' cannot be null or empty"); + } + + this.namespace = namespace; + this.errorInfo = Objects.requireNonNull(errorInfo, "'errorInfo' cannot be null."); } /** @@ -48,6 +71,15 @@ public String getNamespace() { return namespace; } + /** + * Gets the map carrying information about the error condition. + * + * @return Map carrying additional information about the error. + */ + public Map getErrorInfo() { + return errorInfo != null ? Collections.unmodifiableMap(errorInfo) : Collections.emptyMap(); + } + /** * Creates a string representation of this ErrorContext. * @@ -55,6 +87,15 @@ public String getNamespace() { */ @Override public String toString() { - return String.format(Locale.US, "NAMESPACE: %s", getNamespace()); + final String formatString = "NAMESPACE: %s. ERROR CONTEXT: %s"; + + if (errorInfo == null) { + return String.format(Locale.ROOT, formatString, getNamespace(), "N/A"); + } + + final StringBuilder builder = new StringBuilder(); + errorInfo.forEach((key, value) -> builder.append(String.format("[%s: %s], ", key, value))); + + return String.format(Locale.ROOT, formatString, getNamespace(), builder.toString()); } } diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpException.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpException.java index f240014e1120..d967ff261c99 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpException.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpException.java @@ -12,6 +12,8 @@ * General exception for AMQP related failures. * * @see AmqpErrorCondition + * @see Amqp + * Error * @see Azure Messaging * Exceptions */ diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpResponseCode.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpResponseCode.java index 44dd950c02cc..0c60672f3070 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpResponseCode.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpResponseCode.java @@ -59,11 +59,11 @@ public enum AmqpResponseCode { GATEWAY_TIMEOUT(504), HTTP_VERSION_NOT_SUPPORTED(505); - private static Map valueMap = new HashMap<>(); + private static final Map VALUE_MAP = new HashMap<>(); static { for (AmqpResponseCode code : AmqpResponseCode.values()) { - valueMap.put(code.value, code); + VALUE_MAP.put(code.value, code); } } @@ -81,7 +81,7 @@ public enum AmqpResponseCode { * is found. */ public static AmqpResponseCode fromValue(final int value) { - return valueMap.get(value); + return VALUE_MAP.get(value); } /** diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/exception/AmqpErrorContextTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/exception/AmqpErrorContextTest.java index 572656f6c1a8..5362e8d6feb6 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/exception/AmqpErrorContextTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/exception/AmqpErrorContextTest.java @@ -6,6 +6,9 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import java.util.HashMap; +import java.util.Map; + import static org.junit.jupiter.api.Assertions.assertThrows; public class AmqpErrorContextTest { @@ -22,6 +25,37 @@ public void constructor() { // Assert Assertions.assertEquals(namespace, context.getNamespace()); + + final Map actual = context.getErrorInfo(); + Assertions.assertNotNull(actual); + Assertions.assertTrue(actual.isEmpty()); + } + + /** + * Verifies properties set correctly. + */ + @Test + public void constructorErrorInfo() { + // Arrange + String namespace = "an-namespace-test"; + Map expected = new HashMap<>(); + expected.put("foo", 1); + expected.put("bar", 11); + + // Act + AmqpErrorContext context = new AmqpErrorContext(namespace, expected); + + // Assert + Assertions.assertEquals(namespace, context.getNamespace()); + + final Map actual = context.getErrorInfo(); + Assertions.assertNotNull(actual); + Assertions.assertEquals(expected.size(), actual.size()); + + expected.forEach((key, value) -> { + Assertions.assertTrue(actual.containsKey(key)); + Assertions.assertEquals(value, actual.get(key)); + }); } /** From fe32bd8779e8286009ca2514d13231cf7cc4ecc3 Mon Sep 17 00:00:00 2001 From: Kushagra Thapar Date: Fri, 4 Jun 2021 13:51:11 -0700 Subject: [PATCH 42/53] Fixed mapping cosmos converter to handle value nodes (#22073) * Added value query suport to spring data cosmos query annotation * Fixed mapping cosmos converter regression --- .../integration/AnnotatedQueryIT.java | 46 +++++++++++++++++++ .../integration/ContactRepositoryIT.java | 25 ++++++++-- .../repository/AddressRepository.java | 9 ++++ .../repository/ContactRepository.java | 6 +++ .../core/convert/MappingCosmosConverter.java | 10 ++-- 5 files changed, 88 insertions(+), 8 deletions(-) diff --git a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/integration/AnnotatedQueryIT.java b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/integration/AnnotatedQueryIT.java index a343c5e2f8eb..2c62255b0acb 100644 --- a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/integration/AnnotatedQueryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/integration/AnnotatedQueryIT.java @@ -11,6 +11,7 @@ import com.azure.spring.data.cosmos.repository.TestRepositoryConfig; import com.azure.spring.data.cosmos.repository.repository.AddressRepository; import com.azure.spring.data.cosmos.repository.repository.AuditableRepository; +import com.fasterxml.jackson.databind.JsonNode; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; @@ -25,6 +26,7 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; +import java.util.stream.Collectors; import static com.azure.spring.data.cosmos.common.PageTestUtils.validateLastPage; import static com.azure.spring.data.cosmos.common.PageTestUtils.validateNonLastPage; @@ -111,6 +113,50 @@ public void testAnnotatedQueryWithSort() { assertAddressOrder(resultsDesc, Address.TEST_ADDRESS2_PARTITION1, Address.TEST_ADDRESS1_PARTITION1); } + @Test + public void testAnnotatedQueryWithValueAsPage() { + final List
addresses = Arrays.asList(Address.TEST_ADDRESS1_PARTITION1, Address.TEST_ADDRESS2_PARTITION1); + addressRepository.saveAll(addresses); + + final PageRequest cosmosPageRequest = CosmosPageRequest.of(0, 10); + final Page postalCodes = addressRepository.annotatedFindPostalCodeValuesByCity(TestConstants.CITY, + cosmosPageRequest); + + assertAddressPostalCodes(postalCodes.getContent(), addresses); + } + + @Test + public void testAnnotatedQueryWithValueAsList() { + final List
addresses = Arrays.asList(Address.TEST_ADDRESS1_PARTITION1, Address.TEST_ADDRESS2_PARTITION1); + addressRepository.saveAll(addresses); + + final List postalCodes = addressRepository.annotatedFindPostalCodeValuesByCity(TestConstants.CITY); + + assertAddressPostalCodes(postalCodes, addresses); + } + + @Test + public void testAnnotatedQueryWithJsonNodeAsPage() { + final List
addresses = Arrays.asList(Address.TEST_ADDRESS1_PARTITION1, Address.TEST_ADDRESS2_PARTITION1); + addressRepository.saveAll(addresses); + + final PageRequest cosmosPageRequest = CosmosPageRequest.of(0, 10); + final Page postalCodes = addressRepository.annotatedFindPostalCodesByCity(TestConstants.CITY, + cosmosPageRequest); + final List actualPostalCodes = postalCodes.getContent() + .stream() + .map(jsonNode -> jsonNode.get("postalCode").asText()) + .collect(Collectors.toList()); + assertAddressPostalCodes(actualPostalCodes, addresses); + } + + private void assertAddressPostalCodes(List postalCodes, List
expectedResults) { + List expectedPostalCodes = expectedResults.stream() + .map(Address::getPostalCode) + .collect(Collectors.toList()); + assertThat(postalCodes).isEqualTo(expectedPostalCodes); + } + private void assertAddressOrder(List
actualResults, Address ... expectedResults) { assertThat(actualResults.size()).isEqualTo(expectedResults.length); for (int i = 0; i < expectedResults.length; i++) { diff --git a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/integration/ContactRepositoryIT.java b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/integration/ContactRepositoryIT.java index 67fd40e5234b..bef63c503ffb 100644 --- a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/integration/ContactRepositoryIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/integration/ContactRepositoryIT.java @@ -34,11 +34,14 @@ @ContextConfiguration(classes = TestRepositoryConfig.class) public class ContactRepositoryIT { - private static final Contact TEST_CONTACT1 = new Contact("testId", "faketitle", 25, true); - private static final Contact TEST_CONTACT2 = new Contact("testId2", "faketitle2", 32, false); - private static final Contact TEST_CONTACT3 = new Contact("testId3", "faketitle3", 25, false); - private static final Contact TEST_CONTACT4 = new Contact("testId4", "faketitle4", 43, true); - private static final Contact TEST_CONTACT5 = new Contact("testId5", "faketitle3", 43, true); + private static final Integer INT_VALUE_1 = 25; + private static final Integer INT_VALUE_2 = 32; + private static final Integer INT_VALUE_3 = 43; + private static final Contact TEST_CONTACT1 = new Contact("testId", "faketitle", INT_VALUE_1, true); + private static final Contact TEST_CONTACT2 = new Contact("testId2", "faketitle2", INT_VALUE_2, false); + private static final Contact TEST_CONTACT3 = new Contact("testId3", "faketitle3", INT_VALUE_1, false); + private static final Contact TEST_CONTACT4 = new Contact("testId4", "faketitle4", INT_VALUE_3, true); + private static final Contact TEST_CONTACT5 = new Contact("testId5", "faketitle3", INT_VALUE_3, true); @ClassRule public static final IntegrationTestCollectionManager collectionManager = new IntegrationTestCollectionManager(); @@ -245,4 +248,16 @@ public void testAnnotatedQueries() { List groupByContacts = repository.selectGroupBy(); Assert.assertEquals(3, groupByContacts.size()); } + + @Test + public void testAnnotatedQueriesDistinctIntValue() { + List valueContacts = repository.findDistinctIntValueValues(); + assertThat(valueContacts).isEqualTo(Arrays.asList(INT_VALUE_1, INT_VALUE_2, INT_VALUE_3)); + } + + @Test + public void testAnnotatedQueriesDistinctStatus() { + List statusContacts = repository.findDistinctStatusValues(); + assertThat(statusContacts).isEqualTo(Arrays.asList(Boolean.TRUE, Boolean.FALSE)); + } } diff --git a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/repository/AddressRepository.java b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/repository/AddressRepository.java index 6e5824a70de2..f4054e5d8198 100644 --- a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/repository/AddressRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/repository/AddressRepository.java @@ -5,6 +5,7 @@ import com.azure.spring.data.cosmos.domain.Address; import com.azure.spring.data.cosmos.repository.CosmosRepository; import com.azure.spring.data.cosmos.repository.Query; +import com.fasterxml.jackson.databind.JsonNode; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; @@ -36,4 +37,12 @@ public interface AddressRepository extends CosmosRepository { @Query("select * from a where a.city = @city") List
annotatedFindByCity(@Param("city") String city, Sort pageable); + @Query("select DISTINCT value a.postalCode from a where a.city = @city") + Page annotatedFindPostalCodeValuesByCity(@Param("city") String city, Pageable pageable); + + @Query("select DISTINCT a.postalCode from a where a.city = @city") + Page annotatedFindPostalCodesByCity(@Param("city") String city, Pageable pageable); + + @Query("select DISTINCT value a.postalCode from a where a.city = @city") + List annotatedFindPostalCodeValuesByCity(@Param("city") String city); } diff --git a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/repository/ContactRepository.java b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/repository/ContactRepository.java index 1e4bfda3cd50..fb8a8afaa7c8 100644 --- a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/repository/ContactRepository.java +++ b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/repository/repository/ContactRepository.java @@ -44,4 +44,10 @@ public interface ContactRepository extends CosmosRepository { @Query(value = "SELECT count(c.id) as id_count, c.intValue FROM c group by c.intValue") List selectGroupBy(); + @Query(value = "Select DISTINCT value c.intValue from c") + List findDistinctIntValueValues(); + + @Query(value = "Select DISTINCT value c.active from c") + List findDistinctStatusValues(); + } diff --git a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/convert/MappingCosmosConverter.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/convert/MappingCosmosConverter.java index 6c8a7f4472ca..556a79f7ea43 100644 --- a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/convert/MappingCosmosConverter.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/convert/MappingCosmosConverter.java @@ -62,7 +62,6 @@ public MappingCosmosConverter( public R read(Class type, JsonNode jsonNode) { final CosmosPersistentEntity entity = mappingContext.getPersistentEntity(type); - Assert.notNull(entity, "Entity is null."); return readInternal(entity, type, jsonNode); } @@ -74,8 +73,13 @@ public void write(Object source, JsonNode sink) { private R readInternal(final CosmosPersistentEntity entity, Class type, final JsonNode jsonNode) { - final ObjectNode objectNode = jsonNode.deepCopy(); try { + if (jsonNode.isValueNode()) { + return objectMapper.treeToValue(jsonNode, type); + } + + Assert.notNull(entity, "Entity is null."); + final ObjectNode objectNode = jsonNode.deepCopy(); final CosmosPersistentProperty idProperty = entity.getIdProperty(); final JsonNode idValue = jsonNode.get("id"); if (idProperty != null) { @@ -90,7 +94,7 @@ private R readInternal(final CosmosPersistentEntity entity, Class type return objectMapper.treeToValue(objectNode, type); } catch (JsonProcessingException e) { throw new IllegalStateException("Failed to read the source document " - + objectNode.toPrettyString() + + jsonNode.toPrettyString() + " to target type " + type, e); } From f6094de465f986d4d836a520df52df46cd932c4e Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Fri, 4 Jun 2021 14:16:13 -0700 Subject: [PATCH 43/53] Test Wagon Changes to Determine Install Performance (#22082) Wagon Changes to Improve Install Performance --- eng/pipelines/templates/variables/globals.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/templates/variables/globals.yml b/eng/pipelines/templates/variables/globals.yml index a40f373699a1..4d3cb3037422 100644 --- a/eng/pipelines/templates/variables/globals.yml +++ b/eng/pipelines/templates/variables/globals.yml @@ -8,7 +8,8 @@ variables: # Maven build/test options MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository # See https://github.com/actions/virtual-environments/issues/1499 for more info about the wagon options - WagonOptions: '-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120' + # If reports about Maven dependency downloads become more common investigate re-introducing "-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false", or other iterations of the configurations. + WagonOptions: '-Dmaven.wagon.httpconnectionManager.ttlSeconds=60' DefaultOptions: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) --batch-mode --fail-at-end --settings eng/settings.xml $(WagonOptions)' LoggingOptions: '-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' MemoryOptions: '-Xmx3072m' From ad00d7345ec6646fcd92f89b8f6737e3d1010347 Mon Sep 17 00:00:00 2001 From: Kamil Sobol <61715331+kasobol-msft@users.noreply.github.com> Date: Fri, 4 Jun 2021 14:31:56 -0700 Subject: [PATCH 44/53] [Storage] Use FluxUtil for reliable download. (#22080) * first draft. * indent. * npes. * timeout. * fix empty case. * checkstyle * tests --- sdk/storage/azure-storage-blob-batch/pom.xml | 2 +- .../azure-storage-blob-changefeed/pom.xml | 2 +- .../azure-storage-blob-cryptography/pom.xml | 2 +- sdk/storage/azure-storage-blob-nio/pom.xml | 2 +- sdk/storage/azure-storage-blob/pom.xml | 2 +- .../blob/specialized/BlobAsyncClientBase.java | 93 ++++++-- .../blob/specialized/ReliableDownload.java | 4 + .../specialized/DownloadResponseMockFlux.java | 201 +++++++++--------- .../specialized/DownloadResponseTest.groovy | 83 ++------ sdk/storage/azure-storage-common/pom.xml | 2 +- .../azure-storage-file-datalake/pom.xml | 2 +- sdk/storage/azure-storage-file-share/pom.xml | 2 +- .../azure-storage-internal-avro/pom.xml | 2 +- sdk/storage/azure-storage-queue/pom.xml | 2 +- 14 files changed, 203 insertions(+), 198 deletions(-) diff --git a/sdk/storage/azure-storage-blob-batch/pom.xml b/sdk/storage/azure-storage-blob-batch/pom.xml index 251ae27e2548..e6e14a06114f 100644 --- a/sdk/storage/azure-storage-blob-batch/pom.xml +++ b/sdk/storage/azure-storage-blob-batch/pom.xml @@ -55,7 +55,7 @@ com.azure azure-core - 1.16.0 + 1.17.0-beta.1 com.azure diff --git a/sdk/storage/azure-storage-blob-changefeed/pom.xml b/sdk/storage/azure-storage-blob-changefeed/pom.xml index 11ecec1ac340..1582739b3151 100644 --- a/sdk/storage/azure-storage-blob-changefeed/pom.xml +++ b/sdk/storage/azure-storage-blob-changefeed/pom.xml @@ -55,7 +55,7 @@ com.azure azure-core - 1.16.0 + 1.17.0-beta.1 com.azure diff --git a/sdk/storage/azure-storage-blob-cryptography/pom.xml b/sdk/storage/azure-storage-blob-cryptography/pom.xml index 95825cfc323a..622979d0e901 100644 --- a/sdk/storage/azure-storage-blob-cryptography/pom.xml +++ b/sdk/storage/azure-storage-blob-cryptography/pom.xml @@ -41,7 +41,7 @@ com.azure azure-core - 1.16.0 + 1.17.0-beta.1 com.azure diff --git a/sdk/storage/azure-storage-blob-nio/pom.xml b/sdk/storage/azure-storage-blob-nio/pom.xml index 2e67e0d33ceb..e3610092b4c3 100644 --- a/sdk/storage/azure-storage-blob-nio/pom.xml +++ b/sdk/storage/azure-storage-blob-nio/pom.xml @@ -54,7 +54,7 @@ com.azure azure-core - 1.16.0 + 1.17.0-beta.1 com.azure diff --git a/sdk/storage/azure-storage-blob/pom.xml b/sdk/storage/azure-storage-blob/pom.xml index e82cd56ae7fd..2a7518c01e11 100644 --- a/sdk/storage/azure-storage-blob/pom.xml +++ b/sdk/storage/azure-storage-blob/pom.xml @@ -55,7 +55,7 @@ com.azure azure-core - 1.16.0 + 1.17.0-beta.1 com.azure diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java index a4c4902d264d..a66ec7984c10 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java @@ -10,6 +10,7 @@ import com.azure.core.http.RequestConditions; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.http.rest.StreamResponse; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; @@ -22,12 +23,12 @@ import com.azure.storage.blob.BlobContainerClientBuilder; import com.azure.storage.blob.BlobServiceAsyncClient; import com.azure.storage.blob.BlobServiceVersion; -import com.azure.storage.blob.HttpGetterInfo; import com.azure.storage.blob.ProgressReporter; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.implementation.AzureBlobStorageImplBuilder; import com.azure.storage.blob.implementation.models.BlobTag; import com.azure.storage.blob.implementation.models.BlobTags; +import com.azure.storage.blob.implementation.models.BlobsDownloadHeaders; import com.azure.storage.blob.implementation.models.BlobsGetAccountInfoHeaders; import com.azure.storage.blob.implementation.models.BlobsGetPropertiesHeaders; import com.azure.storage.blob.implementation.models.BlobsStartCopyFromURLHeaders; @@ -99,6 +100,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -120,6 +122,7 @@ public class BlobAsyncClientBase { private final ClientLogger logger = new ClientLogger(BlobAsyncClientBase.class); + private static final Duration TIMEOUT_VALUE = Duration.ofSeconds(60); protected final AzureBlobStorageImpl azureBlobStorage; private final String snapshot; @@ -1002,32 +1005,78 @@ public Mono downloadContentWithResponse( Mono downloadStreamWithResponse(BlobRange range, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean getRangeContentMd5, Context context) { - return downloadHelper(range, options, requestConditions, getRangeContentMd5, context) - .map(response -> new BlobDownloadAsyncResponse(response.getRequest(), response.getStatusCode(), - response.getHeaders(), response.getValue(), response.getDeserializedHeaders())); - } - - private Mono downloadHelper(BlobRange range, DownloadRetryOptions options, - BlobRequestConditions requestConditions, boolean getRangeContentMd5, Context context) { - range = range == null ? new BlobRange(0) : range; + BlobRange finalRange = range == null ? new BlobRange(0) : range; Boolean getMD5 = getRangeContentMd5 ? getRangeContentMd5 : null; - requestConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; - HttpGetterInfo info = new HttpGetterInfo() - .setOffset(range.getOffset()) - .setCount(range.getCount()) - .setETag(requestConditions.getIfMatch()); + BlobRequestConditions finalRequestConditions = + requestConditions == null ? new BlobRequestConditions() : requestConditions; + DownloadRetryOptions finalOptions = (options == null) ? new DownloadRetryOptions() : options; + + return downloadRange(finalRange, finalRequestConditions, finalRequestConditions.getIfMatch(), getMD5, context) + .map(response -> { + String eTag = ModelHelper.getETag(response.getHeaders()); + BlobsDownloadHeaders blobsDownloadHeaders = + ModelHelper.transformBlobDownloadHeaders(response.getHeaders()); + BlobDownloadHeaders blobDownloadHeaders = ModelHelper.populateBlobDownloadHeaders( + blobsDownloadHeaders, ModelHelper.getErrorCode(response.getHeaders())); + + /* + If the customer did not specify a count, they are reading to the end of the blob. Extract this value + from the response for better book keeping towards the end. + */ + long finalCount; + if (finalRange.getCount() == null) { + long blobLength = BlobAsyncClientBase.getBlobLength(blobDownloadHeaders); + finalCount = blobLength - finalRange.getOffset(); + } else { + finalCount = finalRange.getCount(); + } + Flux bufferFlux = FluxUtil.createRetriableDownloadFlux( + () -> response.getValue().timeout(TIMEOUT_VALUE), + (throwable, offset) -> { + if (!(throwable instanceof IOException || throwable instanceof TimeoutException)) { + return Flux.error(throwable); + } + + long newCount = finalCount - (offset - finalRange.getOffset()); + + /* + It is possible that the network stream will throw an error after emitting all data but before + completing. Issuing a retry at this stage would leave the download in a bad state with incorrect count + and offset values. Because we have read the intended amount of data, we can ignore the error at the end + of the stream. + */ + if (newCount == 0) { + logger.warning("Exception encountered in ReliableDownload after all data read from the network but " + + "but before stream signaled completion. Returning success as all data was downloaded. " + + "Exception message: " + throwable.getMessage()); + return Flux.empty(); + } + + try { + return downloadRange( + new BlobRange(offset, newCount), finalRequestConditions, eTag, getMD5, context) + .flatMapMany(r -> r.getValue().timeout(TIMEOUT_VALUE)); + } catch (Exception e) { + return Flux.error(e); + } + }, + finalOptions.getMaxRetryRequests(), + finalRange.getOffset() + ).switchIfEmpty(Flux.just(ByteBuffer.wrap(new byte[0]))); + + return new BlobDownloadAsyncResponse(response.getRequest(), response.getStatusCode(), + response.getHeaders(), bufferFlux, blobDownloadHeaders); + }); + } + + private Mono downloadRange(BlobRange range, BlobRequestConditions requestConditions, + String eTag, Boolean getMD5, Context context) { return azureBlobStorage.getBlobs().downloadWithResponseAsync(containerName, blobName, snapshot, versionId, null, range.toHeaderValue(), requestConditions.getLeaseId(), getMD5, null, requestConditions.getIfModifiedSince(), - requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), + requestConditions.getIfUnmodifiedSince(), eTag, requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, - customerProvidedKey, context) - .map(response -> { - info.setETag(ModelHelper.getETag(response.getHeaders())); - return new ReliableDownload(response, options, info, updatedInfo -> - downloadHelper(new BlobRange(updatedInfo.getOffset(), updatedInfo.getCount()), options, - new BlobRequestConditions().setIfMatch(info.getETag()), false, context)); - }); + customerProvidedKey, context); } /** diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/ReliableDownload.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/ReliableDownload.java index e4beb945fa2b..1c30ea56f84c 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/ReliableDownload.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/ReliableDownload.java @@ -20,7 +20,9 @@ import java.nio.ByteBuffer; import java.time.Duration; import java.util.concurrent.TimeoutException; +import java.util.function.BiFunction; import java.util.function.Function; +import java.util.function.Supplier; /** * This class automatically retries failed reads from a blob download stream. @@ -30,7 +32,9 @@ * will be resumed from the point where the download failed. This allows for the download to be consumed as one * continuous stream. *

+ * @deprecated use {@link com.azure.core.util.FluxUtil#createRetriableDownloadFlux(Supplier, BiFunction, int)} instead. */ +@Deprecated final class ReliableDownload { private final ClientLogger logger = new ClientLogger(ReliableDownload.class); diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseMockFlux.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseMockFlux.java index c308e78077d2..541127c9a851 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseMockFlux.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseMockFlux.java @@ -3,11 +3,12 @@ package com.azure.storage.blob.specialized; +import com.azure.core.http.HttpHeader; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.StreamResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.test.http.MockHttpResponse; import com.azure.storage.blob.APISpec; -import com.azure.storage.blob.HttpGetterInfo; import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.models.DownloadRetryOptions; import reactor.core.publisher.Flux; @@ -26,7 +27,6 @@ class DownloadResponseMockFlux { static final int DR_TEST_SCENARIO_MAX_RETRIES_EXCEEDED = 3; // We appropriate honor max retries static final int DR_TEST_SCENARIO_NON_RETRYABLE_ERROR = 4; // We will not retry on a non-retryable error static final int DR_TEST_SCENARIO_ERROR_GETTER_MIDDLE = 6; // Throwing an error from the getter - static final int DR_TEST_SCENARIO_INFO_TEST = 8; // Initial info values are honored static final int DR_TEST_SCENARIO_NO_MULTIPLE_SUBSCRIPTION = 9; // We do not subscribe to the same stream twice static final int DR_TEST_SCENARIO_TIMEOUT = 10; // ReliableDownload with timeout after not receiving items for 60s static final int DR_TEST_SCENARIO_ERROR_AFTER_ALL_DATA = 11; // Don't actually issue another retry if we've read all the data and the source failed at the end @@ -35,7 +35,6 @@ class DownloadResponseMockFlux { private final ByteBuffer scenarioData; private int tryNumber; - private HttpGetterInfo info; private DownloadRetryOptions options; private boolean subscribed = false; // Only used for multiple subscription test. @@ -54,7 +53,6 @@ class DownloadResponseMockFlux { case DR_TEST_SCENARIO_MAX_RETRIES_EXCEEDED: case DR_TEST_SCENARIO_NON_RETRYABLE_ERROR: case DR_TEST_SCENARIO_ERROR_GETTER_MIDDLE: - case DR_TEST_SCENARIO_INFO_TEST: case DR_TEST_SCENARIO_TIMEOUT: this.scenarioData = apiSpec.getRandomData(1024); break; @@ -66,12 +64,11 @@ class DownloadResponseMockFlux { /* For internal construction on NO_MULTIPLE_SUBSCRIPTION test */ - DownloadResponseMockFlux(int scenario, int tryNumber, ByteBuffer scenarioData, HttpGetterInfo info, + DownloadResponseMockFlux(int scenario, int tryNumber, ByteBuffer scenarioData, DownloadRetryOptions options) { this.scenario = scenario; this.tryNumber = tryNumber; this.scenarioData = scenarioData; - this.info = info; this.options = options; } @@ -83,12 +80,7 @@ int getTryNumber() { return this.tryNumber; } - DownloadResponseMockFlux setOptions(DownloadRetryOptions options) { - this.options = options; - return this; - } - - private Flux getDownloadStream() { + private Flux getDownloadStream(long offset, Long count) { switch (this.scenario) { case DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK: return Flux.just(scenarioData.duplicate()); @@ -112,8 +104,8 @@ private Flux getDownloadStream() { case DR_TEST_SCENARIO_SUCCESSFUL_STREAM_FAILURES: if (this.tryNumber <= 3) { // tryNumber is 1 indexed, so we have to sub 1. - if (this.info.getOffset() != (this.tryNumber - 1) * 256 - || this.info.getCount() != this.scenarioData.remaining() - (this.tryNumber - 1) * 256) { + if (offset != (this.tryNumber - 1) * 256 + || count != this.scenarioData.remaining() - (this.tryNumber - 1) * 256) { return Flux.error(new IllegalArgumentException("Info values are incorrect.")); } @@ -128,8 +120,8 @@ private Flux getDownloadStream() { return dataStream.concatWith(Flux.error(e)); } - if (this.info.getOffset() != (this.tryNumber - 1) * 256 - || this.info.getCount() != this.scenarioData.remaining() - (this.tryNumber - 1) * 256) { + if (offset != (this.tryNumber - 1) * 256 + || count != this.scenarioData.remaining() - (this.tryNumber - 1) * 256) { return Flux.error(new IllegalArgumentException("Info values are incorrect.")); } ByteBuffer toSend = this.scenarioData.duplicate(); @@ -156,18 +148,6 @@ private Flux getDownloadStream() { ? Flux.error(new IOException()) : Flux.error(new IllegalArgumentException("Retried after getter error.")); - case DR_TEST_SCENARIO_INFO_TEST: - switch (this.tryNumber) { - case 1: // Test the value of info when getting the initial response. - case 2: // Test the value of info when getting an intermediate response. - return Flux.error(new IOException()); - case 3: - // All calls to getter checked. Exit. This test does not check for data. - return Flux.empty(); - default: - return Flux.error(new IllegalArgumentException("Invalid try number.")); - } - case DR_TEST_SCENARIO_TIMEOUT: return Flux.just(scenarioData.duplicate()).delayElements(Duration.ofSeconds(61)); @@ -176,79 +156,98 @@ private Flux getDownloadStream() { } } - Mono getter(HttpGetterInfo info) { - this.tryNumber++; - this.info = info; - long contentUpperBound = info.getCount() == null - ? this.scenarioData.remaining() - 1 : info.getOffset() + info.getCount() - 1; - StreamResponse rawResponse = new StreamResponse(null, 200, new HttpHeaders().put("Content-Range", String.format("%d-%d/%d", - info.getOffset(), contentUpperBound, this.scenarioData.remaining())), this.getDownloadStream()); - ReliableDownload response = new ReliableDownload(rawResponse, options, info, this::getter); - - switch (this.scenario) { - case DR_TEST_SCENARIO_ERROR_GETTER_MIDDLE: - switch (this.tryNumber) { - case 1: - return Mono.just(response); - case 2: - /* - This validates that we don't retry in the getter even if it's a retryable error from the - service. - */ - throw new BlobStorageException("Message", new HttpResponse(null) { - @Override - public int getStatusCode() { - return 500; - } - - @Override - public String getHeaderValue(String s) { - return null; - } - - @Override - public HttpHeaders getHeaders() { - return null; - } - - @Override - public Flux getBody() { - return null; - } - - @Override - public Mono getBodyAsByteArray() { - return null; - } - - @Override - public Mono getBodyAsString() { - return null; - } - - @Override - public Mono getBodyAsString(Charset charset) { - return null; - } - }, null); - default: - throw new IllegalArgumentException("Retried after error in getter"); + HttpPipelinePolicy asPolicy() { + return (context, next) -> { + tryNumber++; + HttpHeader rangeHeader = context.getHttpRequest().getHeaders().get("x-ms-range"); + String eTag = context.getHttpRequest().getHeaders().getValue("if-match"); + long offset = 0; + Long count = null; + if (rangeHeader != null) { + String[] ranges = rangeHeader.getValue().replace("bytes=", "").split("-"); + offset = Long.parseLong(ranges[0]); + if (ranges.length > 1) { + count = Long.parseLong(ranges[1]) - offset + 1; } - case DR_TEST_SCENARIO_INFO_TEST: - // We also test that the info is updated in DR_TEST_SCENARIO_SUCCESSFUL_STREAM_FAILURES. - if (info.getCount() != 10 || info.getOffset() != 20 || !info.getETag().equals("etag")) { - throw new IllegalArgumentException("Info values incorrect"); + } + long finalOffset = offset; + Long finalCount = count; + + MockHttpResponse response = new MockHttpResponse(null, 200) { + @Override + public Flux getBody() { + return getDownloadStream(finalOffset, finalCount); } - return Mono.just(response); - case DR_TEST_SCENARIO_NO_MULTIPLE_SUBSCRIPTION: - // Construct a new flux each time to mimic getting a new download stream. - DownloadResponseMockFlux nextFlux = new DownloadResponseMockFlux(this.scenario, this.tryNumber, - this.scenarioData, this.info, this.options); - rawResponse = new StreamResponse(null, 200, new HttpHeaders(), nextFlux.getDownloadStream()); - response = new ReliableDownload(rawResponse, options, info, this::getter); - return Mono.just(response); - default: - return Mono.just(response); - } + }; + long contentUpperBound = finalCount == null + ? this.scenarioData.remaining() - 1 : finalOffset + finalCount - 1; + response.addHeader("Content-Range", String.format("%d-%d/%d", + finalOffset, contentUpperBound, this.scenarioData.remaining())); + + switch (scenario) { + case DR_TEST_SCENARIO_ERROR_GETTER_MIDDLE: + switch (tryNumber) { + case 1: + return Mono.just(response); + case 2: + /* + This validates that we don't retry in the getter even if it's a retryable error from the + service. + */ + throw new BlobStorageException("Message", new HttpResponse(null) { + @Override + public int getStatusCode() { + return 500; + } + + @Override + public String getHeaderValue(String s) { + return null; + } + + @Override + public HttpHeaders getHeaders() { + return null; + } + + @Override + public Flux getBody() { + return null; + } + + @Override + public Mono getBodyAsByteArray() { + return null; + } + + @Override + public Mono getBodyAsString() { + return null; + } + + @Override + public Mono getBodyAsString(Charset charset) { + return null; + } + }, null); + default: + throw new IllegalArgumentException("Retried after error in getter"); + } + case DR_TEST_SCENARIO_NO_MULTIPLE_SUBSCRIPTION: + // Construct a new flux each time to mimic getting a new download stream. + // Construct a new flux each time to mimic getting a new download stream. + DownloadResponseMockFlux nextFlux = new DownloadResponseMockFlux(this.scenario, this.tryNumber, + this.scenarioData, this.options); + MockHttpResponse newResponse = new MockHttpResponse(null, 200) { + @Override + public Flux getBody() { + return nextFlux.getDownloadStream(finalOffset, finalCount); + } + }; + return Mono.just(newResponse); + default: + return Mono.just(response); + } + }; } } diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseTest.groovy index cba9469e2eda..4ee065002eb1 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseTest.groovy @@ -12,6 +12,8 @@ import com.azure.core.http.policy.HttpPipelinePolicy import com.azure.core.util.FluxUtil import com.azure.storage.blob.APISpec import com.azure.storage.blob.HttpGetterInfo +import com.azure.storage.blob.models.BlobRange +import com.azure.storage.blob.models.BlobRequestConditions import com.azure.storage.blob.models.BlobStorageException import com.azure.storage.blob.models.DownloadRetryOptions import reactor.core.Exceptions @@ -73,15 +75,15 @@ class DownloadResponseTest extends APISpec { setup: DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario, this) - HttpGetterInfo info = new HttpGetterInfo() - .setOffset(0) - .setCount(setCount ? flux.getScenarioData().remaining() : null) - .setETag("etag") - DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5) + def bsc = getServiceClientBuilder(env.primaryAccount.credential, primaryBlobServiceClient.getAccountUrl(), flux.asPolicy()).buildAsyncClient() + def cc = bsc.getBlobContainerAsyncClient(containerName) + def bu = cc.getBlobAsyncClient(bu.getBlobName()).getBlockBlobAsyncClient() + BlobRange range = setCount ? new BlobRange(0, flux.getScenarioData().remaining()) : new BlobRange(0); + when: - ReliableDownload response = flux.setOptions(options).getter(info).block() + def response = bu.downloadStreamWithResponse(range, options, null, false).block() then: FluxUtil.collectBytesInByteBufferStream(response.getValue()).block() == flux.getScenarioData().array() @@ -103,10 +105,13 @@ class DownloadResponseTest extends APISpec { setup: DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario, this) DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5) - HttpGetterInfo info = new HttpGetterInfo().setETag("etag") + + def bsc = getServiceClientBuilder(env.primaryAccount.credential, primaryBlobServiceClient.getAccountUrl(), flux.asPolicy()).buildAsyncClient() + def cc = bsc.getBlobContainerAsyncClient(containerName) + def bu = cc.getBlobAsyncClient(bu.getBlobName()).getBlockBlobAsyncClient() when: - ReliableDownload response = flux.setOptions(options).getter(info).block() + def response = bu.downloadStreamWithResponse(null, options, null, false).block() response.getValue().blockFirst() then: @@ -124,71 +129,19 @@ class DownloadResponseTest extends APISpec { DownloadResponseMockFlux.DR_TEST_SCENARIO_ERROR_GETTER_MIDDLE | BlobStorageException | 2 } - @Unroll - def "Info null IA"() { - setup: - DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK, this) - def info = null - - when: - new ReliableDownload(null, null, info, { HttpGetterInfo newInfo -> flux.getter(newInfo) }) - - then: - thrown(NullPointerException) - } - - def "Options IA"() { - when: - new DownloadRetryOptions().setMaxRetryRequests(-1) - - then: - thrown(IllegalArgumentException) - } - - def "Getter IA"() { - when: - new ReliableDownload(null, null, new HttpGetterInfo().setETag("etag"), null) - - then: - thrown(NullPointerException) - } - - def "Info"() { - setup: - DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_INFO_TEST, this) - HttpGetterInfo info = new HttpGetterInfo() - .setOffset(20) - .setCount(10) - .setETag("etag") - - DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(5) - - when: - ReliableDownload response = flux.setOptions(options).getter(info).block() - response.getValue().blockFirst() - - then: - flux.getTryNumber() == 3 - } - - def "Info count IA"() { - when: - new HttpGetterInfo().setCount(-1) - - then: - thrown(IllegalArgumentException) - } - @Unroll def "Timeout"() { setup: DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_TIMEOUT, this) DownloadRetryOptions options = new DownloadRetryOptions().setMaxRetryRequests(retryCount) - HttpGetterInfo info = new HttpGetterInfo().setETag("etag") + + def bsc = getServiceClientBuilder(env.primaryAccount.credential, primaryBlobServiceClient.getAccountUrl(), flux.asPolicy()).buildAsyncClient() + def cc = bsc.getBlobContainerAsyncClient(containerName) + def bu = cc.getBlobAsyncClient(bu.getBlobName()).getBlockBlobAsyncClient() when: - def bufferMono = flux.setOptions(options).getter(info) + def bufferMono = bu.downloadStreamWithResponse(null, options, null, false) .flatMapMany({ it.getValue() }) then: diff --git a/sdk/storage/azure-storage-common/pom.xml b/sdk/storage/azure-storage-common/pom.xml index 964b85ba9228..b336eac75dc6 100644 --- a/sdk/storage/azure-storage-common/pom.xml +++ b/sdk/storage/azure-storage-common/pom.xml @@ -41,7 +41,7 @@ com.azure azure-core - 1.16.0 + 1.17.0-beta.1 com.azure diff --git a/sdk/storage/azure-storage-file-datalake/pom.xml b/sdk/storage/azure-storage-file-datalake/pom.xml index 2b61a30f0a8b..627718c5e434 100644 --- a/sdk/storage/azure-storage-file-datalake/pom.xml +++ b/sdk/storage/azure-storage-file-datalake/pom.xml @@ -55,7 +55,7 @@ com.azure azure-core - 1.16.0 + 1.17.0-beta.1 com.azure diff --git a/sdk/storage/azure-storage-file-share/pom.xml b/sdk/storage/azure-storage-file-share/pom.xml index 7316ccc3d029..417510e786f9 100644 --- a/sdk/storage/azure-storage-file-share/pom.xml +++ b/sdk/storage/azure-storage-file-share/pom.xml @@ -36,7 +36,7 @@ com.azure azure-core - 1.16.0 + 1.17.0-beta.1 com.azure diff --git a/sdk/storage/azure-storage-internal-avro/pom.xml b/sdk/storage/azure-storage-internal-avro/pom.xml index 76807a0dd76d..1db7025544b6 100644 --- a/sdk/storage/azure-storage-internal-avro/pom.xml +++ b/sdk/storage/azure-storage-internal-avro/pom.xml @@ -41,7 +41,7 @@ com.azure azure-core - 1.16.0 + 1.17.0-beta.1 com.azure diff --git a/sdk/storage/azure-storage-queue/pom.xml b/sdk/storage/azure-storage-queue/pom.xml index 944c56f45c0c..a90ac142b1eb 100644 --- a/sdk/storage/azure-storage-queue/pom.xml +++ b/sdk/storage/azure-storage-queue/pom.xml @@ -36,7 +36,7 @@ com.azure azure-core - 1.16.0 + 1.17.0-beta.1 com.azure From 3718d5c491a6949660965a8f2778092a2cddf92a Mon Sep 17 00:00:00 2001 From: Jianghao Lu Date: Fri, 4 Jun 2021 15:14:08 -0700 Subject: [PATCH 45/53] Rename confidential ledger package (#22056) * Rename confidential ledger package * Use 1.0.0-beta.2 as dependency version --- eng/.docsettings.yml | 2 +- .../resources/spotbugs/spotbugs-exclude.xml | 2 +- eng/versioning/version_client.txt | 2 +- pom.xml | 6 ++--- .../CHANGELOG.md | 8 ------- .../CHANGELOG.md | 9 ++++++++ .../README.md | 22 +++++++++---------- .../pom.xml | 4 ++-- .../ConfidentialLedgerBaseClient.java | 2 +- .../ConfidentialLedgerClientBuilder.java | 2 +- ...entialLedgerIdentityServiceBaseClient.java | 2 +- .../confidentialledger/package-info.java | 2 +- .../src/main/java/module-info.java | 4 ++-- .../src/samples/README.md | 0 .../confidentialledger/GetLedgerEntries.java | 2 +- .../confidentialledger/ReadmeSamples.java | 2 +- .../ConfidentialLedgerBaseClientTests.java | 2 +- .../ConfidentialLedgerClientTestBase.java | 2 +- ...edgerBaseClientTests.getLedgerEntries.json | 0 .../swagger/README.md | 2 +- sdk/confidentialledger/ci.yml | 4 ++-- sdk/confidentialledger/pom.xml | 8 +++---- 22 files changed, 45 insertions(+), 44 deletions(-) delete mode 100644 sdk/confidentialledger/azure-data-confidentialledger/CHANGELOG.md create mode 100644 sdk/confidentialledger/azure-security-confidentialledger/CHANGELOG.md rename sdk/confidentialledger/{azure-data-confidentialledger => azure-security-confidentialledger}/README.md (90%) rename sdk/confidentialledger/{azure-data-confidentialledger => azure-security-confidentialledger}/pom.xml (97%) rename sdk/confidentialledger/{azure-data-confidentialledger/src/main/java/com/azure/data => azure-security-confidentialledger/src/main/java/com/azure/security}/confidentialledger/ConfidentialLedgerBaseClient.java (99%) rename sdk/confidentialledger/{azure-data-confidentialledger/src/main/java/com/azure/data => azure-security-confidentialledger/src/main/java/com/azure/security}/confidentialledger/ConfidentialLedgerClientBuilder.java (99%) rename sdk/confidentialledger/{azure-data-confidentialledger/src/main/java/com/azure/data => azure-security-confidentialledger/src/main/java/com/azure/security}/confidentialledger/ConfidentialLedgerIdentityServiceBaseClient.java (98%) rename sdk/confidentialledger/{azure-data-confidentialledger/src/main/java/com/azure/data => azure-security-confidentialledger/src/main/java/com/azure/security}/confidentialledger/package-info.java (87%) rename sdk/confidentialledger/{azure-data-confidentialledger => azure-security-confidentialledger}/src/main/java/module-info.java (72%) rename sdk/confidentialledger/{azure-data-confidentialledger => azure-security-confidentialledger}/src/samples/README.md (100%) rename sdk/confidentialledger/{azure-data-confidentialledger/src/samples/java/com/azure/data => azure-security-confidentialledger/src/samples/java/com/azure/security}/confidentialledger/GetLedgerEntries.java (98%) rename sdk/confidentialledger/{azure-data-confidentialledger/src/samples/java/com/azure/data => azure-security-confidentialledger/src/samples/java/com/azure/security}/confidentialledger/ReadmeSamples.java (98%) rename sdk/confidentialledger/{azure-data-confidentialledger/src/test/java/com/azure/data => azure-security-confidentialledger/src/test/java/com/azure/security}/confidentialledger/ConfidentialLedgerBaseClientTests.java (97%) rename sdk/confidentialledger/{azure-data-confidentialledger/src/test/java/com/azure/data => azure-security-confidentialledger/src/test/java/com/azure/security}/confidentialledger/ConfidentialLedgerClientTestBase.java (98%) rename sdk/confidentialledger/{azure-data-confidentialledger => azure-security-confidentialledger}/src/test/resources/session-records/ConfidentialLedgerBaseClientTests.getLedgerEntries.json (100%) rename sdk/confidentialledger/{azure-data-confidentialledger => azure-security-confidentialledger}/swagger/README.md (94%) diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml index 7969d2e86802..da01b44b3466 100644 --- a/eng/.docsettings.yml +++ b/eng/.docsettings.yml @@ -128,7 +128,7 @@ known_content_issues: - ['sdk/communication/azure-communication-sms/swagger/README.md', '#3113'] - ['sdk/communication/azure-communication-identity/swagger/README.md', '#3113'] - ['sdk/communication/azure-communication-phonenumbers/swagger/README.md', '#3113'] - - ['sdk/confidentialledger/azure-data-confidentialledger/swagger/README.md', '#3113'] + - ['sdk/confidentialledger/azure-security-confidentialledger/swagger/README.md', '#3113'] - ['sdk/cosmos/changelog/README.md', '#3113'] - ['sdk/cosmos/faq/README.md', '#3113'] - ['sdk/cosmos/azure-cosmos-benchmark/README.md', '#3113'] diff --git a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml index b05c56ddaaf3..426a165f9677 100755 --- a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml +++ b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml @@ -2486,7 +2486,7 @@ - + diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 02927e62a7db..7c060b68a159 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -78,7 +78,6 @@ com.azure.cosmos.spark:azure-cosmos-spark_3-1_2-12;4.2.0-beta.1;4.2.0-beta.1 com.azure:azure-cosmos-encryption;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-data-appconfiguration;1.1.12;1.2.0-beta.2 com.azure:azure-data-appconfiguration-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-data-confidentialledger;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-data-schemaregistry;1.0.0-beta.4;1.0.0-beta.5 com.azure:azure-data-schemaregistry-avro;1.0.0-beta.4;1.0.0-beta.5 com.azure:azure-data-tables;12.0.0-beta.7;12.0.0-beta.8 @@ -105,6 +104,7 @@ com.azure:azure-quantum-jobs;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-search-documents;11.3.2;11.4.0-beta.3 com.azure:azure-search-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-security-attestation;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-security-confidentialledger;1.0.0-beta.2;1.0.0-beta.2 com.azure:azure-security-keyvault-administration;4.0.0-beta.7;4.0.0-beta.8 com.azure:azure-security-keyvault-certificates;4.1.8;4.2.0-beta.7 com.azure:azure-security-keyvault-jca;1.0.0-beta.7;1.0.0-beta.8 diff --git a/pom.xml b/pom.xml index 61ba25acd2c5..0524f27a56a1 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ sdk/communication/azure-communication-sms - sdk/confidentialledger/azure-data-confidentialledger + sdk/confidentialledger/azure-security-confidentialledger sdk/containerregistry/azure-containers-containerregistry @@ -367,7 +367,7 @@ Azure Confidential Ledger - com.azure.data.confidentialledger.* + com.azure.security.confidentialledger.* @@ -589,7 +589,7 @@ So, path for aggregate reports have to be defined relative to parent pom --> -maxLineLength 120 -snippetpath ${project.basedir}/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java - -snippetpath ${project.basedir}/sdk/confidentialledger/azure-data-confidentialledger/src/samples/java + -snippetpath ${project.basedir}/sdk/confidentialledger/azure-security-confidentialledger/src/samples/java -snippetpath ${project.basedir}/sdk/containerregistry/azure-containers-containerregistry/src/samples/java -snippetpath ${project.basedir}/sdk/core/azure-core/src/samples/java -snippetpath ${project.basedir}/sdk/core/azure-core-amqp/src/samples/java diff --git a/sdk/confidentialledger/azure-data-confidentialledger/CHANGELOG.md b/sdk/confidentialledger/azure-data-confidentialledger/CHANGELOG.md deleted file mode 100644 index c940c9df4636..000000000000 --- a/sdk/confidentialledger/azure-data-confidentialledger/CHANGELOG.md +++ /dev/null @@ -1,8 +0,0 @@ -# Release History - -## 1.0.0-beta.2 (Unreleased) - - -## 1.0.0-beta.1 (2021-05-11) - -- Initial beta release for Confidential Ledger client library. diff --git a/sdk/confidentialledger/azure-security-confidentialledger/CHANGELOG.md b/sdk/confidentialledger/azure-security-confidentialledger/CHANGELOG.md new file mode 100644 index 000000000000..fd5b97affb2a --- /dev/null +++ b/sdk/confidentialledger/azure-security-confidentialledger/CHANGELOG.md @@ -0,0 +1,9 @@ +# Release History + +## 1.0.0-beta.2 (2021-06-08) + +- Rename package name from azure-data-confidentialledger to azure-security-confidentialledger + +## 1.0.0-beta.1 (2021-05-11) + +- Initial beta release for Confidential Ledger client library. diff --git a/sdk/confidentialledger/azure-data-confidentialledger/README.md b/sdk/confidentialledger/azure-security-confidentialledger/README.md similarity index 90% rename from sdk/confidentialledger/azure-data-confidentialledger/README.md rename to sdk/confidentialledger/azure-security-confidentialledger/README.md index e4ddf31fe3ae..6444d4ea4000 100644 --- a/sdk/confidentialledger/azure-data-confidentialledger/README.md +++ b/sdk/confidentialledger/azure-security-confidentialledger/README.md @@ -18,12 +18,12 @@ portfolio, Azure Confidential Ledger runs in SGX enclaves. It is built on Micros ### Include the Package -[//]: # ({x-version-update-start;com.azure:azure-data-confidentialledger;current}) +[//]: # ({x-version-update-start;com.azure:azure-security-confidentialledger;current}) ```xml com.azure - azure-data-confidentialledger - 1.0.0-beta.1 + azure-security-confidentialledger + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -58,7 +58,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET. ##### Example - + ```java ConfidentialLedgerIdentityServiceBaseClient identityServiceClient = new ConfidentialLedgerClientBuilder() .ledgerUri(new URL("")) @@ -140,16 +140,16 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [ccf]: https://github.com/Microsoft/CCF [azure_confidential_computing]: https://azure.microsoft.com/solutions/confidential-compute [confidential_ledger_docs]: https://aka.ms/confidentialledger-servicedocs -[samples]: src/samples/java/com/azure/data/confidentialledger -[source_code]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/confidentialledger/azure-data-confidentialledger/src -[samples_code]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/confidentialledger/azure-data-confidentialledger/src/samples/ +[samples]: src/samples/java/com/azure/security/confidentialledger +[source_code]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/confidentialledger/azure-security-confidentialledger/src +[samples_code]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/confidentialledger/azure-security-confidentialledger/src/samples/ [azure_subscription]: https://azure.microsoft.com/free/ [product_documentation]: https://aka.ms/confidentialledger-servicedocs -[ledger_base_client_class]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/confidentialledger/azure-data-confidentialledger/src/main/java/com/azure/data/confidentialledger/LedgerBaseClient.java +[ledger_base_client_class]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/confidentialledger/azure-security-confidentialledger/src/main/java/com/azure/security/confidentialledger/LedgerBaseClient.java [azure_portal]: https://portal.azure.com [jdk_link]: https://docs.microsoft.com/java/azure/jdk/?view=azure-java-stable -[package]: https://mvnrepository.com/artifact/com.azure/azure-data-confidentialledger -[samples_readme]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/confidentialledger/azure-data-confidentialledger/src/samples/README.md +[package]: https://mvnrepository.com/artifact/com.azure/azure-security-confidentialledger +[samples_readme]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/confidentialledger/azure-security-confidentialledger/src/samples/README.md -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fconfidentialledger%2Fazure-data-confidentialledger%2FREADME.png) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fconfidentialledger%2Fazure-security-confidentialledger%2FREADME.png) diff --git a/sdk/confidentialledger/azure-data-confidentialledger/pom.xml b/sdk/confidentialledger/azure-security-confidentialledger/pom.xml similarity index 97% rename from sdk/confidentialledger/azure-data-confidentialledger/pom.xml rename to sdk/confidentialledger/azure-security-confidentialledger/pom.xml index f0dfcb2b74f9..5351f5222b65 100644 --- a/sdk/confidentialledger/azure-data-confidentialledger/pom.xml +++ b/sdk/confidentialledger/azure-security-confidentialledger/pom.xml @@ -10,8 +10,8 @@ com.azure - azure-data-confidentialledger - 1.0.0-beta.2 + azure-security-confidentialledger + 1.0.0-beta.2 Microsoft Azure client library for Confidential Ledger This package contains Microsoft Azure Confidential Ledger client library. diff --git a/sdk/confidentialledger/azure-data-confidentialledger/src/main/java/com/azure/data/confidentialledger/ConfidentialLedgerBaseClient.java b/sdk/confidentialledger/azure-security-confidentialledger/src/main/java/com/azure/security/confidentialledger/ConfidentialLedgerBaseClient.java similarity index 99% rename from sdk/confidentialledger/azure-data-confidentialledger/src/main/java/com/azure/data/confidentialledger/ConfidentialLedgerBaseClient.java rename to sdk/confidentialledger/azure-security-confidentialledger/src/main/java/com/azure/security/confidentialledger/ConfidentialLedgerBaseClient.java index 7ef666eda155..778c8721c1aa 100644 --- a/sdk/confidentialledger/azure-data-confidentialledger/src/main/java/com/azure/data/confidentialledger/ConfidentialLedgerBaseClient.java +++ b/sdk/confidentialledger/azure-security-confidentialledger/src/main/java/com/azure/security/confidentialledger/ConfidentialLedgerBaseClient.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.data.confidentialledger; +package com.azure.security.confidentialledger; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; diff --git a/sdk/confidentialledger/azure-data-confidentialledger/src/main/java/com/azure/data/confidentialledger/ConfidentialLedgerClientBuilder.java b/sdk/confidentialledger/azure-security-confidentialledger/src/main/java/com/azure/security/confidentialledger/ConfidentialLedgerClientBuilder.java similarity index 99% rename from sdk/confidentialledger/azure-data-confidentialledger/src/main/java/com/azure/data/confidentialledger/ConfidentialLedgerClientBuilder.java rename to sdk/confidentialledger/azure-security-confidentialledger/src/main/java/com/azure/security/confidentialledger/ConfidentialLedgerClientBuilder.java index 61fff1330201..14dad5677ee1 100644 --- a/sdk/confidentialledger/azure-data-confidentialledger/src/main/java/com/azure/data/confidentialledger/ConfidentialLedgerClientBuilder.java +++ b/sdk/confidentialledger/azure-security-confidentialledger/src/main/java/com/azure/security/confidentialledger/ConfidentialLedgerClientBuilder.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.data.confidentialledger; +package com.azure.security.confidentialledger; import com.azure.core.annotation.ServiceClientBuilder; import com.azure.core.credential.TokenCredential; diff --git a/sdk/confidentialledger/azure-data-confidentialledger/src/main/java/com/azure/data/confidentialledger/ConfidentialLedgerIdentityServiceBaseClient.java b/sdk/confidentialledger/azure-security-confidentialledger/src/main/java/com/azure/security/confidentialledger/ConfidentialLedgerIdentityServiceBaseClient.java similarity index 98% rename from sdk/confidentialledger/azure-data-confidentialledger/src/main/java/com/azure/data/confidentialledger/ConfidentialLedgerIdentityServiceBaseClient.java rename to sdk/confidentialledger/azure-security-confidentialledger/src/main/java/com/azure/security/confidentialledger/ConfidentialLedgerIdentityServiceBaseClient.java index f705eb49fe4d..7fe95ff059a0 100644 --- a/sdk/confidentialledger/azure-data-confidentialledger/src/main/java/com/azure/data/confidentialledger/ConfidentialLedgerIdentityServiceBaseClient.java +++ b/sdk/confidentialledger/azure-security-confidentialledger/src/main/java/com/azure/security/confidentialledger/ConfidentialLedgerIdentityServiceBaseClient.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.data.confidentialledger; +package com.azure.security.confidentialledger; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; diff --git a/sdk/confidentialledger/azure-data-confidentialledger/src/main/java/com/azure/data/confidentialledger/package-info.java b/sdk/confidentialledger/azure-security-confidentialledger/src/main/java/com/azure/security/confidentialledger/package-info.java similarity index 87% rename from sdk/confidentialledger/azure-data-confidentialledger/src/main/java/com/azure/data/confidentialledger/package-info.java rename to sdk/confidentialledger/azure-security-confidentialledger/src/main/java/com/azure/security/confidentialledger/package-info.java index 4d0a703718db..47f4a7b99b34 100644 --- a/sdk/confidentialledger/azure-data-confidentialledger/src/main/java/com/azure/data/confidentialledger/package-info.java +++ b/sdk/confidentialledger/azure-security-confidentialledger/src/main/java/com/azure/security/confidentialledger/package-info.java @@ -6,4 +6,4 @@ * Package containing the classes for ConfidentialLedgerClient. The ConfidentialLedgerClient writes and retrieves ledger * entries against the Confidential Ledger service. */ -package com.azure.data.confidentialledger; +package com.azure.security.confidentialledger; diff --git a/sdk/confidentialledger/azure-data-confidentialledger/src/main/java/module-info.java b/sdk/confidentialledger/azure-security-confidentialledger/src/main/java/module-info.java similarity index 72% rename from sdk/confidentialledger/azure-data-confidentialledger/src/main/java/module-info.java rename to sdk/confidentialledger/azure-security-confidentialledger/src/main/java/module-info.java index fdc105a6096a..b9a5e06f0f8e 100644 --- a/sdk/confidentialledger/azure-data-confidentialledger/src/main/java/module-info.java +++ b/sdk/confidentialledger/azure-security-confidentialledger/src/main/java/module-info.java @@ -2,9 +2,9 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -module com.azure.data.confidentialledger { +module com.azure.security.confidentialledger { requires transitive com.azure.core; requires transitive com.azure.core.experimental; - exports com.azure.data.confidentialledger; + exports com.azure.security.confidentialledger; } diff --git a/sdk/confidentialledger/azure-data-confidentialledger/src/samples/README.md b/sdk/confidentialledger/azure-security-confidentialledger/src/samples/README.md similarity index 100% rename from sdk/confidentialledger/azure-data-confidentialledger/src/samples/README.md rename to sdk/confidentialledger/azure-security-confidentialledger/src/samples/README.md diff --git a/sdk/confidentialledger/azure-data-confidentialledger/src/samples/java/com/azure/data/confidentialledger/GetLedgerEntries.java b/sdk/confidentialledger/azure-security-confidentialledger/src/samples/java/com/azure/security/confidentialledger/GetLedgerEntries.java similarity index 98% rename from sdk/confidentialledger/azure-data-confidentialledger/src/samples/java/com/azure/data/confidentialledger/GetLedgerEntries.java rename to sdk/confidentialledger/azure-security-confidentialledger/src/samples/java/com/azure/security/confidentialledger/GetLedgerEntries.java index 3aa15a0dadf4..7a45582074bb 100644 --- a/sdk/confidentialledger/azure-data-confidentialledger/src/samples/java/com/azure/data/confidentialledger/GetLedgerEntries.java +++ b/sdk/confidentialledger/azure-security-confidentialledger/src/samples/java/com/azure/security/confidentialledger/GetLedgerEntries.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.data.confidentialledger; +package com.azure.security.confidentialledger; import com.azure.core.experimental.http.DynamicResponse; import com.azure.core.http.HttpClient; diff --git a/sdk/confidentialledger/azure-data-confidentialledger/src/samples/java/com/azure/data/confidentialledger/ReadmeSamples.java b/sdk/confidentialledger/azure-security-confidentialledger/src/samples/java/com/azure/security/confidentialledger/ReadmeSamples.java similarity index 98% rename from sdk/confidentialledger/azure-data-confidentialledger/src/samples/java/com/azure/data/confidentialledger/ReadmeSamples.java rename to sdk/confidentialledger/azure-security-confidentialledger/src/samples/java/com/azure/security/confidentialledger/ReadmeSamples.java index 7dc8aa8291fb..008a1b62bd7c 100644 --- a/sdk/confidentialledger/azure-data-confidentialledger/src/samples/java/com/azure/data/confidentialledger/ReadmeSamples.java +++ b/sdk/confidentialledger/azure-security-confidentialledger/src/samples/java/com/azure/security/confidentialledger/ReadmeSamples.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.data.confidentialledger; +package com.azure.security.confidentialledger; import com.azure.core.experimental.http.DynamicResponse; import com.azure.core.http.HttpClient; diff --git a/sdk/confidentialledger/azure-data-confidentialledger/src/test/java/com/azure/data/confidentialledger/ConfidentialLedgerBaseClientTests.java b/sdk/confidentialledger/azure-security-confidentialledger/src/test/java/com/azure/security/confidentialledger/ConfidentialLedgerBaseClientTests.java similarity index 97% rename from sdk/confidentialledger/azure-data-confidentialledger/src/test/java/com/azure/data/confidentialledger/ConfidentialLedgerBaseClientTests.java rename to sdk/confidentialledger/azure-security-confidentialledger/src/test/java/com/azure/security/confidentialledger/ConfidentialLedgerBaseClientTests.java index 5e7c5458be32..c1b6cfff8a5f 100644 --- a/sdk/confidentialledger/azure-data-confidentialledger/src/test/java/com/azure/data/confidentialledger/ConfidentialLedgerBaseClientTests.java +++ b/sdk/confidentialledger/azure-security-confidentialledger/src/test/java/com/azure/security/confidentialledger/ConfidentialLedgerBaseClientTests.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.data.confidentialledger; +package com.azure.security.confidentialledger; import com.azure.core.experimental.http.DynamicResponse; import org.junit.jupiter.api.Test; diff --git a/sdk/confidentialledger/azure-data-confidentialledger/src/test/java/com/azure/data/confidentialledger/ConfidentialLedgerClientTestBase.java b/sdk/confidentialledger/azure-security-confidentialledger/src/test/java/com/azure/security/confidentialledger/ConfidentialLedgerClientTestBase.java similarity index 98% rename from sdk/confidentialledger/azure-data-confidentialledger/src/test/java/com/azure/data/confidentialledger/ConfidentialLedgerClientTestBase.java rename to sdk/confidentialledger/azure-security-confidentialledger/src/test/java/com/azure/security/confidentialledger/ConfidentialLedgerClientTestBase.java index 32b09a6ef389..85929ff8ebea 100644 --- a/sdk/confidentialledger/azure-data-confidentialledger/src/test/java/com/azure/data/confidentialledger/ConfidentialLedgerClientTestBase.java +++ b/sdk/confidentialledger/azure-security-confidentialledger/src/test/java/com/azure/security/confidentialledger/ConfidentialLedgerClientTestBase.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.data.confidentialledger; +package com.azure.security.confidentialledger; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpClient; diff --git a/sdk/confidentialledger/azure-data-confidentialledger/src/test/resources/session-records/ConfidentialLedgerBaseClientTests.getLedgerEntries.json b/sdk/confidentialledger/azure-security-confidentialledger/src/test/resources/session-records/ConfidentialLedgerBaseClientTests.getLedgerEntries.json similarity index 100% rename from sdk/confidentialledger/azure-data-confidentialledger/src/test/resources/session-records/ConfidentialLedgerBaseClientTests.getLedgerEntries.json rename to sdk/confidentialledger/azure-security-confidentialledger/src/test/resources/session-records/ConfidentialLedgerBaseClientTests.getLedgerEntries.json diff --git a/sdk/confidentialledger/azure-data-confidentialledger/swagger/README.md b/sdk/confidentialledger/azure-security-confidentialledger/swagger/README.md similarity index 94% rename from sdk/confidentialledger/azure-data-confidentialledger/swagger/README.md rename to sdk/confidentialledger/azure-security-confidentialledger/swagger/README.md index 3d6a420248af..05855e89bd45 100644 --- a/sdk/confidentialledger/azure-data-confidentialledger/swagger/README.md +++ b/sdk/confidentialledger/azure-security-confidentialledger/swagger/README.md @@ -6,7 +6,7 @@ input-file: - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/confidentialledger/data-plane/Microsoft.ConfidentialLedger/preview/0.1-preview/identityservice.json java: true output-folder: ../ -namespace: com.azure.data.confidentialledger +namespace: com.azure.security.confidentialledger generate-client-interfaces: false sync-methods: none license-header: MICROSOFT_MIT_SMALL diff --git a/sdk/confidentialledger/ci.yml b/sdk/confidentialledger/ci.yml index 03ae960555cf..013eef2f081e 100644 --- a/sdk/confidentialledger/ci.yml +++ b/sdk/confidentialledger/ci.yml @@ -27,6 +27,6 @@ extends: parameters: ServiceDirectory: confidentialledger Artifacts: - - name: azure-data-confidentialledger + - name: azure-security-confidentialledger groupId: com.azure - safeName: azuredataconfidentialledger + safeName: azuresecurityconfidentialledger diff --git a/sdk/confidentialledger/pom.xml b/sdk/confidentialledger/pom.xml index 697ad82aa9b8..17e27583b917 100644 --- a/sdk/confidentialledger/pom.xml +++ b/sdk/confidentialledger/pom.xml @@ -12,14 +12,14 @@ coverage - azure-data-confidentialledger + azure-security-confidentialledger com.azure - azure-data-confidentialledger - 1.0.0-beta.2 + azure-security-confidentialledger + 1.0.0-beta.2 @@ -51,7 +51,7 @@ true - azure-data-confidentialledger + azure-security-confidentialledger From a468ecc8e9d2d641fc7992c4c29e0f120d55bc0d Mon Sep 17 00:00:00 2001 From: vcolin7 Date: Fri, 4 Jun 2021 18:04:30 -0500 Subject: [PATCH 46/53] Added support for generating SAS tokens at the account and Table service level. (#21944) * Added support for generating SAS tokens at the Account and Table Service in all clients. Updated CHANGELOG. * Added partition key and row key values for SAS generation. * Fixed CheckStyle issues. * Fixed SpotBugs issue. * Removed more unused imports. * Renamed classes used for generating table-level SAS tokens. Made clients throw an exception when trying to generate SAS tokens if not authenticated with an AzureNamedKeyCredential. * Made client builders throw an IllegalStateException if more than one authentication setting is applied. * Changed module-info.java to export the tables package to all other packages. * Added tests for SAS models. * Added builder tests for when multiple forms of authentication are set. * Updated builders to throw when no endpoint or form of authentication are provided. * Fixed CheckStyle issues. * Fixed test name. * Removed unnecessary exports for implementation packages in module-info.java * Applied PR feedback: - Added extra clarity to when SAS models' toString() methods can return an empty String. - Removed unnecessary empty constructors in TableSasIpRange and TableSasPermission. - Changed builder parameter validation logic to the `buildClient()` and `buildAsyncClient()` methods. - Builders now also throw an IllegalStateException when calling `buildClient()` and `buildAsyncClient()` if multiple forms of authentication are provided, with the exception of 'sasToken' + 'connectionString'; or if 'endpoint' and/or 'sasToken' are set alongside a 'connectionString' and the endpoint and/or SAS token in the latter are different, respectively. - Removed "en-us" from all links in JavaDoc. - Updated CHANGELOG. * Added tests and renamed test classes to match clients and builders. * Updated CHANGELOG and client builders' JavaDoc. * Applied APIView feedback. * Updated CHANGELOG again. * Removed unused imports. Simplified SAS token comparison logic. * Fixed SAS token generation at the table level. Re-ordered query parameters in SAS tokens for both accounts and tables. Added tests for SAS tokens. * Updated CHANGELOG. * Fixed test and CheckStyle issues. * Added @Immutable and @Fluent annotations where appropriate. Made more models and classes in the sas package final. * Added more @Immutable annotations. --- sdk/tables/azure-data-tables/CHANGELOG.md | 15 + .../com/azure/data/tables/BuilderHelper.java | 78 +++- .../azure/data/tables/TableAsyncClient.java | 60 ++- .../TableAzureNamedKeyCredentialPolicy.java | 25 +- .../com/azure/data/tables/TableClient.java | 39 +- .../azure/data/tables/TableClientBuilder.java | 104 +++-- .../data/tables/TableServiceAsyncClient.java | 31 +- .../azure/data/tables/TableServiceClient.java | 20 + .../tables/TableServiceClientBuilder.java | 108 +++-- .../implementation/StorageConstants.java | 31 +- .../TableAccountSasGenerator.java | 117 +++++ .../implementation/TableSasGenerator.java | 178 ++++++++ .../tables/implementation/TableSasUtils.java | 98 +++++ .../tables/implementation/TableUtils.java | 84 ++-- .../azure/data/tables/models/TableItem.java | 2 + .../data/tables/models/TableServiceError.java | 3 + .../tables/models/TableServiceException.java | 2 + .../tables/models/TableTransactionAction.java | 5 +- .../TableTransactionFailedException.java | 4 +- .../tables/models/TableTransactionResult.java | 4 +- .../tables/sas/TableAccountSasPermission.java | 405 ++++++++++++++++++ .../sas/TableAccountSasResourceType.java | 158 +++++++ .../tables/sas/TableAccountSasService.java | 169 ++++++++ .../sas/TableAccountSasSignatureValues.java | 183 ++++++++ .../data/tables/sas/TableSasIpRange.java | 89 ++++ .../data/tables/sas/TableSasPermission.java | 205 +++++++++ .../TableSasProtocol.java} | 17 +- .../tables/sas/TableSasSignatureValues.java | 315 ++++++++++++++ .../azure/data/tables/sas/package-info.java | 7 + .../src/main/java/module-info.java | 5 +- .../com/azure/data/tables/SasModelsTest.java | 329 ++++++++++++++ ...entTest.java => TableAsyncClientTest.java} | 129 +++++- ...rTest.java => TableClientBuilderTest.java} | 80 +++- .../tables/TableServiceAsyncClientTest.java | 142 +++++- .../tables/TableServiceClientBuilderTest.java | 69 +++ ...anUseSasTokenToCreateValidTableClient.json | 55 +++ ...bleAsyncClientTest.createEntityAsync.json} | 0 ...ClientTest.createEntitySubclassAsync.json} | 0 ...EntityWithAllSupportedDataTypesAsync.json} | 0 ...ntTest.createEntityWithResponseAsync.json} | 0 ...ableAsyncClientTest.createTableAsync.json} | 0 ...entTest.createTableWithResponseAsync.json} | 0 ...bleAsyncClientTest.deleteEntityAsync.json} | 0 ...ntTest.deleteEntityWithResponseAsync.json} | 0 ...leteEntityWithResponseMatchETagAsync.json} | 0 ...entTest.deleteNonExistingEntityAsync.json} | 0 ...teNonExistingEntityWithResponseAsync.json} | 0 ...ientTest.deleteNonExistingTableAsync.json} | 0 ...eteNonExistingTableWithResponseAsync.json} | 0 ...ableAsyncClientTest.deleteTableAsync.json} | 0 ...entTest.deleteTableWithResponseAsync.json} | 0 ...est.generateSasTokenWithAllParameters.json | 29 ++ ...generateSasTokenWithMinimumParameters.json | 29 ++ ...lientTest.getEntityWithResponseAsync.json} | 0 ...t.getEntityWithResponseSubclassAsync.json} | 0 ...getEntityWithResponseWithSelectAsync.json} | 0 ...bleAsyncClientTest.listEntitiesAsync.json} | 0 ...ClientTest.listEntitiesSubclassAsync.json} | 0 ...ientTest.listEntitiesWithFilterAsync.json} | 0 ...ientTest.listEntitiesWithSelectAsync.json} | 0 ...cClientTest.listEntitiesWithTopAsync.json} | 0 ...yncClientTest.submitTransactionAsync.json} | 0 ...est.submitTransactionAsyncAllActions.json} | 0 ...ctionAsyncWithDifferentPartitionKeys.json} | 0 ...mitTransactionAsyncWithFailingAction.json} | 0 ...ubmitTransactionAsyncWithSameRowKeys.json} | 0 ...t.updateEntityWithResponseMergeAsync.json} | 0 ...updateEntityWithResponseReplaceAsync.json} | 0 ...pdateEntityWithResponseSubclassAsync.json} | 0 ...anUseSasTokenToCreateValidTableClient.json | 55 +++ ...erateAccountSasTokenWithAllParameters.json | 4 + ...eAccountSasTokenWithMinimumParameters.json | 4 + 72 files changed, 3328 insertions(+), 158 deletions(-) create mode 100644 sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableAccountSasGenerator.java create mode 100644 sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableSasGenerator.java create mode 100644 sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableSasUtils.java create mode 100644 sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasPermission.java create mode 100644 sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasResourceType.java create mode 100644 sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasService.java create mode 100644 sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasSignatureValues.java create mode 100644 sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasIpRange.java create mode 100644 sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasPermission.java rename sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/{implementation/SasProtocol.java => sas/TableSasProtocol.java} (74%) create mode 100644 sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasSignatureValues.java create mode 100644 sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/package-info.java create mode 100644 sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/SasModelsTest.java rename sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/{TablesAsyncClientTest.java => TableAsyncClientTest.java} (88%) rename sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/{TablesClientBuilderTest.java => TableClientBuilderTest.java} (64%) create mode 100644 sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.canUseSasTokenToCreateValidTableClient.json rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.createEntityAsync.json => TableAsyncClientTest.createEntityAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.createEntitySubclassAsync.json => TableAsyncClientTest.createEntitySubclassAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.createEntityWithAllSupportedDataTypesAsync.json => TableAsyncClientTest.createEntityWithAllSupportedDataTypesAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.createEntityWithResponseAsync.json => TableAsyncClientTest.createEntityWithResponseAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.createTableAsync.json => TableAsyncClientTest.createTableAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.createTableWithResponseAsync.json => TableAsyncClientTest.createTableWithResponseAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.deleteEntityAsync.json => TableAsyncClientTest.deleteEntityAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.deleteEntityWithResponseAsync.json => TableAsyncClientTest.deleteEntityWithResponseAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.deleteEntityWithResponseMatchETagAsync.json => TableAsyncClientTest.deleteEntityWithResponseMatchETagAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.deleteNonExistingEntityAsync.json => TableAsyncClientTest.deleteNonExistingEntityAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.deleteNonExistingEntityWithResponseAsync.json => TableAsyncClientTest.deleteNonExistingEntityWithResponseAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.deleteNonExistingTableAsync.json => TableAsyncClientTest.deleteNonExistingTableAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.deleteNonExistingTableWithResponseAsync.json => TableAsyncClientTest.deleteNonExistingTableWithResponseAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.deleteTableAsync.json => TableAsyncClientTest.deleteTableAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.deleteTableWithResponseAsync.json => TableAsyncClientTest.deleteTableWithResponseAsync.json} (100%) create mode 100644 sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.generateSasTokenWithAllParameters.json create mode 100644 sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.generateSasTokenWithMinimumParameters.json rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.getEntityWithResponseAsync.json => TableAsyncClientTest.getEntityWithResponseAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.getEntityWithResponseSubclassAsync.json => TableAsyncClientTest.getEntityWithResponseSubclassAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.getEntityWithResponseWithSelectAsync.json => TableAsyncClientTest.getEntityWithResponseWithSelectAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.listEntitiesAsync.json => TableAsyncClientTest.listEntitiesAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.listEntitiesSubclassAsync.json => TableAsyncClientTest.listEntitiesSubclassAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.listEntitiesWithFilterAsync.json => TableAsyncClientTest.listEntitiesWithFilterAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.listEntitiesWithSelectAsync.json => TableAsyncClientTest.listEntitiesWithSelectAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.listEntitiesWithTopAsync.json => TableAsyncClientTest.listEntitiesWithTopAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.submitTransactionAsync.json => TableAsyncClientTest.submitTransactionAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.submitTransactionAsyncAllActions.json => TableAsyncClientTest.submitTransactionAsyncAllActions.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.submitTransactionAsyncWithDifferentPartitionKeys.json => TableAsyncClientTest.submitTransactionAsyncWithDifferentPartitionKeys.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.submitTransactionAsyncWithFailingAction.json => TableAsyncClientTest.submitTransactionAsyncWithFailingAction.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.submitTransactionAsyncWithSameRowKeys.json => TableAsyncClientTest.submitTransactionAsyncWithSameRowKeys.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.updateEntityWithResponseMergeAsync.json => TableAsyncClientTest.updateEntityWithResponseMergeAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.updateEntityWithResponseReplaceAsync.json => TableAsyncClientTest.updateEntityWithResponseReplaceAsync.json} (100%) rename sdk/tables/azure-data-tables/src/test/resources/session-records/{TablesAsyncClientTest.updateEntityWithResponseSubclassAsync.json => TableAsyncClientTest.updateEntityWithResponseSubclassAsync.json} (100%) create mode 100644 sdk/tables/azure-data-tables/src/test/resources/session-records/TableServiceAsyncClientTest.canUseSasTokenToCreateValidTableClient.json create mode 100644 sdk/tables/azure-data-tables/src/test/resources/session-records/TableServiceAsyncClientTest.generateAccountSasTokenWithAllParameters.json create mode 100644 sdk/tables/azure-data-tables/src/test/resources/session-records/TableServiceAsyncClientTest.generateAccountSasTokenWithMinimumParameters.json diff --git a/sdk/tables/azure-data-tables/CHANGELOG.md b/sdk/tables/azure-data-tables/CHANGELOG.md index 0412600a6812..f1815ce615e6 100644 --- a/sdk/tables/azure-data-tables/CHANGELOG.md +++ b/sdk/tables/azure-data-tables/CHANGELOG.md @@ -5,6 +5,20 @@ ### New Features - Introduced the `TableTransactionAction` class and the `TableTransactionActionType` enum. +- Added support for generating SAS tokens at the Account and Table Service level in all clients. +- Added the following methods to `TableClient`, `TableAsyncClient`: + - `listAccessPolicies()` + - `setAccessPolicies()` + - `setAccessPoliciesWithResponse()` + - `generateSasToken()` +- Added the following methods to `TableServiceClient`, `TableServiceAsyncClient`: + - `getProperties()` + - `getPropertiesWithResponse()` + - `setProperties()` + - `setPropertiesWithResponse()` + - `getStatistics()` + - `getStatisticsWithResponse()` + - `generateAccountSasToken()` ### Breaking Changes @@ -22,6 +36,7 @@ - `updateEntity(TableEntity entity, TableEntityUpdateMode updateMode, boolean ifUnchanged)` - `getEntity(String partitionKey, String rowKey, List select)` +- Client builders now also throw an `IllegalStateException` when calling `buildClient()` and `buildAsyncClient()` if multiple forms of authentication are provided, with the exception of `sasToken` + `connectionString`; or if `endpoint` and/or `sasToken` are set alongside a `connectionString` and the endpoint and/or SAS token in the latter are different than the former, respectively. ## 12.0.0-beta.7 (2021-05-15) diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/BuilderHelper.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/BuilderHelper.java index 7e6f350f11f3..788e5d1fb9fa 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/BuilderHelper.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/BuilderHelper.java @@ -26,11 +26,14 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.data.tables.implementation.CosmosPatchTransformPolicy; import com.azure.data.tables.implementation.NullHttpClient; +import com.azure.data.tables.implementation.StorageAuthenticationSettings; +import com.azure.data.tables.implementation.StorageConnectionString; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.StringJoiner; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -51,12 +54,14 @@ static HttpPipeline buildPipeline( retryPolicy = (retryPolicy == null) ? new RetryPolicy() : retryPolicy; logOptions = (logOptions == null) ? new HttpLogOptions() : logOptions; - validateSingleCredentialIsPresent(azureNamedKeyCredential, azureSasCredential, sasToken, logger); - // Closest to API goes first, closest to wire goes last. List policies = new ArrayList<>(); - if (endpoint.contains(COSMOS_ENDPOINT_SUFFIX)) { + if (endpoint == null) { + throw logger.logExceptionAsError( + new IllegalStateException("An 'endpoint' is required to create a client. Use builders' 'endpoint()' or" + + " 'connectionString()' methods to set this value.")); + } else if (endpoint.contains(COSMOS_ENDPOINT_SUFFIX)) { policies.add(new CosmosPatchTransformPolicy()); } @@ -82,7 +87,9 @@ static HttpPipeline buildPipeline( policies.add(retryPolicy); policies.add(new AddDatePolicy()); + HttpPipelinePolicy credentialPolicy; + if (azureNamedKeyCredential != null) { credentialPolicy = new TableAzureNamedKeyCredentialPolicy(azureNamedKeyCredential); } else if (azureSasCredential != null) { @@ -90,12 +97,12 @@ static HttpPipeline buildPipeline( } else if (sasToken != null) { credentialPolicy = new AzureSasCredentialPolicy(new AzureSasCredential(sasToken), false); } else { - credentialPolicy = null; + throw logger.logExceptionAsError( + new IllegalStateException("A form of authentication is required to create a client. Use a builder's " + + "'credential()', 'sasToken()' or 'connectionString()' methods to set a form of authentication.")); } - if (credentialPolicy != null) { - policies.add(credentialPolicy); - } + policies.add(credentialPolicy); // Add per retry additional policies. policies.addAll(perRetryAdditionalPolicies); @@ -121,17 +128,56 @@ static HttpPipeline buildNullClientPipeline() { .build(); } - private static void validateSingleCredentialIsPresent(AzureNamedKeyCredential azureNamedKeyCredential, - AzureSasCredential azureSasCredential, String sasToken, - ClientLogger logger) { - List usedCredentials = Stream.of(azureNamedKeyCredential, azureSasCredential, sasToken) - .filter(Objects::nonNull).collect(Collectors.toList()); + static void validateCredentials(AzureNamedKeyCredential azureNamedKeyCredential, + AzureSasCredential azureSasCredential, String sasToken, String connectionString, + ClientLogger logger) { + List usedCredentials = + Stream.of(azureNamedKeyCredential, azureSasCredential, sasToken, connectionString) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + + // Only allow two forms of authentication when 'connectionString' and 'sasToken' are provided. Validate that + // both contain the same SAS settings. + if (usedCredentials.size() == 2 && connectionString != null && sasToken != null) { + StorageConnectionString storageConnectionString = + StorageConnectionString.create(connectionString, logger); + StorageAuthenticationSettings authSettings = storageConnectionString.getStorageAuthSettings(); + + if (authSettings.getType() == StorageAuthenticationSettings.Type.SAS_TOKEN) { + if (sasToken.equals(authSettings.getSasToken())) { + return; + } else { + throw logger.logExceptionAsError(new IllegalStateException("'connectionString' contains a SAS token" + + " with different settings than 'sasToken'.")); + } + } + + // If the 'connectionString' auth type is not SAS_TOKEN and a 'sasToken' was provided, then multiplte + // incompatible forms of authentication were specified in the client builder. + } + if (usedCredentials.size() > 1) { + StringJoiner usedCredentialsStringBuilder = new StringJoiner(", "); + + if (azureNamedKeyCredential != null) { + usedCredentialsStringBuilder.add("azureNamedKeyCredential"); + } + + if (azureSasCredential != null) { + usedCredentialsStringBuilder.add("azureSasCredential"); + } + + if (sasToken != null) { + usedCredentialsStringBuilder.add("sasToken"); + } + + if (connectionString != null) { + usedCredentialsStringBuilder.add("connectionString"); + } + throw logger.logExceptionAsError(new IllegalStateException( - "Only one credential should be used. Credentials present: " - + usedCredentials.stream().map(c -> c instanceof String ? "sasToken" : c.getClass().getName()) - .collect(Collectors.joining(",")) - )); + "Only one form of authentication should be used. The authentication forms present are: " + + usedCredentialsStringBuilder + ".")); } } } diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAsyncClient.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAsyncClient.java index fead6b55b6d7..33d3b6539779 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAsyncClient.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAsyncClient.java @@ -5,6 +5,7 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.credential.AzureNamedKeyCredential; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpRequest; @@ -21,15 +22,12 @@ import com.azure.core.util.serializer.SerializerAdapter; import com.azure.data.tables.implementation.AzureTableImpl; import com.azure.data.tables.implementation.AzureTableImplBuilder; -import com.azure.data.tables.implementation.TransactionalBatchImpl; import com.azure.data.tables.implementation.ModelHelper; +import com.azure.data.tables.implementation.TableSasGenerator; +import com.azure.data.tables.implementation.TableSasUtils; import com.azure.data.tables.implementation.TableUtils; +import com.azure.data.tables.implementation.TransactionalBatchImpl; import com.azure.data.tables.implementation.models.AccessPolicy; -import com.azure.data.tables.implementation.models.TransactionalBatchChangeSet; -import com.azure.data.tables.implementation.models.TransactionalBatchAction; -import com.azure.data.tables.implementation.models.TransactionalBatchRequestBody; -import com.azure.data.tables.implementation.models.TransactionalBatchSubRequest; -import com.azure.data.tables.implementation.models.TransactionalBatchResponse; import com.azure.data.tables.implementation.models.OdataMetadataFormat; import com.azure.data.tables.implementation.models.QueryOptions; import com.azure.data.tables.implementation.models.ResponseFormat; @@ -38,7 +36,11 @@ import com.azure.data.tables.implementation.models.TableProperties; import com.azure.data.tables.implementation.models.TableResponseProperties; import com.azure.data.tables.implementation.models.TableServiceError; -import com.azure.data.tables.models.TableTransactionActionResponse; +import com.azure.data.tables.implementation.models.TransactionalBatchAction; +import com.azure.data.tables.implementation.models.TransactionalBatchChangeSet; +import com.azure.data.tables.implementation.models.TransactionalBatchRequestBody; +import com.azure.data.tables.implementation.models.TransactionalBatchResponse; +import com.azure.data.tables.implementation.models.TransactionalBatchSubRequest; import com.azure.data.tables.models.ListEntitiesOptions; import com.azure.data.tables.models.TableAccessPolicy; import com.azure.data.tables.models.TableEntity; @@ -47,8 +49,10 @@ import com.azure.data.tables.models.TableServiceException; import com.azure.data.tables.models.TableSignedIdentifier; import com.azure.data.tables.models.TableTransactionAction; +import com.azure.data.tables.models.TableTransactionActionResponse; import com.azure.data.tables.models.TableTransactionFailedException; import com.azure.data.tables.models.TableTransactionResult; +import com.azure.data.tables.sas.TableSasSignatureValues; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -195,6 +199,30 @@ public TableServiceVersion getServiceVersion() { return TableServiceVersion.fromString(tablesImplementation.getVersion()); } + /** + * Generates a service SAS for the table using the specified {@link TableSasSignatureValues}. + * + *

Note : The client must be authenticated via {@link AzureNamedKeyCredential} + *

See {@link TableSasSignatureValues} for more information on how to construct a service SAS.

+ * + * @param tableSasSignatureValues {@link TableSasSignatureValues} + * + * @return A {@code String} representing the SAS query parameters. + * + * @throws IllegalStateException If this {@link TableAsyncClient} is not authenticated with an + * {@link AzureNamedKeyCredential}. + */ + public String generateSas(TableSasSignatureValues tableSasSignatureValues) { + AzureNamedKeyCredential azureNamedKeyCredential = TableSasUtils.extractNamedKeyCredential(getHttpPipeline()); + + if (azureNamedKeyCredential == null) { + throw logger.logExceptionAsError(new IllegalStateException("Cannot generate a SAS token with a client that" + + " is not authenticated with an AzureNamedKeyCredential.")); + } + + return new TableSasGenerator(tableSasSignatureValues, getTableName(), azureNamedKeyCredential).getSas(); + } + /** * Creates the table within the Tables service. * @@ -821,11 +849,11 @@ Mono> getEntityWithResponse(String partition * {@link TableSignedIdentifier access policies}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getAccessPolicy() { - return (PagedFlux) fluxContext(this::getAccessPolicy); + public PagedFlux listAccessPolicies() { + return (PagedFlux) fluxContext(this::listAccessPolicies); } - PagedFlux getAccessPolicy(Context context) { + PagedFlux listAccessPolicies(Context context) { context = context == null ? Context.NONE : context; try { @@ -870,8 +898,8 @@ private TableAccessPolicy toTableAccessPolicy(AccessPolicy accessPolicy) { * @return An empty reactive result. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setAccessPolicy(List tableSignedIdentifiers) { - return this.setAccessPolicyWithResponse(tableSignedIdentifiers).flatMap(FluxUtil::toMono); + public Mono setAccessPolicies(List tableSignedIdentifiers) { + return this.setAccessPoliciesWithResponse(tableSignedIdentifiers).flatMap(FluxUtil::toMono); } /** @@ -883,12 +911,12 @@ public Mono setAccessPolicy(List tableSignedIdentif * @return A reactive result containing the HTTP response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setAccessPolicyWithResponse(List tableSignedIdentifiers) { - return withContext(context -> this.setAccessPolicyWithResponse(tableSignedIdentifiers, context)); + public Mono> setAccessPoliciesWithResponse(List tableSignedIdentifiers) { + return withContext(context -> this.setAccessPoliciesWithResponse(tableSignedIdentifiers, context)); } - Mono> setAccessPolicyWithResponse(List tableSignedIdentifiers, - Context context) { + Mono> setAccessPoliciesWithResponse(List tableSignedIdentifiers, + Context context) { context = context == null ? Context.NONE : context; try { diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAzureNamedKeyCredentialPolicy.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAzureNamedKeyCredentialPolicy.java index 6bddd72130ef..0701a99db7e0 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAzureNamedKeyCredentialPolicy.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAzureNamedKeyCredentialPolicy.java @@ -17,7 +17,7 @@ import java.util.Locale; import java.util.Map; -import static com.azure.data.tables.implementation.TableUtils.computeHMac256; +import static com.azure.data.tables.implementation.TableSasUtils.computeHmac256; import static com.azure.data.tables.implementation.TableUtils.parseQueryStringSplitValues; /** @@ -41,24 +41,27 @@ public TableAzureNamedKeyCredentialPolicy(AzureNamedKeyCredential credential) { * * @param context The context of the request. * @param next The next policy in the pipeline. + * * @return A reactive result containing the HTTP response. */ public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { String authorizationValue = generateAuthorizationHeader(context.getHttpRequest().getUrl(), context.getHttpRequest().getHeaders().toMap()); context.getHttpRequest().setHeader("Authorization", authorizationValue); + return next.process(); } /** * Generates the Auth Headers * - * @param requestUrl the URL which the request is going to - * @param headers the headers of the request - * @return the auth header + * @param requestUrl The URL which the request is going to. + * @param headers The headers of the request. + * + * @return The auth header */ String generateAuthorizationHeader(URL requestUrl, Map headers) { - String signature = computeHMac256(credential.getAzureNamedKey().getKey(), buildStringToSign(requestUrl, + String signature = computeHmac256(credential.getAzureNamedKey().getKey(), buildStringToSign(requestUrl, headers)); return String.format(AUTHORIZATION_HEADER_FORMAT, credential.getAzureNamedKey().getName(), signature); } @@ -68,6 +71,7 @@ String generateAuthorizationHeader(URL requestUrl, Map headers) * * @param requestUrl The Url which the request is going to. * @param headers The headers of the request. + * * @return A string to sign for the request. */ private String buildStringToSign(URL requestUrl, Map headers) { @@ -87,6 +91,7 @@ private String buildStringToSign(URL requestUrl, Map headers) { * * @param headers A map of the headers which the request has. * @param headerName The name of the header to get the standard header for. + * * @return The standard header for the given name. */ private String getStandardHeaderValue(Map headers, String headerName) { @@ -100,6 +105,7 @@ private String getStandardHeaderValue(Map headers, String header * Returns the canonicalized resource needed for a request. * * @param requestUrl The url of the request. + * * @return The string that is the canonicalized resource. */ private String getCanonicalizedResource(URL requestUrl) { @@ -133,4 +139,13 @@ private String getCanonicalizedResource(URL requestUrl) { return canonicalizedResource.toString(); } + + /** + * Get the {@link AzureNamedKeyCredential} linked to the policy. + * + * @return The {@link AzureNamedKeyCredential}. + */ + public AzureNamedKeyCredential getCredential() { + return credential; + } } diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java index f811b2ee05e4..ecd189746b23 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java @@ -5,10 +5,10 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.credential.AzureNamedKeyCredential; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -import com.azure.data.tables.models.TableTransactionActionResponse; import com.azure.data.tables.models.ListEntitiesOptions; import com.azure.data.tables.models.TableEntity; import com.azure.data.tables.models.TableEntityUpdateMode; @@ -16,8 +16,10 @@ import com.azure.data.tables.models.TableServiceException; import com.azure.data.tables.models.TableSignedIdentifier; import com.azure.data.tables.models.TableTransactionAction; +import com.azure.data.tables.models.TableTransactionActionResponse; import com.azure.data.tables.models.TableTransactionFailedException; import com.azure.data.tables.models.TableTransactionResult; +import com.azure.data.tables.sas.TableSasSignatureValues; import java.time.Duration; import java.util.List; @@ -80,6 +82,23 @@ public TableServiceVersion getServiceVersion() { return this.client.getServiceVersion(); } + /** + * Generates a service SAS for the table using the specified {@link TableSasSignatureValues}. + * + *

Note : The client must be authenticated via {@link AzureNamedKeyCredential} + *

See {@link TableSasSignatureValues} for more information on how to construct a service SAS.

+ * + * @param tableSasSignatureValues {@link TableSasSignatureValues} + * + * @return A {@code String} representing the SAS query parameters. + * + * @throws IllegalStateException If this {@link TableClient} is not authenticated with an + * {@link AzureNamedKeyCredential}. + */ + public String generateSas(TableSasSignatureValues tableSasSignatureValues) { + return client.generateSas(tableSasSignatureValues); + } + /** * Creates the table within the Tables service. * @@ -396,8 +415,8 @@ public Response getEntityWithResponse(String partitionKey, String r * {@link TableSignedIdentifier access policies}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getAccessPolicy() { - return new PagedIterable<>(client.getAccessPolicy()); + public PagedIterable listAccessPolicies() { + return new PagedIterable<>(client.listAccessPolicies()); } /** @@ -411,8 +430,8 @@ public PagedIterable getAccessPolicy() { * {@link TableSignedIdentifier access policies}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getAccessPolicy(Duration timeout, Context context) { - return new PagedIterable<>(applyOptionalTimeout(client.getAccessPolicy(context), timeout)); + public PagedIterable listAccessPolicies(Duration timeout, Context context) { + return new PagedIterable<>(applyOptionalTimeout(client.listAccessPolicies(context), timeout)); } /** @@ -421,8 +440,8 @@ public PagedIterable getAccessPolicy(Duration timeout, Co * @param tableSignedIdentifiers The {@link TableSignedIdentifier access policies} for the table. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void setAccessPolicy(List tableSignedIdentifiers) { - client.setAccessPolicy(tableSignedIdentifiers).block(); + public void setAccessPolicies(List tableSignedIdentifiers) { + client.setAccessPolicies(tableSignedIdentifiers).block(); } /** @@ -436,9 +455,9 @@ public void setAccessPolicy(List tableSignedIdentifiers) * @return The HTTP response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response setAccessPolicyWithResponse(List tableSignedIdentifiers, - Duration timeout, Context context) { - return blockWithOptionalTimeout(client.setAccessPolicyWithResponse(tableSignedIdentifiers, context), timeout); + public Response setAccessPoliciesWithResponse(List tableSignedIdentifiers, + Duration timeout, Context context) { + return blockWithOptionalTimeout(client.setAccessPoliciesWithResponse(tableSignedIdentifiers, context), timeout); } /** diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClientBuilder.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClientBuilder.java index cda5f3e71965..b21877a735a6 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClientBuilder.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClientBuilder.java @@ -27,6 +27,8 @@ import java.util.ArrayList; import java.util.List; +import static com.azure.data.tables.BuilderHelper.validateCredentials; + /** * This class provides a fluent builder API to help aid the configuration and instantiation of {@link TableClient} and * {@link TableAsyncClient} objects. Call {@link #buildClient()} or {@link #buildAsyncClient()}, respectively, to @@ -43,6 +45,7 @@ public final class TableClientBuilder { private String tableName; private Configuration configuration; private HttpClient httpClient; + private String connectionString; private String endpoint; private HttpLogOptions httpLogOptions; private ClientOptions clientOptions; @@ -65,8 +68,13 @@ public TableClientBuilder() { * * @return A {@link TableClient} created from the configurations in this builder. * - * @throws IllegalArgumentException If {@code tableName} is {@code null} or empty. - * @throws IllegalStateException If multiple credentials have been specified. + * @throws NullPointerException If {@code endpoint} or {@code tableName} are {@code null}. + * @throws IllegalArgumentException If {@code endpoint} is malformed or empty or if {@code tableName} is empty. + * @throws IllegalStateException If no form of authentication or {@code endpoint} have been specified or if + * multiple forms of authentication are provided, with the exception of {@code sasToken} + + * {@code connectionString}. Also thrown if {@code endpoint} and/or {@code sasToken} are set alongside a + * {@code connectionString} and the endpoint and/or SAS token in the latter are different than the former, + * respectively. */ public TableClient buildClient() { return new TableClient(buildAsyncClient()); @@ -77,12 +85,63 @@ public TableClient buildClient() { * * @return A {@link TableAsyncClient} created from the configurations in this builder. * - * @throws IllegalArgumentException If {@code tableName} is {@code null} or empty. - * @throws IllegalStateException If multiple credentials have been specified. + * @throws NullPointerException If {@code endpoint} or {@code tableName} are {@code null}. + * @throws IllegalArgumentException If {@code endpoint} is malformed or empty or if {@code tableName} is empty. + * @throws IllegalStateException If no form of authentication or {@code endpoint} have been specified or if + * multiple forms of authentication are provided, with the exception of {@code sasToken} + + * {@code connectionString}. Also thrown if {@code endpoint} and/or {@code sasToken} are set alongside a + * {@code connectionString} and the endpoint and/or SAS token in the latter are different than the former, + * respectively. */ public TableAsyncClient buildAsyncClient() { TableServiceVersion serviceVersion = version != null ? version : TableServiceVersion.getLatest(); + validateCredentials(azureNamedKeyCredential, azureSasCredential, sasToken, connectionString, logger); + + // If 'connectionString' was provided, extract the endpoint and sasToken. + if (connectionString != null) { + StorageConnectionString storageConnectionString = StorageConnectionString.create(connectionString, logger); + StorageEndpoint storageConnectionStringTableEndpoint = storageConnectionString.getTableEndpoint(); + + if (storageConnectionStringTableEndpoint == null + || storageConnectionStringTableEndpoint.getPrimaryUri() == null) { + + throw logger.logExceptionAsError(new IllegalArgumentException( + "'connectionString' is missing the required settings to derive a Tables endpoint.")); + } + + String connectionStringEndpoint = storageConnectionStringTableEndpoint.getPrimaryUri(); + + // If no 'endpoint' was provided, use the one in the 'connectionString'. Else, verify they are the same. + if (endpoint == null) { + endpoint = connectionStringEndpoint; + } else { + if (endpoint.endsWith("/")) { + endpoint = endpoint.substring(0, endpoint.length() - 1); + } + + if (connectionStringEndpoint.endsWith("/")) { + connectionStringEndpoint = + connectionStringEndpoint.substring(0, connectionStringEndpoint.length() - 1); + } + + if (!endpoint.equals(connectionStringEndpoint)) { + throw logger.logExceptionAsError(new IllegalStateException( + "'endpoint' points to a different tables endpoint than 'connectionString'.")); + } + } + + StorageAuthenticationSettings authSettings = storageConnectionString.getStorageAuthSettings(); + + if (authSettings.getType() == StorageAuthenticationSettings.Type.ACCOUNT_NAME_KEY) { + azureNamedKeyCredential = (azureNamedKeyCredential != null) ? azureNamedKeyCredential + : new AzureNamedKeyCredential(authSettings.getAccount().getName(), + authSettings.getAccount().getAccessKey()); + } else if (authSettings.getType() == StorageAuthenticationSettings.Type.SAS_TOKEN) { + sasToken = (sasToken != null) ? sasToken : authSettings.getSasToken(); + } + } + HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline( azureNamedKeyCredential, azureSasCredential, sasToken, endpoint, retryPolicy, httpLogOptions, clientOptions, httpClient, perCallPolicies, perRetryPolicies, configuration, logger); @@ -98,6 +157,7 @@ public TableAsyncClient buildAsyncClient() { * * @return The updated {@link TableClientBuilder}. * + * @throws NullPointerException If {@code connectionString} is {@code null}. * @throws IllegalArgumentException If {@code connectionString} isn't a valid connection string. */ public TableClientBuilder connectionString(String connectionString) { @@ -105,25 +165,9 @@ public TableClientBuilder connectionString(String connectionString) { throw logger.logExceptionAsError(new NullPointerException("'connectionString' cannot be null.")); } - StorageConnectionString storageConnectionString = StorageConnectionString.create(connectionString, logger); - StorageEndpoint endpoint = storageConnectionString.getTableEndpoint(); - - if (endpoint == null || endpoint.getPrimaryUri() == null) { - throw logger.logExceptionAsError( - new IllegalArgumentException( - "'connectionString' missing required settings to derive tables service endpoint.")); - } - - this.endpoint(endpoint.getPrimaryUri()); - - StorageAuthenticationSettings authSettings = storageConnectionString.getStorageAuthSettings(); + StorageConnectionString.create(connectionString, logger); - if (authSettings.getType() == StorageAuthenticationSettings.Type.ACCOUNT_NAME_KEY) { - this.credential(new AzureNamedKeyCredential(authSettings.getAccount().getName(), - authSettings.getAccount().getAccessKey())); - } else if (authSettings.getType() == StorageAuthenticationSettings.Type.SAS_TOKEN) { - this.sasToken(authSettings.getSasToken()); - } + this.connectionString = connectionString; return this; } @@ -135,6 +179,7 @@ public TableClientBuilder connectionString(String connectionString) { * * @return The updated {@link TableClientBuilder}. * + * @throws NullPointerException If {@code endpoint} is {@code null}. * @throws IllegalArgumentException If {@code endpoint} isn't a valid URL. */ public TableClientBuilder endpoint(String endpoint) { @@ -184,14 +229,15 @@ public TableClientBuilder configuration(Configuration configuration) { } /** - * Sets the SAS token used to authorize requests sent to the service. + * Sets the SAS token used to authorize requests sent to the service. Setting this is mutually exclusive with + * {@code credential(AzureSasCredential)} or {@code credential(AzureNamedKeyCredential)}. * * @param sasToken The SAS token to use for authenticating requests. * * @return The updated {@link TableClientBuilder}. * - * @throws IllegalArgumentException If {@code sasToken} is empty. * @throws NullPointerException If {@code sasToken} is {@code null}. + * @throws IllegalArgumentException If {@code sasToken} is empty. */ public TableClientBuilder sasToken(String sasToken) { if (sasToken == null) { @@ -199,17 +245,17 @@ public TableClientBuilder sasToken(String sasToken) { } if (sasToken.isEmpty()) { - throw logger.logExceptionAsError(new IllegalArgumentException("'sasToken' cannot be null or empty.")); + throw logger.logExceptionAsError(new IllegalArgumentException("'sasToken' cannot be empty.")); } this.sasToken = sasToken; - this.azureNamedKeyCredential = null; return this; } /** - * Sets the {@link AzureSasCredential} used to authorize requests sent to the service. + * Sets the {@link AzureSasCredential} used to authorize requests sent to the service. Setting this is mutually + * exclusive with {@code credential(AzureNamedKeyCredential)} or {@code sasToken(String)}. * * @param credential {@link AzureSasCredential} used to authorize requests sent to the service. * @@ -228,7 +274,8 @@ public TableClientBuilder credential(AzureSasCredential credential) { } /** - * Sets the {@link AzureNamedKeyCredential} used to authorize requests sent to the service. + * Sets the {@link AzureNamedKeyCredential} used to authorize requests sent to the service. Setting this is mutually + * exclusive with using {@code credential(AzureSasCredential)} or {@code sasToken(String)}. * * @param credential {@link AzureNamedKeyCredential} used to authorize requests sent to the service. * @@ -242,7 +289,6 @@ public TableClientBuilder credential(AzureNamedKeyCredential credential) { } this.azureNamedKeyCredential = credential; - this.sasToken = null; return this; } diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceAsyncClient.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceAsyncClient.java index 0eb9d2ff0e6d..180a167db98a 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceAsyncClient.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceAsyncClient.java @@ -5,6 +5,7 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.credential.AzureNamedKeyCredential; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpRequest; @@ -21,6 +22,8 @@ import com.azure.data.tables.implementation.AzureTableImpl; import com.azure.data.tables.implementation.AzureTableImplBuilder; import com.azure.data.tables.implementation.ModelHelper; +import com.azure.data.tables.implementation.TableAccountSasGenerator; +import com.azure.data.tables.implementation.TableSasUtils; import com.azure.data.tables.implementation.TableUtils; import com.azure.data.tables.implementation.models.CorsRule; import com.azure.data.tables.implementation.models.GeoReplication; @@ -45,6 +48,7 @@ import com.azure.data.tables.models.TableServiceProperties; import com.azure.data.tables.models.TableServiceRetentionPolicy; import com.azure.data.tables.models.TableServiceStatistics; +import com.azure.data.tables.sas.TableAccountSasSignatureValues; import reactor.core.publisher.Mono; import java.net.URI; @@ -80,7 +84,7 @@ public final class TableServiceAsyncClient { this.accountName = uri.getHost().split("\\.", 2)[0]; logger.verbose("Table Service URI: {}", uri); - } catch (IllegalArgumentException ex) { + } catch (NullPointerException | IllegalArgumentException ex) { throw logger.logExceptionAsError(ex); } @@ -147,6 +151,31 @@ public TableServiceVersion getServiceVersion() { return TableServiceVersion.fromString(implementation.getVersion()); } + /** + * Generates an account SAS for the Azure Storage account using the specified + * {@link TableAccountSasSignatureValues}. + * + *

Note : The client must be authenticated via {@link AzureNamedKeyCredential}. + *

See {@link TableAccountSasSignatureValues} for more information on how to construct an account SAS.

+ * + * @param tableAccountSasSignatureValues {@link TableAccountSasSignatureValues}. + * + * @return A {@link String} representing the SAS query parameters. + * + * @throws IllegalStateException If this {@link TableClient} is not authenticated with an + * {@link AzureNamedKeyCredential}. + */ + public String generateAccountSas(TableAccountSasSignatureValues tableAccountSasSignatureValues) { + AzureNamedKeyCredential azureNamedKeyCredential = TableSasUtils.extractNamedKeyCredential(getHttpPipeline()); + + if (azureNamedKeyCredential == null) { + throw logger.logExceptionAsError(new IllegalStateException("Cannot generate a SAS token with a client that" + + " is not authenticated with an AzureNamedKeyCredential.")); + } + + return new TableAccountSasGenerator(tableAccountSasSignatureValues, azureNamedKeyCredential).getSas(); + } + /** * Gets a {@link TableAsyncClient} instance for the provided table in the account. * diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java index e7e85e270cce..f7bc25e59e7e 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java @@ -5,6 +5,7 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.credential.AzureNamedKeyCredential; import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; @@ -18,6 +19,7 @@ import com.azure.data.tables.models.TableServiceException; import com.azure.data.tables.models.TableServiceProperties; import com.azure.data.tables.models.TableServiceStatistics; +import com.azure.data.tables.sas.TableAccountSasSignatureValues; import reactor.core.publisher.Mono; import java.time.Duration; @@ -71,6 +73,24 @@ public TableServiceVersion getServiceVersion() { return client.getServiceVersion(); } + /** + * Generates an account SAS for the Azure Storage account using the specified + * {@link TableAccountSasSignatureValues}. + * + *

Note : The client must be authenticated via {@link AzureNamedKeyCredential}. + *

See {@link TableAccountSasSignatureValues} for more information on how to construct an account SAS.

+ * + * @param tableAccountSasSignatureValues {@link TableAccountSasSignatureValues}. + * + * @return A {@link String} representing the SAS query parameters. + * + * @throws IllegalStateException If this {@link TableClient} is not authenticated with an + * {@link AzureNamedKeyCredential}. + */ + public String generateAccountSas(TableAccountSasSignatureValues tableAccountSasSignatureValues) { + return client.generateAccountSas(tableAccountSasSignatureValues); + } + /** * Gets a {@link TableClient} instance for the provided table in the account. * diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClientBuilder.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClientBuilder.java index c5a246b0addd..d139a0f88b63 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClientBuilder.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClientBuilder.java @@ -26,6 +26,8 @@ import java.util.ArrayList; import java.util.List; +import static com.azure.data.tables.BuilderHelper.validateCredentials; + /** * This class provides a fluent builder API to help aid the configuration and instantiation of * {@link TableServiceClient} and {@link TableServiceAsyncClient} objects. Call {@link #buildClient()} or @@ -38,6 +40,7 @@ public final class TableServiceClientBuilder { private final List perCallPolicies = new ArrayList<>(); private final List perRetryPolicies = new ArrayList<>(); private Configuration configuration; + private String connectionString; private String endpoint; private HttpClient httpClient; private HttpLogOptions httpLogOptions; @@ -61,7 +64,13 @@ public TableServiceClientBuilder() { * * @return A {@link TableServiceClient} created from the configurations in this builder. * - * @throws IllegalStateException If multiple credentials have been specified. + * @throws NullPointerException If {@code endpoint} is {@code null}. + * @throws IllegalArgumentException If {@code endpoint} is malformed or empty. + * @throws IllegalStateException If no form of authentication or {@code endpoint} have been specified or if + * multiple forms of authentication are provided, with the exception of {@code sasToken} + + * {@code connectionString}. Also thrown if {@code endpoint} and/or {@code sasToken} are set alongside a + * {@code connectionString} and the endpoint and/or SAS token in the latter are different than the former, + * respectively. */ public TableServiceClient buildClient() { return new TableServiceClient(buildAsyncClient()); @@ -72,11 +81,63 @@ public TableServiceClient buildClient() { * * @return A {@link TableServiceAsyncClient} created from the configurations in this builder. * - * @throws IllegalStateException If multiple credentials have been specified. + * @throws NullPointerException If {@code endpoint} is {@code null}. + * @throws IllegalArgumentException If {@code endpoint} is malformed or empty. + * @throws IllegalStateException If no form of authentication or {@code endpoint} have been specified or if + * multiple forms of authentication are provided, with the exception of {@code sasToken} + + * {@code connectionString}. Also thrown if {@code endpoint} and/or {@code sasToken} are set alongside a + * {@code connectionString} and the endpoint and/or SAS token in the latter are different than the former, + * respectively. */ public TableServiceAsyncClient buildAsyncClient() { TableServiceVersion serviceVersion = version != null ? version : TableServiceVersion.getLatest(); + validateCredentials(azureNamedKeyCredential, azureSasCredential, sasToken, connectionString, logger); + + // If 'connectionString' was provided, extract the endpoint and sasToken. + if (connectionString != null) { + StorageConnectionString storageConnectionString = StorageConnectionString.create(connectionString, logger); + StorageEndpoint storageConnectionStringTableEndpoint = storageConnectionString.getTableEndpoint(); + + if (storageConnectionStringTableEndpoint == null + || storageConnectionStringTableEndpoint.getPrimaryUri() == null) { + + throw logger.logExceptionAsError(new IllegalArgumentException( + "'connectionString' is missing the required settings to derive a Tables endpoint.")); + } + + String connectionStringEndpoint = storageConnectionStringTableEndpoint.getPrimaryUri(); + + // If no 'endpoint' was provided, use the one in the 'connectionString'. Else, verify they are the same. + if (endpoint == null) { + endpoint = connectionStringEndpoint; + } else { + if (endpoint.endsWith("/")) { + endpoint = endpoint.substring(0, endpoint.length() - 1); + } + + if (connectionStringEndpoint.endsWith("/")) { + connectionStringEndpoint = + connectionStringEndpoint.substring(0, connectionStringEndpoint.length() - 1); + } + + if (!endpoint.equals(connectionStringEndpoint)) { + throw logger.logExceptionAsError(new IllegalStateException( + "'endpoint' points to a different tables endpoint than 'connectionString'.")); + } + } + + StorageAuthenticationSettings authSettings = storageConnectionString.getStorageAuthSettings(); + + if (authSettings.getType() == StorageAuthenticationSettings.Type.ACCOUNT_NAME_KEY) { + azureNamedKeyCredential = (azureNamedKeyCredential != null) ? azureNamedKeyCredential + : new AzureNamedKeyCredential(authSettings.getAccount().getName(), + authSettings.getAccount().getAccessKey()); + } else if (authSettings.getType() == StorageAuthenticationSettings.Type.SAS_TOKEN) { + sasToken = (sasToken != null) ? sasToken : authSettings.getSasToken(); + } + } + HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline( azureNamedKeyCredential, azureSasCredential, sasToken, endpoint, retryPolicy, httpLogOptions, clientOptions, httpClient, perCallPolicies, perRetryPolicies, configuration, logger); @@ -91,6 +152,7 @@ public TableServiceAsyncClient buildAsyncClient() { * * @return The updated {@link TableServiceClientBuilder}. * + * @throws NullPointerException If {@code connectionString} is {@code null}. * @throws IllegalArgumentException If {@code connectionString} isn't a valid connection string. */ public TableServiceClientBuilder connectionString(String connectionString) { @@ -98,25 +160,9 @@ public TableServiceClientBuilder connectionString(String connectionString) { throw logger.logExceptionAsError(new NullPointerException("'connectionString' cannot be null.")); } - StorageConnectionString storageConnectionString = StorageConnectionString.create(connectionString, logger); - StorageEndpoint endpoint = storageConnectionString.getTableEndpoint(); - - if (endpoint == null || endpoint.getPrimaryUri() == null) { - throw logger.logExceptionAsError( - new IllegalArgumentException( - "'connectionString' missing required settings to derive tables service endpoint.")); - } - - this.endpoint(endpoint.getPrimaryUri()); + StorageConnectionString.create(connectionString, logger); - StorageAuthenticationSettings authSettings = storageConnectionString.getStorageAuthSettings(); - - if (authSettings.getType() == StorageAuthenticationSettings.Type.ACCOUNT_NAME_KEY) { - this.credential(new AzureNamedKeyCredential(authSettings.getAccount().getName(), - authSettings.getAccount().getAccessKey())); - } else if (authSettings.getType() == StorageAuthenticationSettings.Type.SAS_TOKEN) { - this.sasToken(authSettings.getSasToken()); - } + this.connectionString = connectionString; return this; } @@ -177,13 +223,15 @@ public TableServiceClientBuilder configuration(Configuration configuration) { } /** - * Sets the SAS token used to authorize requests sent to the service. + * Sets the SAS token used to authorize requests sent to the service. Setting this is mutually exclusive with + * {@code credential(AzureSasCredential)} or {@code credential(AzureNamedKeyCredential)}. * * @param sasToken The SAS token to use for authenticating requests. * * @return The updated {@link TableServiceClientBuilder}. * - * @throws NullPointerException if {@code sasToken} is {@code null}. + * @throws NullPointerException If {@code sasToken} is {@code null}. + * @throws IllegalArgumentException If {@code sasToken} is empty. */ public TableServiceClientBuilder sasToken(String sasToken) { if (sasToken == null) { @@ -191,23 +239,23 @@ public TableServiceClientBuilder sasToken(String sasToken) { } if (sasToken.isEmpty()) { - throw logger.logExceptionAsError(new IllegalArgumentException("'sasToken' cannot be null or empty.")); + throw logger.logExceptionAsError(new IllegalArgumentException("'sasToken' cannot be empty.")); } this.sasToken = sasToken; - this.azureNamedKeyCredential = null; return this; } /** - * Sets the {@link AzureSasCredential} used to authorize requests sent to the service. + * Sets the {@link AzureSasCredential} used to authorize requests sent to the service. Setting this is mutually + * exclusive with {@code credential(AzureNamedKeyCredential)} or {@code sasToken(String)}. * * @param credential {@link AzureSasCredential} used to authorize requests sent to the service. * * @return The updated {@link TableServiceClientBuilder}. * - * @throws NullPointerException if {@code credential} is {@code null}. + * @throws NullPointerException If {@code credential} is {@code null}. */ public TableServiceClientBuilder credential(AzureSasCredential credential) { if (credential == null) { @@ -220,13 +268,14 @@ public TableServiceClientBuilder credential(AzureSasCredential credential) { } /** - * Sets the {@link AzureNamedKeyCredential} used to authorize requests sent to the service. + * Sets the {@link AzureNamedKeyCredential} used to authorize requests sent to the service. Setting this is mutually + * exclusive with using {@code credential(AzureSasCredential)} or {@code sasToken(String)}. * * @param credential {@link AzureNamedKeyCredential} used to authorize requests sent to the service. * * @return The updated {@link TableServiceClientBuilder}. * - * @throws NullPointerException if {@code credential} is {@code null}. + * @throws NullPointerException If {@code credential} is {@code null}. */ public TableServiceClientBuilder credential(AzureNamedKeyCredential credential) { if (credential == null) { @@ -234,7 +283,6 @@ public TableServiceClientBuilder credential(AzureNamedKeyCredential credential) } this.azureNamedKeyCredential = credential; - this.sasToken = null; return this; } @@ -279,7 +327,7 @@ public TableServiceClientBuilder httpLogOptions(HttpLogOptions logOptions) { * * @return The updated {@link TableServiceClientBuilder}. * - * @throws NullPointerException if {@code pipelinePolicy} is {@code null}. + * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. */ public TableServiceClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { if (pipelinePolicy == null) { diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/StorageConstants.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/StorageConstants.java index 9ea549548453..f8c4a7b321a7 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/StorageConstants.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/StorageConstants.java @@ -3,6 +3,8 @@ package com.azure.data.tables.implementation; +import com.azure.data.tables.sas.TableSasProtocol; + import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Locale; @@ -36,12 +38,12 @@ private StorageConstants() { public static final long TB = 1024L * GB; /** - * Represents the value for {@link SasProtocol#HTTPS_ONLY}. + * Represents the value for {@link TableSasProtocol#HTTPS_ONLY}. */ public static final String HTTPS = "https"; /** - * Represents the value for {@link SasProtocol#HTTPS_HTTP}. + * Represents the value for {@link TableSasProtocol#HTTPS_HTTP}. */ public static final String HTTPS_HTTP = "https,http"; @@ -327,6 +329,11 @@ private UrlConstants() { */ public static final String SAS_CONTENT_TYPE = "rsct"; + /** + * The SAS table name parameter. + */ + public static final String SAS_TABLE_NAME = "tn"; + /** * The SAS signed object id parameter for user delegation SAS. */ @@ -381,5 +388,25 @@ private UrlConstants() { * The SAS queue constant. */ public static final String SAS_QUEUE_CONSTANT = "q"; + + /** + * The SAS table start partition key. + */ + public static final String SAS_TABLE_START_PARTITION_KEY = "spk"; + + /** + * The SAS table start row key. + */ + public static final String SAS_TABLE_START_ROW_KEY = "srk"; + + /** + * The SAS table end partition key. + */ + public static final String SAS_TABLE_END_PARTITION_KEY = "epk"; + + /** + * The SAS table end row key. + */ + public static final String SAS_TABLE_END_ROW_KEY = "erk"; } } diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableAccountSasGenerator.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableAccountSasGenerator.java new file mode 100644 index 000000000000..941fbe7361f9 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableAccountSasGenerator.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.data.tables.implementation; + +import com.azure.core.credential.AzureNamedKeyCredential; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.data.tables.sas.TableAccountSasPermission; +import com.azure.data.tables.sas.TableAccountSasSignatureValues; +import com.azure.data.tables.sas.TableSasIpRange; +import com.azure.data.tables.sas.TableSasProtocol; + +import java.time.OffsetDateTime; +import java.util.Objects; + +import static com.azure.data.tables.implementation.TableSasUtils.computeHmac256; +import static com.azure.data.tables.implementation.TableSasUtils.formatQueryParameterDate; +import static com.azure.data.tables.implementation.TableSasUtils.tryAppendQueryParameter; + +/** + * A class containing utility methods for generating SAS tokens for the Azure Storage accounts. + */ +public class TableAccountSasGenerator { + private final ClientLogger logger = new ClientLogger(TableAccountSasGenerator.class); + private final OffsetDateTime expiryTime; + private final OffsetDateTime startTime; + private final String permissions; + private final String resourceTypes; + private final String services; + private final String sas; + private final TableSasProtocol protocol; + private final TableSasIpRange sasIpRange; + private String version; + + /** + * Creates a new {@link TableAccountSasGenerator} which will generate an account-level SAS signed with an + * {@link AzureNamedKeyCredential}. + * + * @param sasValues The {@link TableAccountSasSignatureValues account signature values}. + * @param azureNamedKeyCredential An {@link AzureNamedKeyCredential} whose key will be used to sign the SAS. + */ + public TableAccountSasGenerator(TableAccountSasSignatureValues sasValues, + AzureNamedKeyCredential azureNamedKeyCredential) { + Objects.requireNonNull(sasValues, "'sasValues' cannot be null."); + Objects.requireNonNull(azureNamedKeyCredential, "'azureNamedKeyCredential' cannot be null."); + Objects.requireNonNull(sasValues.getServices(), "'services' in 'sasValues' cannot be null."); + Objects.requireNonNull(sasValues.getResourceTypes(), "'resourceTypes' in 'sasValues' cannot be null."); + Objects.requireNonNull(sasValues.getExpiryTime(), "'expiryTime' in 'sasValues' cannot be null."); + Objects.requireNonNull(sasValues.getPermissions(), "'permissions' in 'sasValues' cannot be null."); + + this.version = sasValues.getVersion(); + this.protocol = sasValues.getProtocol(); + this.startTime = sasValues.getStartTime(); + this.expiryTime = sasValues.getExpiryTime(); + this.permissions = sasValues.getPermissions(); + this.sasIpRange = sasValues.getSasIpRange(); + this.services = sasValues.getServices(); + this.resourceTypes = sasValues.getResourceTypes(); + + if (CoreUtils.isNullOrEmpty(version)) { + version = StorageConstants.HeaderConstants.TARGET_STORAGE_VERSION; + } + + String stringToSign = stringToSign(azureNamedKeyCredential); + + // Signature is generated on the un-url-encoded values. + String signature = computeHmac256(azureNamedKeyCredential.getAzureNamedKey().getKey(), stringToSign); + + this.sas = encode(signature); + } + + /** + * Get the SAS produced by this {@link TableAccountSasGenerator}. + * + * @return The SAS produced by this {@link TableAccountSasGenerator}. + */ + public String getSas() { + return sas; + } + + private String stringToSign(final AzureNamedKeyCredential azureNamedKeyCredential) { + return String.join("\n", + azureNamedKeyCredential.getAzureNamedKey().getName(), + TableAccountSasPermission.parse(this.permissions).toString(), // guarantees ordering + this.services, + resourceTypes, + this.startTime == null ? "" : StorageConstants.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), + StorageConstants.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), + this.sasIpRange == null ? "" : this.sasIpRange.toString(), + this.protocol == null ? "" : this.protocol.toString(), + this.version, + "" // Account SAS requires an additional newline character + ); + } + + private String encode(String signature) { + /* + We should be url-encoding each key and each value, but because we know all the keys and values will encode to + themselves, we cheat except for the signature value. + */ + StringBuilder sb = new StringBuilder(); + + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_SERVICE_VERSION, this.version); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_SERVICES, this.services); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_RESOURCES_TYPES, this.resourceTypes); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_START_TIME, + formatQueryParameterDate(this.startTime)); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_EXPIRY_TIME, + formatQueryParameterDate(this.expiryTime)); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_SIGNED_PERMISSIONS, this.permissions); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_IP_RANGE, this.sasIpRange); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_PROTOCOL, this.protocol); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_SIGNATURE, signature); + + return sb.toString(); + } +} diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableSasGenerator.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableSasGenerator.java new file mode 100644 index 000000000000..343fa061fbc1 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableSasGenerator.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.data.tables.implementation; + +import com.azure.core.credential.AzureNamedKeyCredential; +import com.azure.core.util.logging.ClientLogger; +import com.azure.data.tables.TableServiceVersion; +import com.azure.data.tables.sas.TableSasIpRange; +import com.azure.data.tables.sas.TableSasPermission; +import com.azure.data.tables.sas.TableSasProtocol; +import com.azure.data.tables.sas.TableSasSignatureValues; + +import java.time.OffsetDateTime; +import java.util.Locale; +import java.util.Objects; + +import static com.azure.data.tables.implementation.TableSasUtils.computeHmac256; +import static com.azure.data.tables.implementation.TableSasUtils.formatQueryParameterDate; +import static com.azure.data.tables.implementation.TableSasUtils.tryAppendQueryParameter; + +/** + * A class containing utility methods for generating SAS tokens for the Azure Data Tables service. + */ +public class TableSasGenerator { + private final ClientLogger logger = new ClientLogger(TableSasGenerator.class); + private final OffsetDateTime expiryTime; + private final OffsetDateTime startTime; + private final String endPartitionKey; + private final String endRowKey; + private final String identifier; + private final String sas; + private final String startPartitionKey; + private final String startRowKey; + private final String tableName; + private final TableSasProtocol protocol; + private final TableSasIpRange sasIpRange; + private String permissions; + private String version; + + /** + * Creates a new {@link TableSasGenerator} which will generate an table-level SAS signed with an + * {@link AzureNamedKeyCredential}. + * + * @param sasValues The {@link TableSasSignatureValues} to generate the SAS token with. + * @param tableName The table name. + * @param azureNamedKeyCredential An {@link AzureNamedKeyCredential} whose key will be used to sign the SAS. + */ + public TableSasGenerator(TableSasSignatureValues sasValues, String tableName, + AzureNamedKeyCredential azureNamedKeyCredential) { + Objects.requireNonNull(sasValues, "'sasValues' cannot be null."); + Objects.requireNonNull(azureNamedKeyCredential, "'azureNamedKeyCredential' cannot be null."); + + this.version = sasValues.getVersion(); + this.protocol = sasValues.getProtocol(); + this.startTime = sasValues.getStartTime(); + this.expiryTime = sasValues.getExpiryTime(); + this.permissions = sasValues.getPermissions(); + this.sasIpRange = sasValues.getSasIpRange(); + this.tableName = tableName; + this.identifier = sasValues.getIdentifier(); + this.startPartitionKey = sasValues.getStartPartitionKey(); + this.startRowKey = sasValues.getStartRowKey(); + this.endPartitionKey = sasValues.getEndPartitionKey(); + this.endRowKey = sasValues.getEndRowKey(); + + validateState(); + + // Signature is generated on the un-url-encoded values. + String canonicalName = getCanonicalName(azureNamedKeyCredential.getAzureNamedKey().getName()); + String stringToSign = stringToSign(canonicalName); + String signature = computeHmac256(azureNamedKeyCredential.getAzureNamedKey().getKey(), stringToSign); + + this.sas = encode(signature); + } + + /** + * Get the SAS produced by this {@link TableSasGenerator}. + * + * @return The SAS produced by this {@link TableSasGenerator}. + */ + public String getSas() { + return sas; + } + + private String encode(String signature) { + /* + * We should be url-encoding each key and each value, but because we know all the keys and values will encode to + * themselves, we cheat except for the signature value. + */ + StringBuilder sb = new StringBuilder(); + + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_SERVICE_VERSION, this.version); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_START_TIME, + formatQueryParameterDate(this.startTime)); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_EXPIRY_TIME, + formatQueryParameterDate(this.expiryTime)); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_TABLE_NAME, tableName); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_SIGNED_PERMISSIONS, this.permissions); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_TABLE_START_PARTITION_KEY, startPartitionKey); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_TABLE_START_ROW_KEY, startRowKey); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_TABLE_END_PARTITION_KEY, endPartitionKey); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_TABLE_END_ROW_KEY, endRowKey); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_IP_RANGE, this.sasIpRange); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_PROTOCOL, this.protocol); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_SIGNED_IDENTIFIER, this.identifier); + tryAppendQueryParameter(sb, StorageConstants.UrlConstants.SAS_SIGNATURE, signature); + + return sb.toString(); + } + + /** + * Ensures that the builder's properties are in a consistent state. + * + * 1. If there is no version, use latest. + * 2. If there is no identifier set, ensure expiryTime and permissions are set. + * 4. Re-parse permissions depending on what the resource is. If it is an unrecognised resource, do nothing. + */ + private void validateState() { + if (version == null) { + version = TableServiceVersion.getLatest().getVersion(); + } + + if (identifier == null) { + if (expiryTime == null || permissions == null) { + throw logger.logExceptionAsError(new IllegalStateException("If identifier is not set, expiry time " + + "and permissions must be set")); + } + } + + if (permissions != null) { + if (tableName != null) { + permissions = TableSasPermission.parse(permissions).toString(); + } else { + // We won't re-parse the permissions if we don't know the type. + logger.info("Not re-parsing permissions. Resource type is not table."); + } + } + + if ((startPartitionKey != null && startRowKey == null) || (startPartitionKey == null && startRowKey != null)) { + throw logger.logExceptionAsError(new IllegalStateException("'startPartitionKey' and 'startRowKey' must " + + "either be both provided or both null. One cannot be provided without the other.")); + } + + if ((endPartitionKey != null && endRowKey == null) || (endPartitionKey == null && endRowKey != null)) { + throw logger.logExceptionAsError(new IllegalStateException("'endPartitionKey' and 'endRowKey' must either " + + "be both provided or both null. One cannot be provided without the other.")); + } + } + + /** + * Computes the canonical name for a table resource for SAS signing. + * + * @param account Account of the storage account. + * + * @return Canonical name as a string. + */ + private String getCanonicalName(String account) { + // Table: "/table/account/tablename" + return String.join("", new String[]{"/table/", account, "/", tableName}); + } + + private String stringToSign(String canonicalName) { + return String.join("\n", + this.permissions == null ? "" : this.permissions, + this.startTime == null ? "" : StorageConstants.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), + this.expiryTime == null ? "" : StorageConstants.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), + canonicalName.toLowerCase(Locale.ROOT), + this.identifier == null ? "" : this.identifier, + this.sasIpRange == null ? "" : this.sasIpRange.toString(), + this.protocol == null ? "" : protocol.toString(), + this.version == null ? "" : this.version, + this.startPartitionKey == null ? "" : this.startPartitionKey, + this.startRowKey == null ? "" : this.startRowKey, + this.endPartitionKey == null ? "" : this.endPartitionKey, + this.endRowKey == null ? "" : this.endRowKey + ); + } +} diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableSasUtils.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableSasUtils.java new file mode 100644 index 000000000000..751a1637d0aa --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableSasUtils.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.data.tables.implementation; + +import com.azure.core.credential.AzureNamedKeyCredential; +import com.azure.core.http.HttpPipeline; +import com.azure.data.tables.TableAzureNamedKeyCredentialPolicy; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.time.OffsetDateTime; +import java.util.Base64; + +/** + * This class provides helper methods used when generating SAS. + */ +public class TableSasUtils { + private static final String STRING_TO_SIGN_LOG_INFO_MESSAGE = "The string to sign computed by the SDK is: {}{}"; + private static final String STRING_TO_SIGN_LOG_WARNING_MESSAGE = "Please remember to disable '{}' before going " + + "to production as this string can potentially contain PII."; + + /** + * Shared helper method to append a SAS query parameter. + * + * @param sb The {@link StringBuilder} to append to. + * @param param The {@link String} parameter to append. + * @param value The value of the parameter to append. + */ + public static void tryAppendQueryParameter(StringBuilder sb, String param, Object value) { + if (value != null) { + if (sb.length() != 0) { + sb.append('&'); + } + + sb.append(TableUtils.urlEncode(param)).append('=').append(TableUtils.urlEncode(value.toString())); + } + } + + /** + * Formats date time SAS query parameters. + * + * @param dateTime The SAS date time. + * @return A String representing the SAS date time. + */ + public static String formatQueryParameterDate(OffsetDateTime dateTime) { + if (dateTime == null) { + return null; + } else { + return StorageConstants.ISO_8601_UTC_DATE_FORMATTER.format(dateTime); + } + } + + /** + * Extracts the {@link AzureNamedKeyCredential} from a {@link HttpPipeline} + * + * @param pipeline An {@link HttpPipeline} to extract an {@link AzureNamedKeyCredential} from. + * + * @return The extracted {@link AzureNamedKeyCredential}. + */ + public static AzureNamedKeyCredential extractNamedKeyCredential(HttpPipeline pipeline) { + for (int i = 0; i < pipeline.getPolicyCount(); i++) { + if (pipeline.getPolicy(i) instanceof TableAzureNamedKeyCredentialPolicy) { + TableAzureNamedKeyCredentialPolicy policy = (TableAzureNamedKeyCredentialPolicy) pipeline.getPolicy(i); + + return policy.getCredential(); + } + } + + return null; + } + + /** + * Computes a signature for the specified string using the HMAC-SHA256 algorithm. + * + * @param base64Key Base64 encoded key used to sign the string + * @param stringToSign UTF-8 encoded string to sign + * + * @return the HMAC-SHA256 encoded signature + * + * @throws RuntimeException If the HMAC-SHA256 algorithm isn't support, if the key isn't a valid Base64 encoded + * string, or the UTF-8 charset isn't supported. + */ + public static String computeHmac256(final String base64Key, final String stringToSign) { + try { + byte[] key = Base64.getDecoder().decode(base64Key); + Mac hmacSHA256 = Mac.getInstance("HmacSHA256"); + hmacSHA256.init(new SecretKeySpec(key, "HmacSHA256")); + byte[] utf8Bytes = stringToSign.getBytes(StandardCharsets.UTF_8); + + return Base64.getEncoder().encodeToString(hmacSHA256.doFinal(utf8Bytes)); + } catch (NoSuchAlgorithmException | InvalidKeyException ex) { + throw new RuntimeException(ex); + } + } +} diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableUtils.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableUtils.java index 4b062111ed5c..b5d7b550b5e1 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableUtils.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/TableUtils.java @@ -17,15 +17,10 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; -import java.nio.charset.StandardCharsets; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; +import java.net.URLEncoder; import java.time.Duration; -import java.util.Base64; import java.util.Locale; import java.util.Map; import java.util.TreeMap; @@ -177,30 +172,6 @@ public static Mono> swallowExce return monoError(logger, httpResponseException); } - /** - * Computes a signature for the specified string using the HMAC-SHA256 algorithm. - * - * @param base64Key Base64 encoded key used to sign the string - * @param stringToSign UTF-8 encoded string to sign - * - * @return the HMAC-SHA256 encoded signature - * - * @throws RuntimeException If the HMAC-SHA256 algorithm isn't support, if the key isn't a valid Base64 encoded - * string, or the UTF-8 charset isn't supported. - */ - public static String computeHMac256(final String base64Key, final String stringToSign) { - try { - byte[] key = Base64.getDecoder().decode(base64Key); - Mac hmacSHA256 = Mac.getInstance("HmacSHA256"); - hmacSHA256.init(new SecretKeySpec(key, "HmacSHA256")); - byte[] utf8Bytes = stringToSign.getBytes(StandardCharsets.UTF_8); - - return Base64.getEncoder().encodeToString(hmacSHA256.doFinal(utf8Bytes)); - } catch (NoSuchAlgorithmException | InvalidKeyException ex) { - throw new RuntimeException(ex); - } - } - /** * Parses the query string into a key-value pair map that maintains key, query parameter key, order. The value is * stored as a parsed array (ex. key=[val1, val2, val3] instead of key=val1,val2,val3). @@ -294,4 +265,57 @@ private static String decode(final String stringToDecode) { throw new RuntimeException(ex); } } + + /** + * Performs a safe encoding of the specified string, taking care to insert %20 for each space character instead of + * inserting the {@code +} character. + * + * @param stringToEncode String value to encode + * @return the encoded string value + * @throws RuntimeException If the UTF-8 charset isn't supported + */ + public static String urlEncode(final String stringToEncode) { + if (stringToEncode == null) { + return null; + } + + if (stringToEncode.length() == 0) { + return ""; + } + + if (stringToEncode.contains(" ")) { + StringBuilder outBuilder = new StringBuilder(); + + int startDex = 0; + for (int m = 0; m < stringToEncode.length(); m++) { + if (stringToEncode.charAt(m) == ' ') { + if (m > startDex) { + outBuilder.append(encode(stringToEncode.substring(startDex, m))); + } + + outBuilder.append("%20"); + startDex = m + 1; + } + } + + if (startDex != stringToEncode.length()) { + outBuilder.append(encode(stringToEncode.substring(startDex))); + } + + return outBuilder.toString(); + } else { + return encode(stringToEncode); + } + } + + /* + * Helper method to reduce duplicate calls of URLEncoder.encode + */ + private static String encode(final String stringToEncode) { + try { + return URLEncoder.encode(stringToEncode, UTF8_CHARSET); + } catch (UnsupportedEncodingException ex) { + throw new RuntimeException(ex); + } + } } diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableItem.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableItem.java index 5fdcd8bd2388..d240add3d4ef 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableItem.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableItem.java @@ -2,12 +2,14 @@ // Licensed under the MIT License. package com.azure.data.tables.models; +import com.azure.core.annotation.Immutable; import com.azure.data.tables.implementation.ModelHelper; import com.azure.data.tables.implementation.models.TableResponseProperties; /** * A table within a storage or CosmosDB table API account. */ +@Immutable public final class TableItem { private final String name; private final String odataType; diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceError.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceError.java index 8dd84cbd9e29..930d88497fe1 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceError.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceError.java @@ -2,9 +2,12 @@ // Licensed under the MIT License. package com.azure.data.tables.models; +import com.azure.core.annotation.Immutable; + /** * A class that represents an error occurred in a Tables operation. */ +@Immutable public final class TableServiceError { /* * The service error code. diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceException.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceException.java index f8e7e6e3ae66..7b2c565ac207 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceException.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceException.java @@ -2,12 +2,14 @@ // Licensed under the MIT License. package com.azure.data.tables.models; +import com.azure.core.annotation.Immutable; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpResponse; /** * Exception thrown for an invalid response with {@link TableServiceError} information. */ +@Immutable public class TableServiceException extends HttpResponseException { /** * Initializes a new instance of the {@link TableServiceException} class. diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableTransactionAction.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableTransactionAction.java index 05c7db6654aa..5e5f35823179 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableTransactionAction.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableTransactionAction.java @@ -2,10 +2,13 @@ // Licensed under the MIT License. package com.azure.data.tables.models; +import com.azure.core.annotation.Immutable; + /** * Defines an action to be included as part of a transactional batch operation. */ -public class TableTransactionAction { +@Immutable +public final class TableTransactionAction { private final TableTransactionActionType actionType; private final TableEntity entity; private final boolean ifUnchanged; diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableTransactionFailedException.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableTransactionFailedException.java index 06d45cbd1d94..6d6e8f3d2df7 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableTransactionFailedException.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableTransactionFailedException.java @@ -2,6 +2,7 @@ // Licensed under the MIT License. package com.azure.data.tables.models; +import com.azure.core.annotation.Immutable; import com.azure.core.http.HttpResponse; import com.azure.core.util.Context; import com.azure.data.tables.TableAsyncClient; @@ -13,7 +14,8 @@ /** * Exception thrown for an invalid response on a transactional operation with {@link TableServiceError} information. */ -public class TableTransactionFailedException extends TableServiceException { +@Immutable +public final class TableTransactionFailedException extends TableServiceException { private final Integer failedTransactionActionIndex; /** diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableTransactionResult.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableTransactionResult.java index ee5aeb2c1f6c..ed0225d0833e 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableTransactionResult.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableTransactionResult.java @@ -2,6 +2,7 @@ // Licensed under the MIT License. package com.azure.data.tables.models; +import com.azure.core.annotation.Immutable; import com.azure.core.util.Context; import com.azure.data.tables.TableAsyncClient; import com.azure.data.tables.TableClient; @@ -16,7 +17,8 @@ * {@link TableClient#submitTransactionWithResponse(List, Duration, Context)}, * {@link TableAsyncClient#submitTransaction(List)} or {@link TableAsyncClient#submitTransactionWithResponse(List)}. */ -public class TableTransactionResult { +@Immutable +public final class TableTransactionResult { private final List transactionActionResponses; private final Map lookupMap; diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasPermission.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasPermission.java new file mode 100644 index 000000000000..5569ca24fd7c --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasPermission.java @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.data.tables.sas; + +import com.azure.core.annotation.Fluent; +import com.azure.data.tables.implementation.StorageConstants; + +import java.util.Locale; + +/** + * This is a helper class to construct a string representing the permissions granted by an Account SAS. Setting a value + * to true means that any SAS which uses these permissions will grant permissions for that operation. Once all the + * values are set, this should be serialized with {@code toString()} and set as the permissions field on an + * {@link TableAccountSasSignatureValues} object. + * + *

+ * It is possible to construct the permissions string without this class, but the order of the permissions is particular + * and this class guarantees correctness. + *

+ * + * @see TableAccountSasSignatureValues + * @see Create account SAS + */ +@Fluent +public final class TableAccountSasPermission { + private boolean readPermission; + private boolean addPermission; + private boolean createPermission; + private boolean writePermission; + private boolean deletePermission; + private boolean deleteVersionPermission; + private boolean listPermission; + private boolean updatePermission; + private boolean processMessagesPermission; + private boolean tagsPermission; + private boolean filterTagsPermission; + + /** + * Creates an {@link TableAccountSasPermission} from the specified permissions string. This method will throw an + * {@link IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. + * + * @param permissionsString A {@code String} which represents the {@link TableAccountSasPermission account permissions}. + * + * @return An {@link TableAccountSasPermission} object generated from the given {@link String}. + * + * @throws IllegalArgumentException If {@code permString} contains a character other than r, w, d, x, l, a, c, u, p, + * t or f. + */ + public static TableAccountSasPermission parse(String permissionsString) { + TableAccountSasPermission permissions = new TableAccountSasPermission(); + + for (int i = 0; i < permissionsString.length(); i++) { + char c = permissionsString.charAt(i); + switch (c) { + case 'r': + permissions.readPermission = true; + break; + case 'w': + permissions.writePermission = true; + break; + case 'd': + permissions.deletePermission = true; + break; + case 'x': + permissions.deleteVersionPermission = true; + break; + case 'l': + permissions.listPermission = true; + break; + case 'a': + permissions.addPermission = true; + break; + case 'c': + permissions.createPermission = true; + break; + case 'u': + permissions.updatePermission = true; + break; + case 'p': + permissions.processMessagesPermission = true; + break; + case 't': + permissions.tagsPermission = true; + break; + case 'f': + permissions.filterTagsPermission = true; + break; + default: + throw new IllegalArgumentException( + String.format(Locale.ROOT, StorageConstants.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, + "Permissions", permissionsString, c)); + } + } + + return permissions; + } + + /** + * Gets the read permission status. Valid for all signed resources types (Service, Container, and Object). Permits + * read permissions to the specified resource type. + * + * @return The read permission status. + */ + public boolean hasReadPermission() { + return readPermission; + } + + /** + * Sets the read permission status. Valid for all signed resources types (Service, Container, and Object). Permits + * read permissions to the specified resource type. + * + * @param hasReadPermission The permission status to set. + * + * @return The updated {@link TableAccountSasPermission} object. + */ + public TableAccountSasPermission setReadPermission(boolean hasReadPermission) { + this.readPermission = hasReadPermission; + + return this; + } + + /** + * Gets the add permission status. Valid for the following Object resource types only: queue messages, table + * entities, and append blobs. + * + * @return The add permission status. + */ + public boolean hasAddPermission() { + return addPermission; + } + + /** + * Sets the add permission status. Valid for the following Object resource types only: queue messages, table + * entities, and append blobs. + * + * @param hasAddPermission The permission status to set. + * + * @return The updated {@link TableAccountSasPermission} object. + */ + public TableAccountSasPermission setAddPermission(boolean hasAddPermission) { + this.addPermission = hasAddPermission; + + return this; + } + + /** + * Gets the create permission status. Valid for the following Object resource types only: blobs and files. Users can + * create new blobs or files, but may not overwrite existing blobs or files. + * + * @return The create permission status. + */ + public boolean hasCreatePermission() { + return createPermission; + } + + /** + * Sets the create permission status. Valid for the following Object resource types only: blobs and files. Users can + * create new blobs or files, but may not overwrite existing blobs or files. + * + * @param hasCreatePermission The permission status to set. + * + * @return The updated {@link TableAccountSasPermission} object. + */ + public TableAccountSasPermission setCreatePermission(boolean hasCreatePermission) { + this.createPermission = hasCreatePermission; + + return this; + } + + /** + * Gets the write permission status. Valid for all signed resources types (Service, Container, and Object). Permits + * write permissions to the specified resource type. + * + * @return The write permission status. + */ + public boolean hasWritePermission() { + return writePermission; + } + + /** + * Sets the write permission status. Valid for all signed resources types (Service, Container, and Object). Permits + * write permissions to the specified resource type. + * + * @param hasWritePermission The permission status to set. + * + * @return The updated {@link TableAccountSasPermission} object. + */ + public TableAccountSasPermission setWritePermission(boolean hasWritePermission) { + this.writePermission = hasWritePermission; + + return this; + } + + /** + * Gets the delete permission status. Valid for Container and Object resource types, except for queue messages. + * + * @return The delete permission status. + */ + public boolean hasDeletePermission() { + return deletePermission; + } + + /** + * Sets the delete permission status. Valid for Container and Object resource types, except for queue messages. + * + * @param hasDeletePermission The permission status to set. + * + * @return The updated {@link TableAccountSasPermission} object. + */ + public TableAccountSasPermission setDeletePermission(boolean hasDeletePermission) { + this.deletePermission = hasDeletePermission; + + return this; + } + + /** + * Gets the delete version permission status. Used to delete a blob version + * + * @return The delete version permission status. + */ + public boolean hasDeleteVersionPermission() { + return deleteVersionPermission; + } + + /** + * Sets the delete version permission status. Used to delete a blob version + * + * @param hasDeleteVersionPermission The permission status to set. + * + * @return The updated {@link TableAccountSasPermission} object. + */ + public TableAccountSasPermission setDeleteVersionPermission(boolean hasDeleteVersionPermission) { + this.deleteVersionPermission = hasDeleteVersionPermission; + + return this; + } + + /** + * Gets the list permission status. Valid for Service and Container resource types only. + * + * @return The list permission status. + */ + public boolean hasListPermission() { + return listPermission; + } + + /** + * Sets the list permission status. Valid for Service and Container resource types only. + * + * @param hasListPermission The permission status to set. + * + * @return The updated {@link TableAccountSasPermission} object. + */ + public TableAccountSasPermission setListPermission(boolean hasListPermission) { + this.listPermission = hasListPermission; + + return this; + } + + /** + * Gets the update permission status. Valid for the following Object resource types only: queue messages and table + * entities. + * + * @return The update permission status. + */ + public boolean hasUpdatePermission() { + return updatePermission; + } + + /** + * Sets the update permission status. Valid for the following Object resource types only: queue messages and table + * entities. + * + * @param hasUpdatePermission The permission status to set. + * + * @return The updated {@link TableAccountSasPermission} object. + */ + public TableAccountSasPermission setUpdatePermission(boolean hasUpdatePermission) { + this.updatePermission = hasUpdatePermission; + + return this; + } + + /** + * Gets the process messages permission. Valid for the following Object resource type only: queue messages. + * + * @return The process messages permission status. + */ + public boolean hasProcessMessages() { + return processMessagesPermission; + } + + /** + * Sets the process messages permission. Valid for the following Object resource type only: queue messages. + * + * @param hasProcessMessagesPermission The permission status to set. + * + * @return The updated {@link TableAccountSasPermission} object. + */ + public TableAccountSasPermission setProcessMessages(boolean hasProcessMessagesPermission) { + this.processMessagesPermission = hasProcessMessagesPermission; + + return this; + } + + /** + * @return The tags permission status. Used to read or write the tags on a blob. + */ + public boolean hasTagsPermission() { + return tagsPermission; + } + + /** + * Sets the tags permission status. + * + * @param tagsPermission The permission status to set. Used to read or write the tags on a blob. + * + * @return The updated {@link TableAccountSasPermission} object. + */ + public TableAccountSasPermission setTagsPermission(boolean tagsPermission) { + this.tagsPermission = tagsPermission; + + return this; + } + + + /** + * @return The filter tags permission status. Used to filter blobs by their tags. + */ + public boolean hasFilterTagsPermission() { + return filterTagsPermission; + } + + /** + * Sets the filter tags permission status. Used to filter blobs by their tags. + * + * @param filterTagsPermission The permission status to set. + * + * @return The updated {@link TableAccountSasPermission} object. + */ + public TableAccountSasPermission setFilterTagsPermission(boolean filterTagsPermission) { + this.filterTagsPermission = filterTagsPermission; + + return this; + } + + /** + * Converts the given permissions to a {@link String}. Using this method will guarantee the permissions are in an + * order accepted by the service. If all permissions are set to false, an empty string is returned from this method. + * + * @return A {@link String} which represents the {@link TableAccountSasPermission}. + */ + @Override + public String toString() { + // The order of the characters should be as specified here to ensure correctness: + // https://docs.microsoft.com/rest/api/storageservices/constructing-an-account-sas + final StringBuilder builder = new StringBuilder(); + + if (this.readPermission) { + builder.append('r'); + } + + if (this.writePermission) { + builder.append('w'); + } + + if (this.deletePermission) { + builder.append('d'); + } + + if (this.deleteVersionPermission) { + builder.append('x'); + } + + if (this.listPermission) { + builder.append('l'); + } + + if (this.addPermission) { + builder.append('a'); + } + + if (this.createPermission) { + builder.append('c'); + } + + if (this.updatePermission) { + builder.append('u'); + } + + if (this.processMessagesPermission) { + builder.append('p'); + } + + if (this.tagsPermission) { + builder.append('t'); + } + + if (this.filterTagsPermission) { + builder.append('f'); + } + + return builder.toString(); + } +} diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasResourceType.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasResourceType.java new file mode 100644 index 000000000000..a0d3d6bc2082 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasResourceType.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.data.tables.sas; + +import com.azure.core.annotation.Fluent; +import com.azure.data.tables.implementation.StorageConstants; + +import java.util.Locale; + +/** + * This is a helper class to construct a string representing the resources accessible by an Account SAS. Setting a value + * to true means that any SAS which uses these permissions will grant access to that resource type. Once all the values + * are set, this should be serialized with {@code toString()} and set as the resources field on an + * {@link TableAccountSasSignatureValues} object. It is possible to construct the resources string without this class, + * but the order of the resources is particular and this class guarantees correctness. + */ +@Fluent +public final class TableAccountSasResourceType { + private boolean service; + private boolean container; + private boolean object; + + /** + * Creates an {@link TableAccountSasResourceType} from the specified resource types string. This method will throw an + * {@link IllegalArgumentException} if it encounters a character that does not correspond to a valid resource type. + * + * @param resourceTypesString A {@code String} which represents the + * {@link TableAccountSasResourceType account resource types}. + * + * @return A {@link TableAccountSasResourceType} generated from the given {@link String}. + * + * @throws IllegalArgumentException If {@code resourceTypesString} contains a character other than s, c, or o. + */ + public static TableAccountSasResourceType parse(String resourceTypesString) { + TableAccountSasResourceType resourceType = new TableAccountSasResourceType(); + + for (int i = 0; i < resourceTypesString.length(); i++) { + char c = resourceTypesString.charAt(i); + + switch (c) { + case 's': + resourceType.service = true; + break; + case 'c': + resourceType.container = true; + break; + case 'o': + resourceType.object = true; + break; + default: + throw new IllegalArgumentException( + String.format(Locale.ROOT, StorageConstants.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, + "Resource Types", resourceTypesString, c)); + } + } + + return resourceType; + } + + /** + * Get the access status for service level APIs. + * + * @return The access status for service level APIs. + */ + public boolean isService() { + return service; + } + + /** + * Sets the access status for service level APIs. + * + * @param service The access status to set. + * + * @return The updated {@link TableAccountSasResourceType} object. + */ + public TableAccountSasResourceType setService(boolean service) { + this.service = service; + + return this; + } + + /** + * Gets the access status for container level APIs, this grants access to Blob Containers, Tables, Queues, and + * File Shares. + * + * @return The access status for container level APIs, this grants access to Blob Containers, Tables, Queues, and + * File Shares. + */ + public boolean isContainer() { + return container; + } + + /** + * Sets the access status for container level APIs, this grants access to Blob Containers, Tables, Queues, and File + * Shares. + * + * @param container The access status to set. + * + * @return The updated {@link TableAccountSasResourceType} object. + */ + public TableAccountSasResourceType setContainer(boolean container) { + this.container = container; + + return this; + } + + /** + * Get the access status for object level APIs, this grants access to Blobs, Table Entities, Queue Messages, Files. + * + * @return The access status for object level APIs, this grants access to Blobs, Table Entities, Queue Messages, + * Files. + */ + public boolean isObject() { + return object; + } + + /** + * Sets the access status for object level APIs, this grants access to Blobs, Table Entities, Queue Messages, + * Files. + * + * @param object The access status to set. + * + * @return The updated {@link TableAccountSasResourceType} object. + */ + public TableAccountSasResourceType setObject(boolean object) { + this.object = object; + + return this; + } + + /** + * Converts the given resource types to a {@link String}. Using this method will guarantee the resource types are in + * an order accepted by the service. If all resource types are set to false, an empty string is returned from this + * method. + * + * @return A {@code String} which represents the {@link TableAccountSasResourceType account resource types}. + */ + @Override + public String toString() { + // The order of the characters should be as specified here to ensure correctness: + // https://docs.microsoft.com/rest/api/storageservices/constructing-an-account-sas + StringBuilder builder = new StringBuilder(); + + if (this.service) { + builder.append('s'); + } + + if (this.container) { + builder.append('c'); + } + + if (this.object) { + builder.append('o'); + } + + return builder.toString(); + } +} diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasService.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasService.java new file mode 100644 index 000000000000..e6af4c1854b5 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasService.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.data.tables.sas; + +import com.azure.core.annotation.Fluent; +import com.azure.data.tables.implementation.StorageConstants; + +import java.util.Locale; + +/** + * This is a helper class to construct a string representing the services accessible by an Account SAS. Setting a value + * to true means that any SAS which uses these permissions will grant access to that service. Once all the values are + * set, this should be serialized with {@code toString()} and set as the services field on an + * {@link TableAccountSasSignatureValues} object. It is possible to construct the services string without this class, but + * the order of the services is particular and this class guarantees correctness. + */ +@Fluent +public final class TableAccountSasService { + private boolean blob; + private boolean file; + private boolean queue; + private boolean table; + + /** + * Creates an {@link TableAccountSasService} from the specified services string. This method will throw an + * {@link IllegalArgumentException} if it encounters a character that does not correspond to a valid service. + * + * @param servicesString A {@link String} which represents the {@link TableAccountSasService account services}. + * + * @return A {@link TableAccountSasService} generated from the given {@link String}. + * + * @throws IllegalArgumentException If {@code servicesString} contains a character other than b, f, q, or t. + */ + public static TableAccountSasService parse(String servicesString) { + TableAccountSasService services = new TableAccountSasService(); + + for (int i = 0; i < servicesString.length(); i++) { + char c = servicesString.charAt(i); + switch (c) { + case 'b': + services.blob = true; + break; + case 'f': + services.file = true; + break; + case 'q': + services.queue = true; + break; + case 't': + services.table = true; + break; + default: + throw new IllegalArgumentException( + String.format(Locale.ROOT, StorageConstants.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Services", + servicesString, c)); + } + } + + return services; + } + + /** + * @return The access status for blob resources. + */ + public boolean hasBlobAccess() { + return blob; + } + + /** + * Sets the access status for blob resources. + * + * @param blob The access status to set. + * + * @return The updated {@link TableAccountSasService} object. + */ + public TableAccountSasService setBlobAccess(boolean blob) { + this.blob = blob; + + return this; + } + + /** + * @return The access status for file resources. + */ + public boolean hasFileAccess() { + return file; + } + + /** + * Sets the access status for file resources. + * + * @param file The access status to set. + * + * @return The updated {@link TableAccountSasService} object. + */ + public TableAccountSasService setFileAccess(boolean file) { + this.file = file; + + return this; + } + + /** + * @return The access status for queue resources. + */ + public boolean hasQueueAccess() { + return queue; + } + + /** + * Sets the access status for queue resources. + * + * @param queue The access status to set. + * + * @return The updated {@link TableAccountSasService} object. + */ + public TableAccountSasService setQueueAccess(boolean queue) { + this.queue = queue; + + return this; + } + + /** + * @return The access status for table resources. + */ + public boolean hasTableAccess() { + return table; + } + + /** + * Sets the access status for table resources. + * + * @param table The access status to set. + * + * @return The updated {@link TableAccountSasService} object. + */ + public TableAccountSasService setTableAccess(boolean table) { + this.table = table; + + return this; + } + + /** + * Converts the given services to a {@link String}. Using this method will guarantee the services are in an order + * accepted by the service. If all services are set to false, an empty string is returned from this method. + * + * @return A {@link String} which represents the {@link TableAccountSasService account services}. + */ + @Override + public String toString() { + // The order of the characters should be as specified here to ensure correctness: + // https://docs.microsoft.com/rest/api/storageservices/constructing-an-account-sas + StringBuilder value = new StringBuilder(); + + if (this.blob) { + value.append('b'); + } + if (this.queue) { + value.append('q'); + } + if (this.table) { + value.append('t'); + } + if (this.file) { + value.append('f'); + } + + return value.toString(); + } +} diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasSignatureValues.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasSignatureValues.java new file mode 100644 index 000000000000..cef83db5cb9d --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasSignatureValues.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.data.tables.sas; + +import com.azure.core.annotation.Fluent; + +import java.time.OffsetDateTime; +import java.util.Objects; + +/** + * Used to initialize parameters for a Shared Access Signature (SAS) for an Azure Storage account. Once all the values + * here are set, use the {@code generateAccountSas()} method on the desired service client to obtain a + * representation of the SAS which can then be applied to a new client using the {@code sasToken(String)} method on + * the desired client builder. + * + * @see Storage SAS overview + * @see Create an account SAS + */ +@Fluent +public final class TableAccountSasSignatureValues { + private final OffsetDateTime expiryTime; + private final String permissions; + private final String services; + private final String resourceTypes; + private String version; + private TableSasProtocol protocol; + private OffsetDateTime startTime; + private TableSasIpRange sasIpRange; + + /** + * Initializes a new {@link TableAccountSasSignatureValues} object. + * + * @param expiryTime The time after which the SAS will no longer work. + * @param permissions {@link TableAccountSasPermission account permissions} allowed by the SAS. + * @param services {@link TableAccountSasService account services} targeted by the SAS. + * @param resourceTypes {@link TableAccountSasResourceType account resource types} targeted by the SAS. + */ + public TableAccountSasSignatureValues(OffsetDateTime expiryTime, TableAccountSasPermission permissions, + TableAccountSasService services, TableAccountSasResourceType resourceTypes) { + + Objects.requireNonNull(expiryTime, "'expiryTime' cannot be null"); + Objects.requireNonNull(services, "'services' cannot be null"); + Objects.requireNonNull(permissions, "'permissions' cannot be null"); + Objects.requireNonNull(resourceTypes, "'resourceTypes' cannot be null"); + + this.expiryTime = expiryTime; + this.services = services.toString(); + this.resourceTypes = resourceTypes.toString(); + this.permissions = permissions.toString(); + } + + /** + * Get The time after which the SAS will no longer work. + * + * @return The time after which the SAS will no longer work. + */ + public OffsetDateTime getExpiryTime() { + return expiryTime; + } + + /** + * Gets the operations the SAS user may perform. Please refer to {@link TableAccountSasPermission} to help determine + * which permissions are allowed. + * + * @return The operations the SAS user may perform. + */ + public String getPermissions() { + return permissions; + } + + /** + * Get the services accessible with this SAS. Please refer to {@link TableAccountSasService} to help determine which + * services are accessible. + * + * @return The services accessible with this SAS. + */ + public String getServices() { + return services; + } + + /** + * Get the resource types accessible with this SAS. Please refer to {@link TableAccountSasResourceType} to help determine + * the resource types that are accessible. + * + * @return The resource types accessible with this SAS. + */ + public String getResourceTypes() { + return resourceTypes; + } + + /** + * Get the service version that is targeted, if {@code null} or empty the latest service version targeted by the + * library will be used. + * + * @return The service version that is targeted. + */ + public String getVersion() { + return version; + } + + /** + * Sets the service version that is targeted. Leave this {@code null} or empty to target the version used by the + * library. + * + * @param version The target version to set. + * + * @return The updated {@link TableAccountSasSignatureValues} object. + */ + public TableAccountSasSignatureValues setVersion(String version) { + this.version = version; + + return this; + } + + /** + * Get the {@link TableSasProtocol} which determines the HTTP protocol that will be used. + * + * @return The {@link TableSasProtocol}. + */ + public TableSasProtocol getProtocol() { + return protocol; + } + + /** + * Sets the {@link TableSasProtocol} which determines the HTTP protocol that will be used. + * + * @param protocol The {@link TableSasProtocol} to set. + * + * @return The updated {@link TableAccountSasSignatureValues} object. + */ + public TableAccountSasSignatureValues setProtocol(TableSasProtocol protocol) { + this.protocol = protocol; + + return this; + } + + /** + * Get when the SAS will take effect. + * + * @return When the SAS will take effect. + */ + public OffsetDateTime getStartTime() { + return startTime; + } + + /** + * Sets when the SAS will take effect. + * + * @param startTime The start time to set. + * + * @return The updated {@link TableAccountSasSignatureValues} object. + */ + public TableAccountSasSignatureValues setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + + return this; + } + + /** + * Get the {@link TableSasIpRange} which determines the IP ranges that are allowed to use the SAS. + * + * @return The {@link TableSasIpRange}. + */ + public TableSasIpRange getSasIpRange() { + return sasIpRange; + } + + /** + * Sets the {@link TableSasIpRange} which determines the IP ranges that are allowed to use the SAS. + * + * @param sasIpRange The {@link TableSasIpRange allowed IP range} to set. + * + * @return The updated {@link TableAccountSasSignatureValues} object. + * + * @see Specifying + * IP Address or IP range + */ + public TableAccountSasSignatureValues setSasIpRange(TableSasIpRange sasIpRange) { + this.sasIpRange = sasIpRange; + + return this; + } +} diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasIpRange.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasIpRange.java new file mode 100644 index 000000000000..d60ee0ed7f26 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasIpRange.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.data.tables.sas; + +import com.azure.core.annotation.Fluent; + +/** + * This type specifies a continuous range of IP addresses. It is used to limit permissions on SAS tokens. Null may be + * set if it is not desired to confine the sas permissions to an IP range. + */ +@Fluent +public final class TableSasIpRange { + private String ipMin; + private String ipMax; + + /** + * Creates a {@link TableSasIpRange} from the specified string. + * + * @param rangeStr The {@link String} representation of the {@link TableSasIpRange}. + * @return The {@link TableSasIpRange} generated from the {@link String}. + */ + public static TableSasIpRange parse(String rangeStr) { + String[] addrs = rangeStr.split("-"); + + TableSasIpRange range = new TableSasIpRange().setIpMin(addrs[0]); + + if (addrs.length > 1) { + range.setIpMax(addrs[1]); + } + + return range; + } + + /** + * @return The minimum IP address of the range. + */ + public String getIpMin() { + return ipMin; + } + + /** + * Sets the minimum IP address of the range. + * + * @param ipMin IP address to set as the minimum. + * @return The updated {@link TableSasIpRange} object. + */ + public TableSasIpRange setIpMin(String ipMin) { + this.ipMin = ipMin; + + return this; + } + + /** + * @return The maximum IP address of the range. + */ + public String getIpMax() { + return ipMax; + } + + /** + * Sets the maximum IP address of the range. + * + * @param ipMax IP address to set as the maximum. + * @return The updated {@link TableSasIpRange} object. + */ + public TableSasIpRange setIpMax(String ipMax) { + this.ipMax = ipMax; + + return this; + } + + /** + * Output the single IP address or range of IP addresses formatted as a {@link String}. If {@code minIpRange} is set + * to {@code null}, an empty string is returned from this method. Otherwise, if {@code maxIpRange} is set + * to {@code null}, then this method returns the value of {@code minIpRange}. + * + * @return The single IP address or range of IP addresses formatted as a {@link String}. + */ + @Override + public String toString() { + if (this.ipMin == null) { + return ""; + } else if (this.ipMax == null) { + return this.ipMin; + } else { + return this.ipMin + "-" + this.ipMax; + } + } +} diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasPermission.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasPermission.java new file mode 100644 index 000000000000..0b6f67210258 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasPermission.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.data.tables.sas; + +import com.azure.core.annotation.Fluent; +import com.azure.data.tables.implementation.StorageConstants; + +import java.util.Locale; + +/** + * Constructs a string representing the permissions granted by an Azure Service SAS to a table. Setting a value to true + * means that any SAS which uses these permissions will grant permissions for that operation. Once all the values are + * set, this should be serialized with {@link #toString() toString} and set as the permissions field on + * {@link TableSasSignatureValues#setPermissions(TableSasPermission)} TableSasSignatureValues}. + * + *

+ * It is possible to construct the permissions string without this class, but the order of the permissions is + * particular and this class guarantees correctness. + *

+ * + * @see + * Permissions for a table + * @see TableSasSignatureValues + */ +@Fluent +public final class TableSasPermission { + private boolean readPermission; + private boolean addPermission; + private boolean updatePermission; + private boolean deletePermission; + + /** + * Creates a {@link TableSasPermission} from the specified permissions string. This method will throw an + * {@link IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. + * + * @param permString A {@link String} which represents the {@link TableSasPermission}. + * + * @return A {@link TableSasPermission} generated from the given {@link String}. + * + * @throws IllegalArgumentException If {@code permString} contains a character other than r, a, u, or d. + */ + public static TableSasPermission parse(String permString) { + TableSasPermission permissions = new TableSasPermission(); + + for (int i = 0; i < permString.length(); i++) { + char c = permString.charAt(i); + switch (c) { + case 'r': + permissions.readPermission = true; + + break; + case 'a': + permissions.addPermission = true; + + break; + case 'u': + permissions.updatePermission = true; + + break; + case 'd': + permissions.deletePermission = true; + + break; + default: + throw new IllegalArgumentException( + String.format(Locale.ROOT, StorageConstants.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, + "Permissions", permString, c)); + } + } + + return permissions; + } + + /** + * Gets the read permissions status. + * + * @return {@code true} if the SAS has permission to get entities and query entities. {@code false}, otherwise. + */ + public boolean hasReadPermission() { + return readPermission; + } + + /** + * Sets the read permission status. + * + * @param hasReadPermission {@code true} if the SAS has permission to get entities and query entities. + * {@code false}, otherwise + * + * @return The updated TableSasPermission object. + */ + public TableSasPermission setReadPermission(boolean hasReadPermission) { + this.readPermission = hasReadPermission; + + return this; + } + + /** + * Gets the add permission status. + * + * @return {@code true} if the SAS has permission to add entities to the table. {@code false}, otherwise. + */ + public boolean hasAddPermission() { + return addPermission; + } + + /** + * Sets the add permission status. + * + * @param hasAddPermission {@code true} if the SAS has permission to add entities to the table. {@code false}, + * otherwise. + * + *

+ * Note: The {@code add} and {@code update} permissions are required for upsert operations. + *

+ * + * @return The updated {@link TableSasPermission} object. + */ + public TableSasPermission setAddPermission(boolean hasAddPermission) { + this.addPermission = hasAddPermission; + + return this; + } + + /** + * Gets the update permission status. + * + * @return {@code true} if the SAS has permission to update entities in the table. {@code false}, otherwise. + */ + public boolean hasUpdatePermission() { + return updatePermission; + } + + /** + * Sets the update permission status. + * + *

+ * Note: The {@code add} and {@code update} permissions are required for upsert operations. + *

+ * + * @param hasUpdatePermission {@code true} if the SAS has permission to update entities in the table. {@code false}, + * otherwise. + * + * @return The updated {@link TableSasPermission} object. + */ + public TableSasPermission setUpdatePermission(boolean hasUpdatePermission) { + this.updatePermission = hasUpdatePermission; + + return this; + } + + /** + * Gets the delete permission status. + * + * @return {@code true} if the SAS has permission to delete entities from the table. {@code false}, otherwise. + */ + public boolean hasDeletePermission() { + return deletePermission; + } + + /** + * Sets the process permission status. + * + * @param hasDeletePermission {@code true} if the SAS has permission to delete entities from the table. + * {@code false}, otherwise. + * + * @return The updated {@link TableSasPermission} object. + */ + public TableSasPermission setDeletePermission(boolean hasDeletePermission) { + this.deletePermission = hasDeletePermission; + + return this; + } + + /** + * Converts the given permissions to a {@link String}. Using this method will guarantee the permissions are in an + * order accepted by the service. If all permissions are set to false, an empty string is returned from this method. + * + * @return A {@link String} which represents the {@link TableSasPermission}. + */ + @Override + public String toString() { + // The order of the characters should be as specified here to ensure correctness: + // https://docs.microsoft.com/rest/api/storageservices/constructing-a-service-sas + + final StringBuilder builder = new StringBuilder(); + + if (this.readPermission) { + builder.append('r'); + } + + if (this.addPermission) { + builder.append('a'); + } + + if (this.updatePermission) { + builder.append('u'); + } + + if (this.deletePermission) { + builder.append('d'); + } + + return builder.toString(); + } +} diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/SasProtocol.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasProtocol.java similarity index 74% rename from sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/SasProtocol.java rename to sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasProtocol.java index 36463e7180b8..ca3b747a5d58 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/implementation/SasProtocol.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasProtocol.java @@ -1,13 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.data.tables.implementation; + +package com.azure.data.tables.sas; + +import com.azure.data.tables.implementation.StorageConstants; import java.util.Locale; /** * Specifies the set of possible permissions for Shared Access Signature protocol. */ -public enum SasProtocol { +public enum TableSasProtocol { /** * Permission to use SAS only through https granted. */ @@ -20,23 +23,23 @@ public enum SasProtocol { private final String protocols; - SasProtocol(String p) { + TableSasProtocol(String p) { this.protocols = p; } /** - * Parses a {@code String} into a {@link SasProtocol} value if possible. + * Parses a {@code String} into a {@link TableSasProtocol} value if possible. * * @param str The value to try to parse. * * @return A {@code SasProtocol} value that represents the string if possible. * @throws IllegalArgumentException If {@code str} doesn't equal "https" or "https,http". */ - public static SasProtocol parse(String str) { + public static TableSasProtocol parse(String str) { if (str.equals(StorageConstants.HTTPS)) { - return SasProtocol.HTTPS_ONLY; + return TableSasProtocol.HTTPS_ONLY; } else if (str.equals(StorageConstants.HTTPS_HTTP)) { - return SasProtocol.HTTPS_HTTP; + return TableSasProtocol.HTTPS_HTTP; } throw new IllegalArgumentException(String.format(Locale.ROOT, diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasSignatureValues.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasSignatureValues.java new file mode 100644 index 000000000000..4d736c67a080 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasSignatureValues.java @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.data.tables.sas; + +import com.azure.core.annotation.Fluent; + +import java.time.OffsetDateTime; +import java.util.Objects; + +/** + * Used to initialize parameters for a Shared Access Signature (SAS) for the Azure Table Storage service. Once all the + * values here are set, use the {@code generateSas()} method on the desired Table client to obtain a representation + * of the SAS which can then be applied to a new client using the {@code sasToken(String)} method on the desired + * client builder. + * + * @see Storage SAS overview + * @see Constructing a Service SAS + */ +@Fluent +public final class TableSasSignatureValues { + private String version; + private TableSasProtocol protocol; + private OffsetDateTime startTime; + private OffsetDateTime expiryTime; + private String permissions; + private TableSasIpRange sasIpRange; + private String identifier; + private String startPartitionKey; + private String startRowKey; + private String endPartitionKey; + private String endRowKey; + + /** + * Creates an object with the specified expiry time and permissions. + * + * @param expiryTime The time after which the SAS will no longer work. + * @param permissions {@link TableSasPermission table permissions} allowed by the SAS. + */ + public TableSasSignatureValues(OffsetDateTime expiryTime, TableSasPermission permissions) { + Objects.requireNonNull(expiryTime, "'expiryTime' cannot be null"); + Objects.requireNonNull(permissions, "'permissions' cannot be null"); + + this.expiryTime = expiryTime; + this.permissions = permissions.toString(); + } + + /** + * Creates an object with the specified identifier. + * + * @param identifier Name of the access policy. + */ + public TableSasSignatureValues(String identifier) { + Objects.requireNonNull(identifier, "'identifier' cannot be null"); + + this.identifier = identifier; + } + + /** + * @return The version of the service this SAS will target. If not specified, it will default to the version + * targeted by the library. + */ + public String getVersion() { + return version; + } + + /** + * Sets the version of the service this SAS will target. If not specified, it will default to the version targeted + * by the library. + * + * @param version Version to target + * + * @return The updated {@link TableSasSignatureValues} object. + */ + public TableSasSignatureValues setVersion(String version) { + this.version = version; + + return this; + } + + /** + * @return The {@link TableSasProtocol} which determines the protocols allowed by the SAS. + */ + public TableSasProtocol getProtocol() { + return protocol; + } + + /** + * Sets the {@link TableSasProtocol} which determines the protocols allowed by the SAS. + * + * @param protocol Protocol for the SAS + * + * @return The updated {@link TableSasSignatureValues} object. + */ + public TableSasSignatureValues setProtocol(TableSasProtocol protocol) { + this.protocol = protocol; + + return this; + } + + /** + * @return When the SAS will take effect. + */ + public OffsetDateTime getStartTime() { + return startTime; + } + + /** + * Sets when the SAS will take effect. + * + * @param startTime When the SAS takes effect + * + * @return The updated {@link TableSasSignatureValues} object. + */ + public TableSasSignatureValues setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + + return this; + } + + /** + * @return The time after which the SAS will no longer work. + */ + public OffsetDateTime getExpiryTime() { + return expiryTime; + } + + /** + * Sets the time after which the SAS will no longer work. + * + * @param expiryTime When the SAS will no longer work + * + * @return The updated {@link TableSasSignatureValues} object. + */ + public TableSasSignatureValues setExpiryTime(OffsetDateTime expiryTime) { + this.expiryTime = expiryTime; + + return this; + } + + /** + * @return The permissions string allowed by the SAS. Please refer to {@link TableSasPermission} for help + * determining the permissions allowed. + */ + public String getPermissions() { + return permissions; + } + + /** + * Sets the permissions string allowed by the SAS. Please refer to {@link TableSasPermission} for help constructing + * the permissions string. + * + * @param permissions Permissions for the SAS + * + * @return The updated {@link TableSasSignatureValues} object. + * + * @throws NullPointerException if {@code permissions} is null. + */ + public TableSasSignatureValues setPermissions(TableSasPermission permissions) { + Objects.requireNonNull(permissions, "'permissions' cannot be null"); + + this.permissions = permissions.toString(); + + return this; + } + + /** + * @return The {@link TableSasIpRange} which determines the IP ranges that are allowed to use the SAS. + */ + public TableSasIpRange getSasIpRange() { + return sasIpRange; + } + + /** + * Sets the {@link TableSasIpRange} which determines the IP ranges that are allowed to use the SAS. + * + * @param sasIpRange Allowed IP range to set + * + * @return The updated {@link TableSasSignatureValues} object. + * + * @see Specifying + * IP Address or IP range + */ + public TableSasSignatureValues setSasIpRange(TableSasIpRange sasIpRange) { + this.sasIpRange = sasIpRange; + + return this; + } + + /** + * @return The name of the access policy on the table this SAS references if any. Please see + * here + * for more information. + */ + public String getIdentifier() { + return identifier; + } + + /** + * Sets the name of the access policy on the table this SAS references if any. Please see + * here + * for more information. + * + * @param identifier Name of the access policy + * + * @return The updated {@link TableSasSignatureValues} object. + */ + public TableSasSignatureValues setIdentifier(String identifier) { + this.identifier = identifier; + + return this; + } + + /** + * Get the minimum partition key accessible with this shared access signature. Key values are inclusive. If omitted, + * there is no lower bound on the table entities that can be accessed. If provided, it must accompany a start row + * key that can be set via {@code setStartRowKey()}. + * + * @return The start partition key. + */ + public String getStartPartitionKey() { + return this.startPartitionKey; + } + + /** + * Set the minimum partition key accessible with this shared access signature. Key values are inclusive. If omitted, + * there is no lower bound on the table entities that can be accessed. If provided, it must accompany a start row + * key that can be set via {@code setStartRowKey()}. + * + * @param startPartitionKey The start partition key to set. + * + * @return The updated {@link TableSasSignatureValues} object. + */ + public TableSasSignatureValues setStartPartitionKey(String startPartitionKey) { + this.startPartitionKey = startPartitionKey; + return this; + } + + /** + * Get the minimum row key accessible with this shared access signature. Key values are inclusive. If omitted, there + * is no lower bound on the table entities that can be accessed. If provided, it must accompany a start row key + * that can be set via {@code setStartPartitionKey()}. + * + * @return The start row key. + */ + public String getStartRowKey() { + return this.startRowKey; + } + + /** + * Set the minimum row key accessible with this shared access signature. Key values are inclusive. If omitted, there + * is no lower bound on the table entities that can be accessed. If provided, it must accompany a start row key + * that can be set via {@code setStartPartitionKey()}. + * + * @param startRowKey The start row key to set. + * + * @return The updated {@link TableSasSignatureValues} object. + */ + public TableSasSignatureValues setStartRowKey(String startRowKey) { + this.startRowKey = startRowKey; + + return this; + } + + /** + * Get the maximum partition key accessible with this shared access signature. Key values are inclusive. If omitted, + * there is no upper bound on the table entities that can be accessed. If provided, it must accompany an ending row + * key that can be set via {@code setEndRowKey()}. + * + * @return The end partition key. + */ + public String getEndPartitionKey() { + return this.endPartitionKey; + } + + /** + * Set the maximum partition key accessible with this shared access signature. Key values are inclusive. If omitted, + * there is no upper bound on the table entities that can be accessed. If provided, it must accompany an ending row + * key that can be set via {@code setEndRowKey()}. + * + * @param endPartitionKey The end partition key to set. + * + * @return The updated {@link TableSasSignatureValues} object. + */ + public TableSasSignatureValues setEndPartitionKey(String endPartitionKey) { + this.endPartitionKey = endPartitionKey; + + return this; + } + + /** + * Get the maximum row key accessible with this shared access signature. Key values are inclusive. If omitted, there + * is no upper bound on the table entities that can be accessed. If provided, it must accompany an ending row key + * that can be set via {@code setEndPartitionKey()}. + * + * @return The end row key. + */ + public String getEndRowKey() { + return this.endRowKey; + } + + /** + * Set the maximum row key accessible with this shared access signature. Key values are inclusive. If omitted, there + * is no upper bound on the table entities that can be accessed. If provided, it must accompany an ending row key + * that can be set via {@code setEndPartitionKey()}. + * + * @param endRowKey The end row key to set. + * + * @return The updated {@link TableSasSignatureValues} object. + */ + public TableSasSignatureValues setEndRowKey(String endRowKey) { + this.endRowKey = endRowKey; + + return this; + } +} diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/package-info.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/package-info.java new file mode 100644 index 000000000000..bc32f4bf2928 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing SAS (shared access signature) classes used by Azure Data Tables. + */ +package com.azure.data.tables.sas; diff --git a/sdk/tables/azure-data-tables/src/main/java/module-info.java b/sdk/tables/azure-data-tables/src/main/java/module-info.java index 1b8c7dec7b82..a4df97c48c88 100644 --- a/sdk/tables/azure-data-tables/src/main/java/module-info.java +++ b/sdk/tables/azure-data-tables/src/main/java/module-info.java @@ -7,13 +7,12 @@ // public API surface area exports com.azure.data.tables; exports com.azure.data.tables.models; - - exports com.azure.data.tables.implementation to com.azure.core; - exports com.azure.data.tables.implementation.models to com.azure.core; + exports com.azure.data.tables.sas; // exporting some packages specifically for Jackson opens com.azure.data.tables to com.fasterxml.jackson.databind, com.azure.core; opens com.azure.data.tables.implementation to com.fasterxml.jackson.databind, com.azure.core; opens com.azure.data.tables.implementation.models to com.fasterxml.jackson.databind, com.azure.core; opens com.azure.data.tables.models to com.fasterxml.jackson.databind, com.azure.core; + opens com.azure.data.tables.sas to com.fasterxml.jackson.databind, com.azure.core; } diff --git a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/SasModelsTest.java b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/SasModelsTest.java new file mode 100644 index 000000000000..8be6348d27e2 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/SasModelsTest.java @@ -0,0 +1,329 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.data.tables; + +import com.azure.data.tables.sas.TableAccountSasPermission; +import com.azure.data.tables.sas.TableAccountSasResourceType; +import com.azure.data.tables.sas.TableAccountSasService; +import com.azure.data.tables.sas.TableAccountSasSignatureValues; +import com.azure.data.tables.sas.TableSasIpRange; +import com.azure.data.tables.sas.TableSasPermission; +import com.azure.data.tables.sas.TableSasProtocol; +import com.azure.data.tables.sas.TableSasSignatureValues; +import org.junit.jupiter.api.Test; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SasModelsTest { + @Test + public void createTableAccountSasSignatureValuesWithMinimumValues() { + OffsetDateTime expiryTime = OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); + TableAccountSasPermission permissions = TableAccountSasPermission.parse("l"); + TableAccountSasService services = TableAccountSasService.parse("t"); + TableAccountSasResourceType resourceTypes = TableAccountSasResourceType.parse("o"); + + OffsetDateTime startTime = OffsetDateTime.of(2015, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); + TableSasIpRange ipRange = TableSasIpRange.parse("a-b"); + TableSasProtocol protocol = TableSasProtocol.HTTPS_ONLY; + + TableAccountSasSignatureValues sasSignatureValues = + new TableAccountSasSignatureValues(expiryTime, permissions, services, resourceTypes) + .setStartTime(startTime) + .setSasIpRange(ipRange) + .setProtocol(protocol); + + assertEquals(expiryTime, sasSignatureValues.getExpiryTime()); + assertEquals(permissions.toString(), sasSignatureValues.getPermissions()); + assertEquals(services.toString(), sasSignatureValues.getServices()); + assertEquals(resourceTypes.toString(), sasSignatureValues.getResourceTypes()); + assertEquals(startTime, sasSignatureValues.getStartTime()); + assertEquals(ipRange, sasSignatureValues.getSasIpRange()); + assertEquals(protocol, sasSignatureValues.getProtocol()); + } + + @Test + public void createTableAccountSasSignatureValuesWithNullRequiredValue() { + OffsetDateTime expiryTime = OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); + TableAccountSasPermission permissions = TableAccountSasPermission.parse("l"); // List permission + TableAccountSasService services = TableAccountSasService.parse("t"); // Tables service + TableAccountSasResourceType resourceTypes = TableAccountSasResourceType.parse("o"); // Object resource + + assertThrows(NullPointerException.class, + () -> new TableAccountSasSignatureValues(null, permissions, services, resourceTypes)); + assertThrows(NullPointerException.class, + () -> new TableAccountSasSignatureValues(expiryTime, null, services, resourceTypes)); + assertThrows(NullPointerException.class, + () -> new TableAccountSasSignatureValues(expiryTime, permissions, null, resourceTypes)); + assertThrows(NullPointerException.class, + () -> new TableAccountSasSignatureValues(expiryTime, permissions, services, null)); + } + + @Test + public void tableAccountSasPermissionToString() { + assertEquals("rwdxlacuptf", new TableAccountSasPermission() + .setReadPermission(true) + .setWritePermission(true) + .setDeletePermission(true) + .setListPermission(true) + .setAddPermission(true) + .setCreatePermission(true) + .setUpdatePermission(true) + .setProcessMessages(true) + .setDeleteVersionPermission(true) + .setTagsPermission(true) + .setFilterTagsPermission(true) + .toString()); + assertEquals("r", new TableAccountSasPermission().setReadPermission(true).toString()); + assertEquals("w", new TableAccountSasPermission().setWritePermission(true).toString()); + assertEquals("d", new TableAccountSasPermission().setDeletePermission(true).toString()); + assertEquals("l", new TableAccountSasPermission().setListPermission(true).toString()); + assertEquals("a", new TableAccountSasPermission().setAddPermission(true).toString()); + assertEquals("c", new TableAccountSasPermission().setCreatePermission(true).toString()); + assertEquals("u", new TableAccountSasPermission().setUpdatePermission(true).toString()); + assertEquals("p", new TableAccountSasPermission().setProcessMessages(true).toString()); + assertEquals("x", new TableAccountSasPermission().setDeleteVersionPermission(true).toString()); + assertEquals("t", new TableAccountSasPermission().setTagsPermission(true).toString()); + assertEquals("f", new TableAccountSasPermission().setFilterTagsPermission(true).toString()); + } + + @Test + public void tableAccountSasPermissionParse() { + TableAccountSasPermission tableAccountSasPermission = TableAccountSasPermission.parse("rwdxlacuptf"); + + assertTrue(tableAccountSasPermission.hasReadPermission()); + assertTrue(tableAccountSasPermission.hasWritePermission()); + assertTrue(tableAccountSasPermission.hasDeletePermission()); + assertTrue(tableAccountSasPermission.hasListPermission()); + assertTrue(tableAccountSasPermission.hasAddPermission()); + assertTrue(tableAccountSasPermission.hasCreatePermission()); + assertTrue(tableAccountSasPermission.hasUpdatePermission()); + assertTrue(tableAccountSasPermission.hasProcessMessages()); + assertTrue(tableAccountSasPermission.hasDeleteVersionPermission()); + assertTrue(tableAccountSasPermission.hasTagsPermission()); + assertTrue(tableAccountSasPermission.hasFilterTagsPermission()); + + tableAccountSasPermission = TableAccountSasPermission.parse("lwfrutpcaxd"); + + assertTrue(tableAccountSasPermission.hasReadPermission()); + assertTrue(tableAccountSasPermission.hasWritePermission()); + assertTrue(tableAccountSasPermission.hasDeletePermission()); + assertTrue(tableAccountSasPermission.hasListPermission()); + assertTrue(tableAccountSasPermission.hasAddPermission()); + assertTrue(tableAccountSasPermission.hasCreatePermission()); + assertTrue(tableAccountSasPermission.hasUpdatePermission()); + assertTrue(tableAccountSasPermission.hasProcessMessages()); + assertTrue(tableAccountSasPermission.hasDeleteVersionPermission()); + assertTrue(tableAccountSasPermission.hasTagsPermission()); + assertTrue(tableAccountSasPermission.hasFilterTagsPermission()); + + assertTrue(TableAccountSasPermission.parse("r").hasReadPermission()); + assertTrue(TableAccountSasPermission.parse("w").hasWritePermission()); + assertTrue(TableAccountSasPermission.parse("d").hasDeletePermission()); + assertTrue(TableAccountSasPermission.parse("l").hasListPermission()); + assertTrue(TableAccountSasPermission.parse("a").hasAddPermission()); + assertTrue(TableAccountSasPermission.parse("c").hasCreatePermission()); + assertTrue(TableAccountSasPermission.parse("u").hasUpdatePermission()); + assertTrue(TableAccountSasPermission.parse("p").hasProcessMessages()); + assertTrue(TableAccountSasPermission.parse("x").hasDeleteVersionPermission()); + assertTrue(TableAccountSasPermission.parse("t").hasTagsPermission()); + assertTrue(TableAccountSasPermission.parse("f").hasFilterTagsPermission()); + } + + @Test + public void tableAccountSasPermissionParseIllegalString() { + assertThrows(IllegalArgumentException.class, () -> TableAccountSasPermission.parse("rwaq")); + } + + @Test + public void tableAccountSasResourceTypeToString() { + assertEquals("sco", new TableAccountSasResourceType() + .setService(true) + .setContainer(true) + .setObject(true) + .toString()); + + assertEquals("s", new TableAccountSasResourceType().setService(true).toString()); + assertEquals("c", new TableAccountSasResourceType().setContainer(true).toString()); + assertEquals("o", new TableAccountSasResourceType().setObject(true).toString()); + } + + @Test + public void tableAccountSasResourceTypeParse() { + TableAccountSasResourceType tableAccountSasResourceType = TableAccountSasResourceType.parse("sco"); + + assertTrue(tableAccountSasResourceType.isService()); + assertTrue(tableAccountSasResourceType.isContainer()); + assertTrue(tableAccountSasResourceType.isObject()); + + assertTrue(TableAccountSasResourceType.parse("s").isService()); + assertTrue(TableAccountSasResourceType.parse("c").isContainer()); + assertTrue(TableAccountSasResourceType.parse("o").isObject()); + } + + @Test + public void tableAccountSasResourceTypeParseIllegalString() { + assertThrows(IllegalArgumentException.class, () -> TableAccountSasResourceType.parse("scq")); + } + + @Test + public void tableAccountSasServiceToString() { + assertEquals("bqtf", new TableAccountSasService() + .setBlobAccess(true) + .setQueueAccess(true) + .setTableAccess(true) + .setFileAccess(true) + .toString()); + + assertEquals("b", new TableAccountSasService().setBlobAccess(true).toString()); + assertEquals("q", new TableAccountSasService().setQueueAccess(true).toString()); + assertEquals("t", new TableAccountSasService().setTableAccess(true).toString()); + assertEquals("f", new TableAccountSasService().setFileAccess(true).toString()); + } + + @Test + public void tableAccountSasServiceParse() { + TableAccountSasService tableAccountSasService = TableAccountSasService.parse("bqtf"); + + assertTrue(tableAccountSasService.hasBlobAccess()); + assertTrue(tableAccountSasService.hasQueueAccess()); + assertTrue(tableAccountSasService.hasTableAccess()); + assertTrue(tableAccountSasService.hasFileAccess()); + + assertTrue(TableAccountSasService.parse("b").hasBlobAccess()); + assertTrue(TableAccountSasService.parse("q").hasQueueAccess()); + assertTrue(TableAccountSasService.parse("t").hasTableAccess()); + assertTrue(TableAccountSasService.parse("f").hasFileAccess()); + } + + @Test + public void tableAccountSasServiceParseIllegalString() { + assertThrows(IllegalArgumentException.class, () -> TableAccountSasService.parse("bqta")); + } + + @Test + public void tableSasIpRangeToString() { + assertEquals("a-b", new TableSasIpRange() + .setIpMin("a") + .setIpMax("b") + .toString()); + + assertEquals("a", new TableSasIpRange().setIpMin("a").toString()); + assertEquals("", new TableSasIpRange().setIpMax("b").toString()); + } + + @Test + public void tableSasIpRangeParse() { + TableSasIpRange tableSasIpRange = TableSasIpRange.parse("a-b"); + + assertEquals("a", tableSasIpRange.getIpMin()); + assertEquals("b", tableSasIpRange.getIpMax()); + + tableSasIpRange = TableSasIpRange.parse("a"); + + assertEquals("a", tableSasIpRange.getIpMin()); + assertNull(tableSasIpRange.getIpMax()); + + tableSasIpRange = TableSasIpRange.parse(""); + + assertEquals("", tableSasIpRange.getIpMin()); + assertNull(tableSasIpRange.getIpMax()); + } + + @Test + public void tableSasProtocolParse() { + assertEquals(TableSasProtocol.HTTPS_ONLY, TableSasProtocol.parse("https")); + assertEquals(TableSasProtocol.HTTPS_HTTP, TableSasProtocol.parse("https,http")); + } + + @Test + public void createTableSasSignatureValuesWithMinimumValues() { + OffsetDateTime expiryTime = OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); + TableSasPermission permissions = TableSasPermission.parse("r"); + + OffsetDateTime startTime = OffsetDateTime.of(2015, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); + TableSasIpRange ipRange = TableSasIpRange.parse("a-b"); + TableSasProtocol protocol = TableSasProtocol.HTTPS_ONLY; + String startPartitionKey = "startPartitionKey"; + String startRowKey = "startRowKey"; + String endPartitionKey = "endPartitionKey"; + String endRowKey = "endRowKey"; + + TableSasSignatureValues sasSignatureValues = + new TableSasSignatureValues(expiryTime, permissions) + .setStartTime(startTime) + .setSasIpRange(ipRange) + .setProtocol(protocol) + .setStartPartitionKey(startPartitionKey) + .setStartRowKey(startRowKey) + .setEndPartitionKey(endPartitionKey) + .setEndRowKey(endRowKey); + + assertEquals(expiryTime, sasSignatureValues.getExpiryTime()); + assertEquals(permissions.toString(), sasSignatureValues.getPermissions()); + assertEquals(startTime, sasSignatureValues.getStartTime()); + assertEquals(ipRange, sasSignatureValues.getSasIpRange()); + assertEquals(protocol, sasSignatureValues.getProtocol()); + assertEquals(startPartitionKey, sasSignatureValues.getStartPartitionKey()); + assertEquals(startRowKey, sasSignatureValues.getStartRowKey()); + assertEquals(endPartitionKey, sasSignatureValues.getEndPartitionKey()); + assertEquals(endRowKey, sasSignatureValues.getEndRowKey()); + } + + @Test + public void createTableSasSignatureValuesWithNullRequiredValue() { + OffsetDateTime expiryTime = OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); + TableSasPermission permissions = TableSasPermission.parse("r"); + + assertThrows(NullPointerException.class, + () -> new TableSasSignatureValues(null, permissions)); + assertThrows(NullPointerException.class, + () -> new TableSasSignatureValues(expiryTime, null)); + } + + @Test + public void tableSasPermissionToString() { + assertEquals("raud", new TableSasPermission() + .setReadPermission(true) + .setAddPermission(true) + .setUpdatePermission(true) + .setDeletePermission(true) + .toString()); + assertEquals("r", new TableSasPermission().setReadPermission(true).toString()); + assertEquals("a", new TableSasPermission().setAddPermission(true).toString()); + assertEquals("u", new TableSasPermission().setUpdatePermission(true).toString()); + assertEquals("d", new TableSasPermission().setDeletePermission(true).toString()); + } + + @Test + public void tableSasPermissionParse() { + TableSasPermission tableSasPermission = TableSasPermission.parse("raud"); + + assertTrue(tableSasPermission.hasReadPermission()); + assertTrue(tableSasPermission.hasAddPermission()); + assertTrue(tableSasPermission.hasUpdatePermission()); + assertTrue(tableSasPermission.hasDeletePermission()); + + tableSasPermission = TableSasPermission.parse("urda"); + + assertTrue(tableSasPermission.hasReadPermission()); + assertTrue(tableSasPermission.hasAddPermission()); + assertTrue(tableSasPermission.hasUpdatePermission()); + assertTrue(tableSasPermission.hasDeletePermission()); + + assertTrue(TableSasPermission.parse("r").hasReadPermission()); + assertTrue(TableSasPermission.parse("a").hasAddPermission()); + assertTrue(TableSasPermission.parse("u").hasUpdatePermission()); + assertTrue(TableSasPermission.parse("d").hasDeletePermission()); + } + + @Test + public void tableSasPermissionParseIllegalString() { + assertThrows(IllegalArgumentException.class, () -> TableSasPermission.parse("raup")); + } +} diff --git a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TablesAsyncClientTest.java b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableAsyncClientTest.java similarity index 88% rename from sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TablesAsyncClientTest.java rename to sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableAsyncClientTest.java index 640ed3fce28d..aea0ed4f5502 100644 --- a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TablesAsyncClientTest.java +++ b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableAsyncClientTest.java @@ -12,14 +12,18 @@ import com.azure.core.http.rest.Response; import com.azure.core.test.TestBase; import com.azure.core.test.utils.TestResourceNamer; -import com.azure.data.tables.models.TableTransactionActionResponse; import com.azure.data.tables.models.ListEntitiesOptions; import com.azure.data.tables.models.TableEntity; import com.azure.data.tables.models.TableEntityUpdateMode; import com.azure.data.tables.models.TableTransactionAction; +import com.azure.data.tables.models.TableTransactionActionResponse; import com.azure.data.tables.models.TableTransactionActionType; import com.azure.data.tables.models.TableTransactionFailedException; import com.azure.data.tables.models.TableTransactionResult; +import com.azure.data.tables.sas.TableSasIpRange; +import com.azure.data.tables.sas.TableSasPermission; +import com.azure.data.tables.sas.TableSasProtocol; +import com.azure.data.tables.sas.TableSasSignatureValues; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; @@ -29,6 +33,7 @@ import java.time.Duration; import java.time.OffsetDateTime; +import java.time.ZoneOffset; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -43,7 +48,7 @@ /** * Tests {@link TableAsyncClient}. */ -public class TablesAsyncClientTest extends TestBase { +public class TableAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(100); private TableAsyncClient tableClient; @@ -72,13 +77,16 @@ protected void beforeTest() { if (interceptorManager.isPlaybackMode()) { playbackClient = interceptorManager.getPlaybackClient(); + builder.httpClient(playbackClient); } else { builder.httpClient(HttpClient.createDefault()); if (!interceptorManager.isLiveMode()) { recordPolicy = interceptorManager.getRecordPolicy(); + builder.addPolicy(recordPolicy); } + builder.addPolicy(new RetryPolicy(new ExponentialBackoff(6, Duration.ofMillis(1500), Duration.ofSeconds(100)))); } @@ -884,4 +892,121 @@ void submitTransactionAsyncWithDifferentPartitionKeys() { && e.getMessage().contains("rowKey='" + rowKeyValue2)) .verify(); } + + @Test + @Tag("SAS") + public void generateSasTokenWithMinimumParameters() { + final OffsetDateTime expiryTime = OffsetDateTime.of(2021, 12, 12, 0, 0, 0, 0, ZoneOffset.UTC); + final TableSasPermission permissions = TableSasPermission.parse("r"); + final TableSasProtocol protocol = TableSasProtocol.HTTPS_ONLY; + + final TableSasSignatureValues sasSignatureValues = + new TableSasSignatureValues(expiryTime, permissions) + .setProtocol(protocol) + .setVersion(TableServiceVersion.V2019_02_02.getVersion()); + + final String sas = tableClient.generateSas(sasSignatureValues); + + assertTrue( + sas.startsWith( + "sv=2019-02-02" + + "&se=2021-12-12T00%3A00%3A00Z" + + "&tn=" + tableClient.getTableName() + + "&sp=r" + + "&spr=https" + + "&sig=" + ) + ); + } + + @Test + @Tag("SAS") + public void generateSasTokenWithAllParameters() { + final OffsetDateTime expiryTime = OffsetDateTime.of(2021, 12, 12, 0, 0, 0, 0, ZoneOffset.UTC); + final TableSasPermission permissions = TableSasPermission.parse("raud"); + final TableSasProtocol protocol = TableSasProtocol.HTTPS_HTTP; + + final OffsetDateTime startTime = OffsetDateTime.of(2015, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); + final TableSasIpRange ipRange = TableSasIpRange.parse("a-b"); + final String startPartitionKey = "startPartitionKey"; + final String startRowKey = "startRowKey"; + final String endPartitionKey = "endPartitionKey"; + final String endRowKey = "endRowKey"; + + final TableSasSignatureValues sasSignatureValues = + new TableSasSignatureValues(expiryTime, permissions) + .setProtocol(protocol) + .setVersion(TableServiceVersion.V2019_02_02.getVersion()) + .setStartTime(startTime) + .setSasIpRange(ipRange) + .setStartPartitionKey(startPartitionKey) + .setStartRowKey(startRowKey) + .setEndPartitionKey(endPartitionKey) + .setEndRowKey(endRowKey); + + final String sas = tableClient.generateSas(sasSignatureValues); + + assertTrue( + sas.startsWith( + "sv=2019-02-02" + + "&st=2015-01-01T00%3A00%3A00Z" + + "&se=2021-12-12T00%3A00%3A00Z" + + "&tn=" + tableClient.getTableName() + + "&sp=raud" + + "&spk=startPartitionKey" + + "&srk=startRowKey" + + "&epk=endPartitionKey" + + "&erk=endRowKey" + + "&sip=a-b" + + "&spr=https%2Chttp" + + "&sig=" + ) + ); + } + + @Test + @Tag("SAS") + public void canUseSasTokenToCreateValidTableClient() { + final OffsetDateTime expiryTime = OffsetDateTime.of(2021, 12, 12, 0, 0, 0, 0, ZoneOffset.UTC); + final TableSasPermission permissions = TableSasPermission.parse("a"); + final TableSasProtocol protocol = TableSasProtocol.HTTPS_HTTP; + + final TableSasSignatureValues sasSignatureValues = + new TableSasSignatureValues(expiryTime, permissions) + .setProtocol(protocol) + .setVersion(TableServiceVersion.V2019_02_02.getVersion()); + + final String sas = tableClient.generateSas(sasSignatureValues); + + final TableClientBuilder tableClientBuilder = new TableClientBuilder() + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) + .endpoint(tableClient.getTableEndpoint()) + .sasToken(sas) + .tableName(tableClient.getTableName()); + + if (interceptorManager.isPlaybackMode()) { + tableClientBuilder.httpClient(playbackClient); + } else { + tableClientBuilder.httpClient(HttpClient.createDefault()); + + if (!interceptorManager.isLiveMode()) { + tableClientBuilder.addPolicy(recordPolicy); + } + + tableClientBuilder.addPolicy(new RetryPolicy(new ExponentialBackoff(6, Duration.ofMillis(1500), + Duration.ofSeconds(100)))); + } + + // Create a new client authenticated with the SAS token. + final TableAsyncClient tableAsyncClient = tableClientBuilder.buildAsyncClient(); + final String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); + final String rowKeyValue = testResourceNamer.randomName("rowKey", 20); + final TableEntity entity = new TableEntity(partitionKeyValue, rowKeyValue); + final int expectedStatusCode = 204; + + StepVerifier.create(tableAsyncClient.createEntityWithResponse(entity)) + .assertNext(response -> assertEquals(expectedStatusCode, response.getStatusCode())) + .expectComplete() + .verify(); + } } diff --git a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TablesClientBuilderTest.java b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableClientBuilderTest.java similarity index 64% rename from sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TablesClientBuilderTest.java rename to sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableClientBuilderTest.java index 9104f15fc517..50dbd29adbcf 100644 --- a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TablesClientBuilderTest.java +++ b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableClientBuilderTest.java @@ -21,12 +21,13 @@ import java.security.SecureRandom; import java.util.Collections; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -public class TablesClientBuilderTest { +public class TableClientBuilderTest { private String tableName; private String connectionString; private TableServiceVersion serviceVersion; @@ -192,4 +193,81 @@ public void addPerCallPolicy() { assertTrue(perCallPolicyPosition < retryPolicyPosition); assertTrue(retryPolicyPosition < perRetryPolicyPosition); } + + @Test + public void multipleFormsOfAuthenticationPresent() { + assertThrows(IllegalStateException.class, () -> new TableClientBuilder() + .sasToken("sasToken") + .credential(new AzureNamedKeyCredential("name", "key")) + .tableName("myTable") + .endpoint("https://myaccount.table.core.windows.net") + .buildAsyncClient()); + + assertThrows(IllegalStateException.class, () -> new TableClientBuilder() + .sasToken("sasToken") + .credential(new AzureSasCredential("sasToken")) + .tableName("myTable") + .endpoint("https://myaccount.table.core.windows.net") + .buildAsyncClient()); + + assertThrows(IllegalStateException.class, () -> new TableClientBuilder() + .credential(new AzureNamedKeyCredential("name", "key")) + .credential(new AzureSasCredential("sasToken")) + .tableName("myTable") + .endpoint("https://myaccount.table.core.windows.net") + .buildAsyncClient()); + + assertThrows(IllegalStateException.class, () -> new TableClientBuilder() + .sasToken("sasToken") + .credential(new AzureNamedKeyCredential("name", "key")) + .credential(new AzureSasCredential("sasToken")) + .tableName("myTable") + .endpoint("https://myaccount.table.core.windows.net") + .buildAsyncClient()); + } + + @Test + public void buildWithSameSasTokenInConnectionStringDoesNotThrow() { + assertDoesNotThrow(() -> new TableClientBuilder() + .sasToken("sv=2020-02-10&ss=t&srt=o&sp=rwdlacu&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=someSignature") + .connectionString("TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sv=2020-02-10&ss=t&srt=o&sp=rwdlacu&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=someSignature") + .tableName("myTable") + .buildAsyncClient()); + } + + @Test + public void buildWithDifferentSasTokenInConnectionStringThrows() { + assertThrows(IllegalStateException.class, () -> new TableClientBuilder() + .sasToken("sv=2020-02-10&ss=t&srt=o&sp=rwd&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=someSignature") + .connectionString("TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sv=2020-02-10&ss=t&srt=o&sp=rwdlacu&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=anotherSignature") + .tableName("myTable") + .buildAsyncClient()); + } + + @Test + public void buildWithSameEndpointInConnectionStringDoesNotThrow() { + assertDoesNotThrow(() -> new TableClientBuilder() + .endpoint("https://myaccount.table.core.windows.net/") + .connectionString("TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sv=2020-02-10&ss=t&srt=o&sp=rwdlacu&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=someSignature") + .tableName("myTable") + .buildAsyncClient()); + } + + @Test + public void buildWithSameEndpointInConnectionStringWithTrailingSlashDoesNotThrow() { + assertDoesNotThrow(() -> new TableClientBuilder() + .endpoint("https://myaccount.table.core.windows.net") + .connectionString("TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sv=2020-02-10&ss=t&srt=o&sp=rwdlacu&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=someSignature") + .tableName("myTable") + .buildAsyncClient()); + } + + @Test + public void buildWithDifferentEndpointInConnectionStringThrows() { + assertThrows(IllegalStateException.class, () -> new TableClientBuilder() + .endpoint("https://myotheraccount.table.core.windows.net/") + .connectionString("TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sv=2020-02-10&ss=t&srt=o&sp=rwdlacu&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=someSignature") + .tableName("myTable") + .buildAsyncClient()); + } } diff --git a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableServiceAsyncClientTest.java b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableServiceAsyncClientTest.java index 4e95402734c2..b94b25f1f855 100644 --- a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableServiceAsyncClientTest.java +++ b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableServiceAsyncClientTest.java @@ -7,10 +7,18 @@ import com.azure.core.http.policy.ExponentialBackoff; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.test.TestBase; import com.azure.data.tables.models.ListTablesOptions; +import com.azure.data.tables.models.TableEntity; import com.azure.data.tables.models.TableServiceException; +import com.azure.data.tables.sas.TableAccountSasPermission; +import com.azure.data.tables.sas.TableAccountSasResourceType; +import com.azure.data.tables.sas.TableAccountSasService; +import com.azure.data.tables.sas.TableAccountSasSignatureValues; +import com.azure.data.tables.sas.TableSasIpRange; +import com.azure.data.tables.sas.TableSasProtocol; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; @@ -19,10 +27,13 @@ import reactor.test.StepVerifier; import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * Tests methods for {@link TableServiceAsyncClient}. @@ -30,6 +41,8 @@ public class TableServiceAsyncClientTest extends TestBase { private static final Duration TIMEOUT = Duration.ofSeconds(100); private TableServiceAsyncClient serviceClient; + private HttpPipelinePolicy recordPolicy; + private HttpClient playbackClient; @BeforeAll static void beforeAll() { @@ -49,12 +62,18 @@ protected void beforeTest() { .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)); if (interceptorManager.isPlaybackMode()) { - builder.httpClient(interceptorManager.getPlaybackClient()); + playbackClient = interceptorManager.getPlaybackClient(); + + builder.httpClient(playbackClient); } else { builder.httpClient(HttpClient.createDefault()); + if (!interceptorManager.isLiveMode()) { - builder.addPolicy(interceptorManager.getRecordPolicy()); + recordPolicy = interceptorManager.getRecordPolicy(); + + builder.addPolicy(recordPolicy); } + builder.addPolicy(new RetryPolicy(new ExponentialBackoff(6, Duration.ofMillis(1500), Duration.ofSeconds(100)))); } @@ -277,6 +296,123 @@ void serviceGetTableClientAsync() { TableAsyncClient tableClient = serviceClient.getTableClient(tableName); // Act & Assert - TablesAsyncClientTest.getEntityWithResponseAsyncImpl(tableClient, this.testResourceNamer); + TableAsyncClientTest.getEntityWithResponseAsyncImpl(tableClient, this.testResourceNamer); + } + + @Test + @Tag("SAS") + public void generateAccountSasTokenWithMinimumParameters() { + final OffsetDateTime expiryTime = OffsetDateTime.of(2021, 12, 12, 0, 0, 0, 0, ZoneOffset.UTC); + final TableAccountSasPermission permissions = TableAccountSasPermission.parse("r"); + final TableAccountSasService services = new TableAccountSasService().setTableAccess(true); + final TableAccountSasResourceType resourceTypes = new TableAccountSasResourceType().setObject(true); + final TableSasProtocol protocol = TableSasProtocol.HTTPS_ONLY; + + final TableAccountSasSignatureValues sasSignatureValues = + new TableAccountSasSignatureValues(expiryTime, permissions, services, resourceTypes) + .setProtocol(protocol) + .setVersion(TableServiceVersion.V2019_02_02.getVersion()); + + final String sas = serviceClient.generateAccountSas(sasSignatureValues); + + assertTrue( + sas.startsWith( + "sv=2019-02-02" + + "&ss=t" + + "&srt=o" + + "&se=2021-12-12T00%3A00%3A00Z" + + "&sp=r" + + "&spr=https" + + "&sig=" + ) + ); + } + + @Test + @Tag("SAS") + public void generateAccountSasTokenWithAllParameters() { + final OffsetDateTime expiryTime = OffsetDateTime.of(2021, 12, 12, 0, 0, 0, 0, ZoneOffset.UTC); + final TableAccountSasPermission permissions = TableAccountSasPermission.parse("rdau"); + final TableAccountSasService services = new TableAccountSasService().setTableAccess(true); + final TableAccountSasResourceType resourceTypes = new TableAccountSasResourceType().setObject(true); + final TableSasProtocol protocol = TableSasProtocol.HTTPS_HTTP; + + final OffsetDateTime startTime = OffsetDateTime.of(2015, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); + final TableSasIpRange ipRange = TableSasIpRange.parse("a-b"); + + final TableAccountSasSignatureValues sasSignatureValues = + new TableAccountSasSignatureValues(expiryTime, permissions, services, resourceTypes) + .setProtocol(protocol) + .setVersion(TableServiceVersion.V2019_02_02.getVersion()) + .setStartTime(startTime) + .setSasIpRange(ipRange); + + final String sas = serviceClient.generateAccountSas(sasSignatureValues); + + assertTrue( + sas.startsWith( + "sv=2019-02-02" + + "&ss=t" + + "&srt=o" + + "&st=2015-01-01T00%3A00%3A00Z" + + "&se=2021-12-12T00%3A00%3A00Z" + + "&sp=rdau" + + "&sip=a-b" + + "&spr=https%2Chttp" + + "&sig=" + ) + ); + } + + @Test + @Tag("SAS") + public void canUseSasTokenToCreateValidTableClient() { + final OffsetDateTime expiryTime = OffsetDateTime.of(2021, 12, 12, 0, 0, 0, 0, ZoneOffset.UTC); + final TableAccountSasPermission permissions = TableAccountSasPermission.parse("a"); + final TableAccountSasService services = new TableAccountSasService().setTableAccess(true); + final TableAccountSasResourceType resourceTypes = new TableAccountSasResourceType().setObject(true); + final TableSasProtocol protocol = TableSasProtocol.HTTPS_ONLY; + + final TableAccountSasSignatureValues sasSignatureValues = + new TableAccountSasSignatureValues(expiryTime, permissions, services, resourceTypes) + .setProtocol(protocol) + .setVersion(TableServiceVersion.V2019_02_02.getVersion()); + + final String sas = serviceClient.generateAccountSas(sasSignatureValues); + final String tableName = testResourceNamer.randomName("test", 20); + + serviceClient.createTable(tableName).block(TIMEOUT); + + final TableClientBuilder tableClientBuilder = new TableClientBuilder() + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) + .endpoint(serviceClient.getServiceEndpoint()) + .sasToken(sas) + .tableName(tableName); + + if (interceptorManager.isPlaybackMode()) { + tableClientBuilder.httpClient(playbackClient); + } else { + tableClientBuilder.httpClient(HttpClient.createDefault()); + + if (!interceptorManager.isLiveMode()) { + tableClientBuilder.addPolicy(recordPolicy); + } + + tableClientBuilder.addPolicy(new RetryPolicy(new ExponentialBackoff(6, Duration.ofMillis(1500), + Duration.ofSeconds(100)))); + } + + // Create a new client authenticated with the SAS token. + final TableAsyncClient tableAsyncClient = tableClientBuilder.buildAsyncClient(); + final String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); + final String rowKeyValue = testResourceNamer.randomName("rowKey", 20); + final TableEntity entity = new TableEntity(partitionKeyValue, rowKeyValue); + final int expectedStatusCode = 204; + + //Act & Assert + StepVerifier.create(tableAsyncClient.createEntityWithResponse(entity)) + .assertNext(response -> assertEquals(expectedStatusCode, response.getStatusCode())) + .expectComplete() + .verify(); } } diff --git a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableServiceClientBuilderTest.java b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableServiceClientBuilderTest.java index c41a9e9fbd85..8667309445a8 100644 --- a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableServiceClientBuilderTest.java +++ b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableServiceClientBuilderTest.java @@ -21,6 +21,7 @@ import java.security.SecureRandom; import java.util.Collections; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -183,4 +184,72 @@ public void addPerCallPolicy() { assertTrue(perCallPolicyPosition < retryPolicyPosition); assertTrue(retryPolicyPosition < perRetryPolicyPosition); } + + @Test + public void multipleFormsOfAuthenticationPresent() { + assertThrows(IllegalStateException.class, () -> new TableServiceClientBuilder() + .sasToken("sasToken") + .credential(new AzureNamedKeyCredential("name", "key")) + .endpoint("https://myaccount.table.core.windows.net") + .buildAsyncClient()); + + assertThrows(IllegalStateException.class, () -> new TableServiceClientBuilder() + .sasToken("sasToken") + .credential(new AzureSasCredential("sasToken")) + .endpoint("https://myaccount.table.core.windows.net") + .buildAsyncClient()); + + assertThrows(IllegalStateException.class, () -> new TableServiceClientBuilder() + .credential(new AzureNamedKeyCredential("name", "key")) + .credential(new AzureSasCredential("sasToken")) + .endpoint("https://myaccount.table.core.windows.net") + .buildAsyncClient()); + + assertThrows(IllegalStateException.class, () -> new TableServiceClientBuilder() + .sasToken("sasToken") + .credential(new AzureNamedKeyCredential("name", "key")) + .credential(new AzureSasCredential("sasToken")) + .endpoint("https://myaccount.table.core.windows.net") + .buildAsyncClient()); + } + + @Test + public void buildWithSameSasTokenInConnectionStringDoesNotThrow() { + assertDoesNotThrow(() -> new TableServiceClientBuilder() + .sasToken("sv=2020-02-10&ss=t&srt=o&sp=rwdlacu&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=someSignature") + .connectionString("TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sv=2020-02-10&ss=t&srt=o&sp=rwdlacu&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=someSignature") + .buildAsyncClient()); + } + + @Test + public void buildWithDifferentSasTokenInConnectionStringThrows() { + assertThrows(IllegalStateException.class, () -> new TableServiceClientBuilder() + .sasToken("sv=2020-02-10&ss=t&srt=o&sp=rwd&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=someSignature") + .connectionString("TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sv=2020-02-10&ss=t&srt=o&sp=rwdlacu&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=anotherSignature") + .buildAsyncClient()); + } + + @Test + public void buildWithSameEndpointInConnectionStringDoesNotThrow() { + assertDoesNotThrow(() -> new TableServiceClientBuilder() + .endpoint("https://myaccount.table.core.windows.net/") + .connectionString("TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sv=2020-02-10&ss=t&srt=o&sp=rwdlacu&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=someSignature") + .buildAsyncClient()); + } + + @Test + public void buildWithSameEndpointInConnectionStringWithTrailingSlashDoesNotThrow() { + assertDoesNotThrow(() -> new TableServiceClientBuilder() + .endpoint("https://myaccount.table.core.windows.net") + .connectionString("TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sv=2020-02-10&ss=t&srt=o&sp=rwdlacu&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=someSignature") + .buildAsyncClient()); + } + + @Test + public void buildWithDifferentEndpointInConnectionStringThrows() { + assertThrows(IllegalStateException.class, () -> new TableServiceClientBuilder() + .endpoint("https://myotheraccount.table.core.windows.net/") + .connectionString("TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sv=2020-02-10&ss=t&srt=o&sp=rwdlacu&se=2021-06-04T04:45:57Z&st=2021-06-03T20:45:57Z&spr=https&sig=someSignature") + .buildAsyncClient()); + } } diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.canUseSasTokenToCreateValidTableClient.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.canUseSasTokenToCreateValidTableClient.json new file mode 100644 index 000000000000..f4a1368377be --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.canUseSasTokenToCreateValidTableClient.json @@ -0,0 +1,55 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-data-tables/12.0.0-beta.8 (11.0.6; Windows 10; 10.0)", + "x-ms-client-request-id" : "e56a3194-48cd-45f2-ace7-b1dfe471f364", + "Content-Type" : "application/json;odata=nometadata" + }, + "Response" : { + "content-length" : "0", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 04 Jun 2021 20:21:58 GMT", + "Cache-Control" : "no-cache", + "DataServiceId" : "https://tablesstoragetests.table.core.windows.net/Tables('tablename40793703')", + "x-ms-request-id" : "01f46ed0-a002-0035-257f-597034000000", + "x-ms-client-request-id" : "e56a3194-48cd-45f2-ace7-b1dfe471f364", + "Preference-Applied" : "return-no-content", + "Location" : "https://tablesstoragetests.table.core.windows.net/Tables('tablename40793703')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/tablename40793703/tablename40793703?sv=2019-02-02&se=2021-12-12T00%3A00%3A00Z&tn=tablename40793703&sp=a&spr=https%2Chttp&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-data-tables/12.0.0-beta.8 (11.0.6; Windows 10; 10.0)", + "x-ms-client-request-id" : "587dac9f-2e50-47b0-9554-cc449d2b94ab", + "Content-Type" : "application/json;odata=nometadata" + }, + "Response" : { + "content-length" : "0", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 04 Jun 2021 20:21:58 GMT", + "Cache-Control" : "no-cache", + "DataServiceId" : "https://tablesstoragetests.table.core.windows.net/tablename40793703(PartitionKey='partitionkey915773',RowKey='rowkey25200da12')", + "eTag" : "W/datetime'2021-06-04T20%3A21%3A58.6283474Z'", + "x-ms-request-id" : "01f46efe-a002-0035-4f7f-597034000000", + "x-ms-client-request-id" : "587dac9f-2e50-47b0-9554-cc449d2b94ab", + "Preference-Applied" : "return-no-content", + "Location" : "https://tablesstoragetests.table.core.windows.net/tablename40793703(PartitionKey='partitionkey915773',RowKey='rowkey25200da12')" + }, + "Exception" : null + } ], + "variables" : [ "tablename40793703", "partitionkey915773", "rowkey25200da12" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.createEntityAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.createEntityAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.createEntityAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.createEntityAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.createEntitySubclassAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.createEntitySubclassAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.createEntitySubclassAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.createEntitySubclassAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.createEntityWithAllSupportedDataTypesAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.createEntityWithAllSupportedDataTypesAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.createEntityWithAllSupportedDataTypesAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.createEntityWithAllSupportedDataTypesAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.createEntityWithResponseAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.createEntityWithResponseAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.createEntityWithResponseAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.createEntityWithResponseAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.createTableAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.createTableAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.createTableAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.createTableAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.createTableWithResponseAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.createTableWithResponseAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.createTableWithResponseAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.createTableWithResponseAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteEntityAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteEntityAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteEntityAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteEntityAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteEntityWithResponseAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteEntityWithResponseAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteEntityWithResponseAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteEntityWithResponseAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteEntityWithResponseMatchETagAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteEntityWithResponseMatchETagAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteEntityWithResponseMatchETagAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteEntityWithResponseMatchETagAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteNonExistingEntityAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteNonExistingEntityAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteNonExistingEntityAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteNonExistingEntityAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteNonExistingEntityWithResponseAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteNonExistingEntityWithResponseAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteNonExistingEntityWithResponseAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteNonExistingEntityWithResponseAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteNonExistingTableAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteNonExistingTableAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteNonExistingTableAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteNonExistingTableAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteNonExistingTableWithResponseAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteNonExistingTableWithResponseAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteNonExistingTableWithResponseAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteNonExistingTableWithResponseAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteTableAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteTableAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteTableAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteTableAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteTableWithResponseAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteTableWithResponseAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.deleteTableWithResponseAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.deleteTableWithResponseAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.generateSasTokenWithAllParameters.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.generateSasTokenWithAllParameters.json new file mode 100644 index 000000000000..c84249d7bdd6 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.generateSasTokenWithAllParameters.json @@ -0,0 +1,29 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-data-tables/12.0.0-beta.8 (11.0.6; Windows 10; 10.0)", + "x-ms-client-request-id" : "93a2a3c9-4159-40a8-9247-748b1f0b66f4", + "Content-Type" : "application/json;odata=nometadata" + }, + "Response" : { + "content-length" : "0", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 04 Jun 2021 20:21:57 GMT", + "Cache-Control" : "no-cache", + "DataServiceId" : "https://tablesstoragetests.table.core.windows.net/Tables('tablename17721fc9')", + "x-ms-request-id" : "7b55d062-1002-0005-137f-592a1e000000", + "x-ms-client-request-id" : "93a2a3c9-4159-40a8-9247-748b1f0b66f4", + "Preference-Applied" : "return-no-content", + "Location" : "https://tablesstoragetests.table.core.windows.net/Tables('tablename17721fc9')" + }, + "Exception" : null + } ], + "variables" : [ "tablename17721fc9" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.generateSasTokenWithMinimumParameters.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.generateSasTokenWithMinimumParameters.json new file mode 100644 index 000000000000..85584ab2fdb1 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.generateSasTokenWithMinimumParameters.json @@ -0,0 +1,29 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-data-tables/12.0.0-beta.8 (11.0.6; Windows 10; 10.0)", + "x-ms-client-request-id" : "943ad224-303a-4763-8e83-a818550503c7", + "Content-Type" : "application/json;odata=nometadata" + }, + "Response" : { + "content-length" : "0", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 04 Jun 2021 20:21:56 GMT", + "Cache-Control" : "no-cache", + "DataServiceId" : "https://tablesstoragetests.table.core.windows.net/Tables('tablename69053ff7')", + "x-ms-request-id" : "1ab91518-c002-0025-707f-5946d2000000", + "x-ms-client-request-id" : "943ad224-303a-4763-8e83-a818550503c7", + "Preference-Applied" : "return-no-content", + "Location" : "https://tablesstoragetests.table.core.windows.net/Tables('tablename69053ff7')" + }, + "Exception" : null + } ], + "variables" : [ "tablename69053ff7" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.getEntityWithResponseAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.getEntityWithResponseAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.getEntityWithResponseAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.getEntityWithResponseAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.getEntityWithResponseSubclassAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.getEntityWithResponseSubclassAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.getEntityWithResponseSubclassAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.getEntityWithResponseSubclassAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.getEntityWithResponseWithSelectAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.getEntityWithResponseWithSelectAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.getEntityWithResponseWithSelectAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.getEntityWithResponseWithSelectAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.listEntitiesAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.listEntitiesAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.listEntitiesAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.listEntitiesAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.listEntitiesSubclassAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.listEntitiesSubclassAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.listEntitiesSubclassAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.listEntitiesSubclassAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.listEntitiesWithFilterAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.listEntitiesWithFilterAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.listEntitiesWithFilterAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.listEntitiesWithFilterAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.listEntitiesWithSelectAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.listEntitiesWithSelectAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.listEntitiesWithSelectAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.listEntitiesWithSelectAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.listEntitiesWithTopAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.listEntitiesWithTopAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.listEntitiesWithTopAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.listEntitiesWithTopAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.submitTransactionAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.submitTransactionAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.submitTransactionAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.submitTransactionAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.submitTransactionAsyncAllActions.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.submitTransactionAsyncAllActions.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.submitTransactionAsyncAllActions.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.submitTransactionAsyncAllActions.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.submitTransactionAsyncWithDifferentPartitionKeys.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.submitTransactionAsyncWithDifferentPartitionKeys.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.submitTransactionAsyncWithDifferentPartitionKeys.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.submitTransactionAsyncWithDifferentPartitionKeys.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.submitTransactionAsyncWithFailingAction.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.submitTransactionAsyncWithFailingAction.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.submitTransactionAsyncWithFailingAction.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.submitTransactionAsyncWithFailingAction.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.submitTransactionAsyncWithSameRowKeys.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.submitTransactionAsyncWithSameRowKeys.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.submitTransactionAsyncWithSameRowKeys.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.submitTransactionAsyncWithSameRowKeys.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.updateEntityWithResponseMergeAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.updateEntityWithResponseMergeAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.updateEntityWithResponseMergeAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.updateEntityWithResponseMergeAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.updateEntityWithResponseReplaceAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.updateEntityWithResponseReplaceAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.updateEntityWithResponseReplaceAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.updateEntityWithResponseReplaceAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.updateEntityWithResponseSubclassAsync.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.updateEntityWithResponseSubclassAsync.json similarity index 100% rename from sdk/tables/azure-data-tables/src/test/resources/session-records/TablesAsyncClientTest.updateEntityWithResponseSubclassAsync.json rename to sdk/tables/azure-data-tables/src/test/resources/session-records/TableAsyncClientTest.updateEntityWithResponseSubclassAsync.json diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TableServiceAsyncClientTest.canUseSasTokenToCreateValidTableClient.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableServiceAsyncClientTest.canUseSasTokenToCreateValidTableClient.json new file mode 100644 index 000000000000..7f30fd87b782 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableServiceAsyncClientTest.canUseSasTokenToCreateValidTableClient.json @@ -0,0 +1,55 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/Tables", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-data-tables/12.0.0-beta.8 (11.0.6; Windows 10; 10.0)", + "x-ms-client-request-id" : "ebc98fd2-eee5-4da3-a077-62459e7024b6", + "Content-Type" : "application/json;odata=nometadata" + }, + "Response" : { + "content-length" : "0", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 04 Jun 2021 20:20:48 GMT", + "Cache-Control" : "no-cache", + "DataServiceId" : "https://tablesstoragetests.table.core.windows.net/Tables('test859634c577')", + "x-ms-request-id" : "0ea574e2-e002-001b-4b7f-59f0f3000000", + "x-ms-client-request-id" : "ebc98fd2-eee5-4da3-a077-62459e7024b6", + "Preference-Applied" : "return-no-content", + "Location" : "https://tablesstoragetests.table.core.windows.net/Tables('test859634c577')" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.table.core.windows.net/test859634c577?sv=2019-02-02&ss=t&srt=o&se=2021-12-12T00%3A00%3A00Z&sp=a&spr=https&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-data-tables/12.0.0-beta.8 (11.0.6; Windows 10; 10.0)", + "x-ms-client-request-id" : "b2b12824-3264-46b5-a8ac-b546ea263bc6", + "Content-Type" : "application/json;odata=nometadata" + }, + "Response" : { + "content-length" : "0", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0", + "X-Content-Type-Options" : "nosniff", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Fri, 04 Jun 2021 20:20:49 GMT", + "Cache-Control" : "no-cache", + "DataServiceId" : "https://tablesstoragetests.table.core.windows.net/test859634c577(PartitionKey='partitionkey55134c',RowKey='rowkey71408f997')", + "eTag" : "W/datetime'2021-06-04T20%3A20%3A49.7021587Z'", + "x-ms-request-id" : "0ea5751a-e002-001b-017f-59f0f3000000", + "x-ms-client-request-id" : "b2b12824-3264-46b5-a8ac-b546ea263bc6", + "Preference-Applied" : "return-no-content", + "Location" : "https://tablesstoragetests.table.core.windows.net/test859634c577(PartitionKey='partitionkey55134c',RowKey='rowkey71408f997')" + }, + "Exception" : null + } ], + "variables" : [ "test859634c577", "partitionkey55134c", "rowkey71408f997" ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TableServiceAsyncClientTest.generateAccountSasTokenWithAllParameters.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableServiceAsyncClientTest.generateAccountSasTokenWithAllParameters.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableServiceAsyncClientTest.generateAccountSasTokenWithAllParameters.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/tables/azure-data-tables/src/test/resources/session-records/TableServiceAsyncClientTest.generateAccountSasTokenWithMinimumParameters.json b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableServiceAsyncClientTest.generateAccountSasTokenWithMinimumParameters.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/tables/azure-data-tables/src/test/resources/session-records/TableServiceAsyncClientTest.generateAccountSasTokenWithMinimumParameters.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file From 36da99d91c5a7ee4739204955f455aa0c1529d7f Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 4 Jun 2021 16:08:56 -0700 Subject: [PATCH 47/53] Fetch specific branch name only in git-branch-push script (#21998) Co-authored-by: Ben Broderick Phillips --- eng/common/scripts/git-branch-push.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eng/common/scripts/git-branch-push.ps1 b/eng/common/scripts/git-branch-push.ps1 index e99a8edbd59f..fb3875e7c330 100644 --- a/eng/common/scripts/git-branch-push.ps1 +++ b/eng/common/scripts/git-branch-push.ps1 @@ -37,7 +37,7 @@ param( [boolean] $AmendCommit = $false ) -# This is necessay because of the janky git command output writing to stderr. +# This is necessary because of the git command output writing to stderr. # Without explicitly setting the ErrorActionPreference to continue the script # would fail the first time git wrote command output. $ErrorActionPreference = "Continue" @@ -116,8 +116,9 @@ do $needsRetry = $true Write-Host "Git push failed with LASTEXITCODE=$($LASTEXITCODE) Need to fetch and rebase: attempt number=$($tryNumber)" - Write-Host "git fetch $RemoteName" - git fetch $RemoteName + Write-Host "git fetch $RemoteName $PRBranchName" + # Full fetch will fail when the repo is in a sparse-checkout state, and single branch fetch is faster anyway. + git fetch $RemoteName $PRBranchName if ($LASTEXITCODE -ne 0) { Write-Error "Unable to fetch remote LASTEXITCODE=$($LASTEXITCODE), see command output above." From 4ad676f1627cb5cabb03d6019357c1452ac8fd39 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 4 Jun 2021 16:26:16 -0700 Subject: [PATCH 48/53] Use generate matrix job name parameter as display name (#22089) Co-authored-by: Ben Broderick Phillips --- .../pipelines/templates/jobs/archetype-sdk-tests-generate.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml b/eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml index 431043ff1420..2bf2bd97cdb0 100644 --- a/eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml +++ b/eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml @@ -35,7 +35,7 @@ parameters: # When that occurs, provide a name other than the default value. - name: GenerateJobName type: string - default: 'generate_matrix' + default: 'generate_job_matrix' jobs: - job: ${{ parameters.GenerateJobName }} @@ -44,7 +44,6 @@ jobs: pool: name: ${{ parameters.Pool }} vmImage: ${{ parameters.OsVmImage }} - displayName: Generate Job Matrix ${{ if parameters.DependsOn }}: dependsOn: ${{ parameters.DependsOn }} steps: From 96e8d627470e7dd21df7bc4a1fe7c3a5ff48dbde Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Fri, 4 Jun 2021 17:36:42 -0700 Subject: [PATCH 49/53] Update proton-j and qpid-proton-j-extensions (#22081) --- eng/versioning/external_dependencies.txt | 4 ++-- sdk/core/azure-core-amqp/pom.xml | 9 ++++----- sdk/eventhubs/microsoft-azure-eventhubs/pom.xml | 4 ++-- sdk/servicebus/microsoft-azure-servicebus/pom.xml | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index e31e72b2a46e..66ab24f03efd 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -31,7 +31,7 @@ com.microsoft.azure:azure-keyvault-cryptography;1.2.2 com.microsoft.azure:azure-media;0.9.8 com.microsoft.azure:azure-servicebus;3.6.1 com.microsoft.azure:azure-servicebus-jms;0.0.7 -com.microsoft.azure:qpid-proton-j-extensions;1.2.3 +com.microsoft.azure:qpid-proton-j-extensions;1.2.4 com.microsoft.azure.sdk.iot:iot-service-client;1.28.0 com.microsoft.rest:client-runtime;1.7.4 com.microsoft.rest.v2:client-runtime;2.1.1 @@ -77,7 +77,7 @@ org.apache.httpcomponents:httpclient;4.5.13 org.apache.logging.log4j:log4j-api;2.14.1 org.apache.logging.log4j:log4j-core;2.14.1 org.apache.logging.log4j:log4j-slf4j-impl;2.14.1 -org.apache.qpid:proton-j;0.33.4 +org.apache.qpid:proton-j;0.33.8 org.apache.qpid:qpid-jms-client;0.53.0 org.apache.tinkerpop:gremlin-driver;3.2.4 org.asynchttpclient:async-http-client;2.12.1 diff --git a/sdk/core/azure-core-amqp/pom.xml b/sdk/core/azure-core-amqp/pom.xml index 132013a61b43..801b17b24fa2 100644 --- a/sdk/core/azure-core-amqp/pom.xml +++ b/sdk/core/azure-core-amqp/pom.xml @@ -63,12 +63,12 @@ com.microsoft.azure qpid-proton-j-extensions - 1.2.3 + 1.2.4 org.apache.qpid proton-j - 0.33.4 + 0.33.8 @@ -114,9 +114,8 @@ - com.microsoft.azure:qpid-proton-j-extensions:[1.2.3] - - org.apache.qpid:proton-j:[0.33.4] + com.microsoft.azure:qpid-proton-j-extensions:[1.2.4] + org.apache.qpid:proton-j:[0.33.8] diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/pom.xml b/sdk/eventhubs/microsoft-azure-eventhubs/pom.xml index c4c05a29629b..016a625a8fda 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/pom.xml +++ b/sdk/eventhubs/microsoft-azure-eventhubs/pom.xml @@ -36,12 +36,12 @@ org.apache.qpid proton-j - 0.33.4 + 0.33.8 com.microsoft.azure qpid-proton-j-extensions - 1.2.3 + 1.2.4 org.slf4j diff --git a/sdk/servicebus/microsoft-azure-servicebus/pom.xml b/sdk/servicebus/microsoft-azure-servicebus/pom.xml index 9bbca35e6ed8..7110c2b4a20e 100644 --- a/sdk/servicebus/microsoft-azure-servicebus/pom.xml +++ b/sdk/servicebus/microsoft-azure-servicebus/pom.xml @@ -58,12 +58,12 @@ org.apache.qpid proton-j - 0.33.4 + 0.33.8 com.microsoft.azure qpid-proton-j-extensions - 1.2.3 + 1.2.4 org.slf4j From 2b63d22a1eb47d7beef7b1edd2236e0ec5744f22 Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Fri, 4 Jun 2021 20:51:47 -0400 Subject: [PATCH 50/53] Use sparse checkout for Update Package Version release stage (#22002) --- eng/pipelines/templates/stages/archetype-java-release.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/templates/stages/archetype-java-release.yml b/eng/pipelines/templates/stages/archetype-java-release.yml index e40dee9b723f..b7bef63a1464 100644 --- a/eng/pipelines/templates/stages/archetype-java-release.yml +++ b/eng/pipelines/templates/stages/archetype-java-release.yml @@ -274,7 +274,13 @@ stages: runOnce: deploy: steps: - - checkout: self + - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml + parameters: + Paths: + - '${{ parameters.ServiceDirectory }}' + - '**/*.xml' + - '!sdk/**/test-recordings' + - '!sdk/**/session-records' - task: UsePythonVersion@0 displayName: 'Use Python 3.6' From c4cdfd1a570705ec28779729b106699ac9a2133e Mon Sep 17 00:00:00 2001 From: Connie Yau Date: Sun, 6 Jun 2021 23:28:14 -0700 Subject: [PATCH 51/53] Fix subscription bugs in ReactorSession and ReactorConnection (#22085) * Fix error where Mono for dispose of was not being subscribed to. * Fix error where close operations were not being subscribed to. * Fixing distinct to distinctUntilChanged * Update CHANGELOG with authorization type. --- sdk/core/azure-core-amqp/CHANGELOG.md | 6 ++++++ .../amqp/implementation/ReactorConnection.java | 16 ++++++++-------- .../core/amqp/implementation/ReactorSession.java | 12 ++++++------ .../implementation/ReactorConnectionTest.java | 4 ++-- .../implementation/ManagementChannel.java | 8 ++++---- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/sdk/core/azure-core-amqp/CHANGELOG.md b/sdk/core/azure-core-amqp/CHANGELOG.md index 95f3244eaa11..db88e271f4f7 100644 --- a/sdk/core/azure-core-amqp/CHANGELOG.md +++ b/sdk/core/azure-core-amqp/CHANGELOG.md @@ -2,6 +2,12 @@ ## 2.1.0-beta.1 (Unreleased) +### New Features +- Exposing CbsAuthorizationType. + +### Bug Fixes +- Fixed a bug where connection and sessions would not be disposed when their endpoint closed. + ## 2.0.6 (2021-05-24) ### Bug Fixes - Fixed a bug that caused amqp connection not to retry when network error happened. diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorConnection.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorConnection.java index 416286ace200..0c38ed2b5d3c 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorConnection.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorConnection.java @@ -120,7 +120,7 @@ public ReactorConnection(String connectionId, ConnectionOptions connectionOption if (isDisposed.getAndSet(true)) { logger.verbose("connectionId[{}] was already disposed. {}", connectionId, message); } else { - dispose(new AmqpShutdownSignal(false, false, message)); + closeAsync(new AmqpShutdownSignal(false, false, message)).subscribe(); } }); @@ -133,7 +133,7 @@ public ReactorConnection(String connectionId, ConnectionOptions connectionOption .onErrorResume(error -> { if (!isDisposed.getAndSet(true)) { logger.verbose("connectionId[{}]: Disposing of active sessions due to error.", connectionId); - return dispose(new AmqpShutdownSignal(false, false, + return closeAsync(new AmqpShutdownSignal(false, false, error.getMessage())).then(Mono.error(error)); } else { return Mono.error(error); @@ -144,7 +144,7 @@ public ReactorConnection(String connectionId, ConnectionOptions connectionOption logger.verbose("connectionId[{}]: Disposing of active sessions due to connection close.", connectionId); - dispose(new AmqpShutdownSignal(false, false, + closeAsync(new AmqpShutdownSignal(false, false, "Connection handler closed.")).subscribe(); } }) @@ -310,7 +310,7 @@ public void dispose() { // Because the reactor executor schedules the pending close after the timeout, we want to give sufficient time // for the rest of the tasks to run. final Duration timeout = operationTimeout.plus(operationTimeout); - dispose(new AmqpShutdownSignal(false, true, "Disposed by client.")) + closeAsync(new AmqpShutdownSignal(false, true, "Disposed by client.")) .publishOn(Schedulers.boundedElastic()) .block(timeout); } @@ -356,7 +356,7 @@ protected AmqpChannelProcessor createRequestResponseChan new ClientLogger(RequestResponseChannel.class + ":" + entityPath))); } - Mono dispose(AmqpShutdownSignal shutdownSignal) { + Mono closeAsync(AmqpShutdownSignal shutdownSignal) { logger.info("connectionId[{}] signal[{}]: Disposing of ReactorConnection.", connectionId, shutdownSignal); if (cbsChannelProcessor != null) { @@ -494,7 +494,7 @@ public void onConnectionError(Throwable exception) { if (!isDisposed.getAndSet(true)) { logger.verbose("onReactorError connectionId[{}], hostName[{}]: Disposing.", connectionId, getFullyQualifiedNamespace()); - dispose(new AmqpShutdownSignal(false, false, + closeAsync(new AmqpShutdownSignal(false, false, "onReactorError: " + exception.toString())) .subscribe(); } @@ -508,7 +508,7 @@ void onConnectionShutdown(AmqpShutdownSignal shutdownSignal) { if (!isDisposed.getAndSet(true)) { logger.verbose("onConnectionShutdown connectionId[{}], hostName[{}]: disposing."); - dispose(shutdownSignal).subscribe(); + closeAsync(shutdownSignal).subscribe(); } } } @@ -533,7 +533,7 @@ private void dispose() { } if (session instanceof ReactorSession) { - ((ReactorSession) session).dispose("Closing session.", null, true) + ((ReactorSession) session).closeAsync("Closing session.", null, true) .subscribe(); } else { session.dispose(); diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorSession.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorSession.java index 8ec8656e9eee..5d58e2bd7592 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorSession.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorSession.java @@ -128,7 +128,7 @@ public ReactorSession(AmqpConnection amqpConnection, Session session, SessionHan connectionSubscriptions = Disposables.composite( this.endpointStates.subscribe(), - shutdownSignals.flatMap(signal -> dispose("Shutdown signal received", null, false)).subscribe()); + shutdownSignals.flatMap(signal -> closeAsync("Shutdown signal received", null, false)).subscribe()); session.open(); } @@ -152,7 +152,7 @@ public boolean isDisposed() { */ @Override public void dispose() { - dispose("Dispose called.", null, true) + closeAsync("Dispose called.", null, true) .block(retryOptions.getTryTimeout()); } @@ -240,7 +240,7 @@ Mono isClosed() { return isClosedMono.asMono(); } - Mono dispose(String message, ErrorCondition errorCondition, boolean disposeLinks) { + Mono closeAsync(String message, ErrorCondition errorCondition, boolean disposeLinks) { if (isDisposed.getAndSet(true)) { return isClosedMono.asMono(); } @@ -596,7 +596,7 @@ private void handleClose() { "connectionId[{}] sessionName[{}] Disposing of active send and receive links due to session close.", sessionHandler.getConnectionId(), sessionName); - dispose("", null, true); + closeAsync("", null, true).subscribe(); } private void handleError(Throwable error) { @@ -610,12 +610,12 @@ private void handleError(Throwable error) { condition = new ErrorCondition(Symbol.getSymbol(errorCondition), exception.getMessage()); - dispose(exception.getMessage(), condition, true); + closeAsync(exception.getMessage(), condition, true).subscribe(); } else { condition = null; } - dispose(error.getMessage(), condition, true); + closeAsync(error.getMessage(), condition, true).subscribe(); } /** diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorConnectionTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorConnectionTest.java index 6f2083faeeec..e2016cca0998 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorConnectionTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/ReactorConnectionTest.java @@ -680,12 +680,12 @@ void disposeAsync() throws IOException { connection2.getReactorConnection().subscribe(); // Act and Assert - StepVerifier.create(connection2.dispose(signal)) + StepVerifier.create(connection2.closeAsync(signal)) .verifyComplete(); assertTrue(connection2.isDisposed()); - StepVerifier.create(connection2.dispose(signal)) + StepVerifier.create(connection2.closeAsync(signal)) .verifyComplete(); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java index e9a3e1853893..9fd59529d17e 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java @@ -95,7 +95,7 @@ public class ManagementChannel implements EventHubManagementNode { //@formatter:off this.subscription = responseChannelMono - .flatMapMany(e -> e.getEndpointStates().distinct()) + .flatMapMany(e -> e.getEndpointStates().distinctUntilChanged()) .subscribe(e -> { logger.info("Management endpoint state: {}", e); endpointStateSink.next(e); @@ -159,9 +159,9 @@ private Mono getProperties(Map properties, Class respo request.setApplicationProperties(applicationProperties); return channelMono.flatMap(channel -> channel.sendWithAck(request) - .map(message -> { + .handle((message, sink) -> { if (RequestResponseUtils.isSuccessful(message)) { - return messageSerializer.deserialize(message, responseType); + sink.next(messageSerializer.deserialize(message, responseType)); } final AmqpResponseCode statusCode = RequestResponseUtils.getStatusCode(message); @@ -169,7 +169,7 @@ private Mono getProperties(Map properties, Class respo final Throwable error = ExceptionUtil.amqpResponseCodeToException(statusCode.getValue(), statusDescription, channel.getErrorContext()); - throw logger.logExceptionAsWarning(Exceptions.propagate(error)); + sink.error(logger.logExceptionAsWarning(Exceptions.propagate(error))); })); }); } From 9c576ded1a92cc80abdbb02e84ef0820299afdd5 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Mon, 7 Jun 2021 14:37:27 +0800 Subject: [PATCH 52/53] mgmt, support parameters in policy (#22103) * mgmt, support parameters in policy * changelog * use immutable collection --- .../CHANGELOG.md | 3 +- .../implementation/PolicyAssignmentImpl.java | 51 +++++++++++++++ .../implementation/PolicyDefinitionImpl.java | 33 ++++++++++ .../resources/models/PolicyAssignment.java | 63 ++++++++++++++++++- .../resources/models/PolicyDefinition.java | 34 +++++++++- .../resources/PolicyTests.java | 42 ++++++++++++- .../azure-resourcemanager/CHANGELOG.md | 2 +- 7 files changed, 223 insertions(+), 5 deletions(-) diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/CHANGELOG.md b/sdk/resourcemanager/azure-resourcemanager-resources/CHANGELOG.md index 06376d832f06..45175ccc390c 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/CHANGELOG.md +++ b/sdk/resourcemanager/azure-resourcemanager-resources/CHANGELOG.md @@ -2,7 +2,8 @@ ## 2.6.0-beta.1 (Unreleased) -- Added Support for Challenge Based Authentication in `AuthenticationPolicy`. +- Added support for Challenge Based Authentication in `AuthenticationPolicy`. +- Added support for `parameters` in `PolicyDefinition` and `PolicyAssignment`. ## 2.5.0 (2021-05-28) - Updated `api-version` of resources to `2021-01-01` diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/implementation/PolicyAssignmentImpl.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/implementation/PolicyAssignmentImpl.java index 2dfb7afc2292..ccbbd6b12b27 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/implementation/PolicyAssignmentImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/implementation/PolicyAssignmentImpl.java @@ -3,7 +3,9 @@ package com.azure.resourcemanager.resources.implementation; +import com.azure.resourcemanager.resources.models.EnforcementMode; import com.azure.resourcemanager.resources.models.GenericResource; +import com.azure.resourcemanager.resources.models.ParameterValuesValue; import com.azure.resourcemanager.resources.models.PolicyAssignment; import com.azure.resourcemanager.resources.models.PolicyDefinition; import com.azure.resourcemanager.resources.models.ResourceGroup; @@ -12,6 +14,12 @@ import com.azure.resourcemanager.resources.fluent.PolicyAssignmentsClient; import reactor.core.publisher.Mono; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + /** * Implementation for {@link PolicyAssignment}. */ @@ -55,6 +63,25 @@ public String type() { return innerModel().type(); } + @Override + public List excludedScopes() { + return innerModel().notScopes() == null + ? Collections.emptyList() + : Collections.unmodifiableList(innerModel().notScopes()); + } + + @Override + public EnforcementMode enforcementMode() { + return innerModel().enforcementMode(); + } + + @Override + public Map parameters() { + return innerModel().parameters() == null + ? Collections.emptyMap() + : Collections.unmodifiableMap(innerModel().parameters()); + } + @Override public PolicyAssignmentImpl withDisplayName(String displayName) { innerModel().withDisplayName(displayName); @@ -105,4 +132,28 @@ public boolean isInCreateMode() { protected Mono getInnerAsync() { return innerCollection.getAsync(innerModel().scope(), name()); } + + @Override + public PolicyAssignmentImpl withExcludedScope(String scope) { + if (innerModel().notScopes() == null) { + innerModel().withNotScopes(new ArrayList<>()); + } + innerModel().notScopes().add(scope); + return this; + } + + @Override + public PolicyAssignmentImpl withParameter(String name, Object value) { + if (innerModel().parameters() == null) { + innerModel().withParameters(new TreeMap<>()); + } + innerModel().parameters().put(name, new ParameterValuesValue().withValue(value)); + return this; + } + + @Override + public PolicyAssignmentImpl withEnforcementMode(EnforcementMode mode) { + innerModel().withEnforcementMode(mode); + return this; + } } diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/implementation/PolicyDefinitionImpl.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/implementation/PolicyDefinitionImpl.java index 02caab9376c8..18921dd774e7 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/implementation/PolicyDefinitionImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/implementation/PolicyDefinitionImpl.java @@ -4,6 +4,8 @@ package com.azure.resourcemanager.resources.implementation; import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resources.models.ParameterDefinitionsValue; +import com.azure.resourcemanager.resources.models.ParameterType; import com.azure.resourcemanager.resources.models.PolicyDefinition; import com.azure.resourcemanager.resources.models.PolicyType; import com.azure.resourcemanager.resources.fluent.models.PolicyDefinitionInner; @@ -13,6 +15,9 @@ import reactor.core.publisher.Mono; import java.io.IOException; +import java.util.Collections; +import java.util.Map; +import java.util.TreeMap; /** * Implementation for {@link PolicyDefinition}. @@ -51,6 +56,13 @@ public Object policyRule() { return innerModel().policyRule(); } + @Override + public Map parameters() { + return innerModel().parameters() == null + ? Collections.emptyMap() + : Collections.unmodifiableMap(innerModel().parameters()); + } + @Override public String id() { return innerModel().id(); @@ -105,4 +117,25 @@ public Mono createResourceAsync() { public boolean isInCreateMode() { return id() == null; } + + @Override + public PolicyDefinitionImpl withParameter(String name, ParameterDefinitionsValue definition) { + if (innerModel().parameters() == null) { + innerModel().withParameters(new TreeMap<>()); + } + innerModel().parameters().put(name, definition); + return this; + } + + @Override + public PolicyDefinitionImpl withParameter(String name, ParameterType parameterType, Object defaultValue) { + if (innerModel().parameters() == null) { + innerModel().withParameters(new TreeMap<>()); + } + innerModel().parameters().put(name, + new ParameterDefinitionsValue() + .withType(parameterType) + .withDefaultValue(defaultValue)); + return this; + } } diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/models/PolicyAssignment.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/models/PolicyAssignment.java index b3cfcb794fda..e9bf7e146149 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/models/PolicyAssignment.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/models/PolicyAssignment.java @@ -12,6 +12,9 @@ import com.azure.resourcemanager.resources.fluentcore.model.Refreshable; import com.azure.resourcemanager.resources.fluent.models.PolicyAssignmentInner; +import java.util.List; +import java.util.Map; + /** * An immutable client-side representation of an Azure policy assignment. */ @@ -43,6 +46,21 @@ public interface PolicyAssignment extends */ String type(); + /** + * @return the excluded scopes of the policy assignment + */ + List excludedScopes(); + + /** + * @return the enforcement mode of the policy assignment + */ + EnforcementMode enforcementMode(); + + /** + * @return the parameters of the policy assignment + */ + Map parameters(); + /** * Container interface for all the definitions that need to be implemented. */ @@ -125,6 +143,46 @@ interface WithDisplayName { WithCreate withDisplayName(String displayName); } + /** + * A policy assignment allowing the excluded scopes to be set. + */ + interface WithExcludedScopes { + /** + * Specifies the excluded scope of the policy assignment. + * + * @param scope the scope to be excluded from the policy assignment + * @return the next stage of policy assignment + */ + WithCreate withExcludedScope(String scope); + } + + /** + * A policy assignment allowing the parameters to be set. + */ + interface WithParameters { + /** + * Specifies the parameter of the policy assignment. + * + * @param name the name of the parameter + * @param value the value of the parameter + * @return the next stage of policy assignment + */ + WithCreate withParameter(String name, Object value); + } + + /** + * A policy assignment allowing the enforcement mode to be set. + */ + interface WithEnforcementMode { + /** + * Specifies the enforcement mode of the policy assignment. + * + * @param mode the enforcement mode of the policy assignment + * @return the next stage of policy assignment + */ + WithCreate withEnforcementMode(EnforcementMode mode); + } + /** * A policy assignment with sufficient inputs to create a new policy * assignment in the cloud, but exposing additional optional inputs to @@ -132,7 +190,10 @@ interface WithDisplayName { */ interface WithCreate extends Creatable, - DefinitionStages.WithDisplayName { + DefinitionStages.WithDisplayName, + DefinitionStages.WithExcludedScopes, + DefinitionStages.WithParameters, + DefinitionStages.WithEnforcementMode { } } } diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/models/PolicyDefinition.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/models/PolicyDefinition.java index cf5b016ceca4..b7ab9c2c2d60 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/models/PolicyDefinition.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/models/PolicyDefinition.java @@ -14,6 +14,8 @@ import com.azure.resourcemanager.resources.fluentcore.model.Updatable; import com.azure.resourcemanager.resources.fluentcore.model.HasInnerModel; +import java.util.Map; + /** * An immutable client-side representation of an Azure policy. */ @@ -46,6 +48,11 @@ public interface PolicyDefinition extends */ Object policyRule(); + /** + * @return the parameters of the policy definition + */ + Map parameters(); + /** * Container interface for all the definitions that need to be implemented. */ @@ -124,6 +131,30 @@ interface WithDescription { WithCreate withDescription(String description); } + /** + * A policy definition allowing parameters to be set. + */ + interface WithParameters { + /** + * Specifies the parameters of the policy. + * + * @param name the name of the parameter + * @param definition the definition of the parameter + * @return the next stage of policy definition + */ + WithCreate withParameter(String name, ParameterDefinitionsValue definition); + + /** + * Specifies the parameters of the policy. + * + * @param name the name of the parameter + * @param parameterType the type of the parameter + * @param defaultValue the default value of the parameter + * @return the next stage of policy definition + */ + WithCreate withParameter(String name, ParameterType parameterType, Object defaultValue); + } + /** * A policy definition with sufficient inputs to create a new * policy in the cloud, but exposing additional optional inputs to @@ -133,7 +164,8 @@ interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithDisplayName, - DefinitionStages.WithPolicyType { + DefinitionStages.WithPolicyType, + DefinitionStages.WithParameters { } } diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/PolicyTests.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/PolicyTests.java index 0a8104a199a1..b678b5288088 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/PolicyTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/test/java/com/azure/resourcemanager/resources/PolicyTests.java @@ -5,6 +5,9 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.test.annotation.DoNotRecord; +import com.azure.resourcemanager.resources.models.EnforcementMode; +import com.azure.resourcemanager.resources.models.ParameterDefinitionsValue; +import com.azure.resourcemanager.resources.models.ParameterType; import com.azure.resourcemanager.test.utils.TestUtilities; import com.azure.resourcemanager.resources.models.GenericResource; import com.azure.resourcemanager.resources.models.PolicyAssignment; @@ -16,8 +19,11 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import java.util.Collections; + public class PolicyTests extends ResourceManagementTest { private String policyRule = "{\"if\":{\"not\":{\"field\":\"location\",\"in\":[\"southcentralus\",\"westeurope\"]}},\"then\":{\"effect\":\"deny\"}}"; + private String policyRule2 = "{\"if\":{\"not\":{\"field\":\"name\",\"like\":\"[concat(parameters('prefix'),'*',parameters('suffix'))]\"}},\"then\":{\"effect\":\"deny\"}}"; @Override protected void cleanUpResources() { @@ -64,10 +70,12 @@ public void canCRUDPolicyDefinition() throws Exception { @DoNotRecord(skipInPlayback = true) public void canCRUDPolicyAssignment() throws Exception { String policyName = generateRandomResourceName("policy", 15); + String policyName2 = generateRandomResourceName("policy2", 15); String displayName = generateRandomResourceName("mypolicy", 15); String rgName = generateRandomResourceName("javarg", 15); String assignmentName1 = generateRandomResourceName("assignment1", 15); String assignmentName2 = generateRandomResourceName("assignment2", 15); + String assignmentName3 = generateRandomResourceName("assignment3", 15); String resourceName = generateRandomResourceName("webassignment", 15); try { // Create definition @@ -90,13 +98,18 @@ public void canCRUDPolicyAssignment() throws Exception { Assertions.assertNotNull(assignment1); Assertions.assertEquals("My Assignment", assignment1.displayName()); + Assertions.assertEquals(group.id(), assignment1.scope()); + Assertions.assertEquals(0, assignment1.excludedScopes().size()); + Assertions.assertEquals(EnforcementMode.DEFAULT, assignment1.enforcementMode()); + Assertions.assertEquals(0, assignment1.parameters().size()); + GenericResource resource = resourceClient.genericResources().define(resourceName) .withRegion(Region.US_SOUTH_CENTRAL) .withExistingResourceGroup(group) .withResourceType("sites") .withProviderNamespace("Microsoft.Web") .withoutPlan() - .withApiVersion("2015-08-01") + .withApiVersion("2020-12-01") .withParentResourcePath("") .withProperties(new ObjectMapper().readTree("{\"SiteMode\":\"Limited\",\"ComputeMode\":\"Shared\"}")) .create(); @@ -125,10 +138,37 @@ public void canCRUDPolicyAssignment() throws Exception { Assertions.assertTrue(foundAssignment1); Assertions.assertTrue(foundAssignment2); + // definition and assignment with parameters + PolicyDefinition definition2 = resourceClient.policyDefinitions().define(policyName) + .withPolicyRuleJson(policyRule2) + .withPolicyType(PolicyType.CUSTOM) + .withParameter("prefix", ParameterType.STRING, "dept") + .withParameter("suffix", new ParameterDefinitionsValue().withType(ParameterType.STRING).withDefaultValue("-US")) + .withDisplayName(displayName) + .withDescription("Test policy") + .create(); + PolicyAssignment assignment3 = resourceClient.policyAssignments().define(assignmentName3) + .forResourceGroup(group) + .withPolicyDefinition(definition2) + .withExcludedScope(resource.id()) + .withEnforcementMode(EnforcementMode.DO_NOT_ENFORCE) + .withParameter("prefix", "DeptA") + .withParameter("suffix", "-LC") + .withDisplayName("Test Assignment") + .create(); + + assignment3 = resourceClient.policyAssignments().getById(assignment3.id()); + Assertions.assertEquals(group.id(), assignment3.scope()); + Assertions.assertEquals(Collections.singletonList(resource.id()), assignment3.excludedScopes()); + Assertions.assertEquals(EnforcementMode.DO_NOT_ENFORCE, assignment3.enforcementMode()); + Assertions.assertEquals(2, assignment3.parameters().size()); + // Delete resourceClient.policyAssignments().deleteById(assignment1.id()); resourceClient.policyAssignments().deleteById(assignment2.id()); + resourceClient.policyAssignments().deleteById(assignment3.id()); resourceClient.policyDefinitions().deleteByName(policyName); + resourceClient.policyDefinitions().deleteByName(policyName2); } finally { resourceClient.resourceGroups().deleteByName(rgName); } diff --git a/sdk/resourcemanager/azure-resourcemanager/CHANGELOG.md b/sdk/resourcemanager/azure-resourcemanager/CHANGELOG.md index f6bdb2f6b0a1..064483247059 100644 --- a/sdk/resourcemanager/azure-resourcemanager/CHANGELOG.md +++ b/sdk/resourcemanager/azure-resourcemanager/CHANGELOG.md @@ -2,7 +2,7 @@ ## 2.6.0-beta.1 (Unreleased) -- Added Support for Challenge Based Authentication in `AuthenticationPolicy`. +- Added support for Challenge Based Authentication in `AuthenticationPolicy`. ## 2.5.0 (2021-05-28) - Updated core dependency from resources From ef0f6074602fc20079ef50320ecddfb84a9b36ee Mon Sep 17 00:00:00 2001 From: Fabian Meiswinkel Date: Mon, 7 Jun 2021 10:24:20 +0000 Subject: [PATCH 53/53] Fixing max length of userAgent header (#22018) * Fixing max length of userAgent header * Addressed CR feedback * Restricting the total UserAgent length to 255 characters * Fixing unit test regression --- .../azure-cosmos-spark_3-1_2-12/pom.xml | 1 + .../resources/azure-cosmos-spark.properties | 2 ++ .../azure/cosmos/spark/CosmosConstants.scala | 9 ++++++--- .../cosmos/spark/CosmosConstantsSpec.scala | 20 +++++++++++++++++++ .../implementation/UserAgentContainer.java | 8 +++++--- .../UserAgentContainerTest.java | 6 ++++-- 6 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/main/resources/azure-cosmos-spark.properties create mode 100644 sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/test/scala/com/azure/cosmos/spark/CosmosConstantsSpec.scala diff --git a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/pom.xml b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/pom.xml index f8585231555f..70de649c20ab 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/pom.xml +++ b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/pom.xml @@ -165,6 +165,7 @@ META-INF/project.properties META-INF/services/org.apache.spark.sql.sources.DataSourceRegister + azure-cosmos-spark.properties diff --git a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/main/resources/azure-cosmos-spark.properties b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/main/resources/azure-cosmos-spark.properties new file mode 100644 index 000000000000..30846653315a --- /dev/null +++ b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/main/resources/azure-cosmos-spark.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} \ No newline at end of file diff --git a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/main/scala/com/azure/cosmos/spark/CosmosConstants.scala b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/main/scala/com/azure/cosmos/spark/CosmosConstants.scala index 72925ba6e7b3..13133254a242 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/main/scala/com/azure/cosmos/spark/CosmosConstants.scala +++ b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/main/scala/com/azure/cosmos/spark/CosmosConstants.scala @@ -8,9 +8,12 @@ import com.azure.cosmos.implementation.HttpConstants // cosmos db related constants private object CosmosConstants { - private[this] val currentVersion = - CoreUtils.getProperties(HttpConstants.Versions.AZURE_COSMOS_PROPERTIES_FILE_NAME).get("version") - val userAgentSuffix = s" SparkConnector/$currentVersion" + private[this] val propertiesFileName = "azure-cosmos-spark.properties" + val currentVersion: String = + CoreUtils.getProperties(propertiesFileName).get("version") + val currentName: String = + CoreUtils.getProperties(propertiesFileName).get("name") + val userAgentSuffix = s"SparkConnector/$currentName/$currentVersion" object Names { val ItemsDataSourceShortName = "cosmos.oltp" diff --git a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/test/scala/com/azure/cosmos/spark/CosmosConstantsSpec.scala b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/test/scala/com/azure/cosmos/spark/CosmosConstantsSpec.scala new file mode 100644 index 000000000000..38bd042fe06e --- /dev/null +++ b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/src/test/scala/com/azure/cosmos/spark/CosmosConstantsSpec.scala @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.cosmos.spark + +class CosmosConstantsSpec extends UnitSpec { + "CurrentVersion" should "not be null" in { + CosmosConstants.currentVersion == null shouldBe false + CosmosConstants.currentVersion.startsWith("4.") shouldBe true + } + + "CurrentName" should "not be null" in { + CosmosConstants.currentName == null shouldBe false + CosmosConstants.currentName.startsWith("azure-cosmos-spark") shouldBe true + } + + "UserAgentSuffix" should "combine name and version" in { + CosmosConstants.userAgentSuffix shouldBe + s"SparkConnector/${CosmosConstants.currentName}/${CosmosConstants.currentVersion}" + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/UserAgentContainer.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/UserAgentContainer.java index 72d0d1b44f41..2d5ccf1c9f7f 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/UserAgentContainer.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/UserAgentContainer.java @@ -8,7 +8,8 @@ */ public class UserAgentContainer { - private static final int MAX_SUFFIX_LENGTH = 64; + private static final int MAX_USER_AGENT_LENGTH = 255; + private final int maxSuffixLength; private final String baseUserAgent; private String suffix; private String userAgent; @@ -18,6 +19,7 @@ private UserAgentContainer(String sdkName, String sdkVersion) { this.baseUserAgent = Utils.getUserAgent(sdkName, sdkVersion); this.suffix = ""; this.userAgent = baseUserAgent; + this.maxSuffixLength = MAX_USER_AGENT_LENGTH - 1 - baseUserAgent.length(); } public UserAgentContainer() { @@ -29,8 +31,8 @@ public String getSuffix() { } public void setSuffix(String suffix) { - if (suffix.length() > MAX_SUFFIX_LENGTH) { - suffix = suffix.substring(0, MAX_SUFFIX_LENGTH); + if (suffix.length() > maxSuffixLength) { + suffix = suffix.substring(0, maxSuffixLength); } this.suffix = suffix; diff --git a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/implementation/UserAgentContainerTest.java b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/implementation/UserAgentContainerTest.java index 0df64c618889..f4a84dd5a381 100644 --- a/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/implementation/UserAgentContainerTest.java +++ b/sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/implementation/UserAgentContainerTest.java @@ -31,10 +31,12 @@ public void userAgentContainerSetSuffix() { assertThat(userAgentContainer.getUserAgent()).isEqualTo(expectedString); //With suffix greater than 64 character - userProvidedSuffix = "greater than 64 characters ###########################################"; + userProvidedSuffix = "greater than 255 characters in total ################################################" + + "##########################################################################################################" + + "##########################################################################################################"; userAgentContainer = new UserAgentContainer(); userAgentContainer.setSuffix(userProvidedSuffix); - expectedString = expectedStringFixedPart + SPACE + userProvidedSuffix.substring(0, 64); + expectedString = (expectedStringFixedPart + SPACE + userProvidedSuffix).substring(0, 255); assertThat(userAgentContainer.getUserAgent()).isEqualTo(expectedString); }

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 @@ -48,13 +46,11 @@ * would need to provide implementation for this policy as well. * For more information please see Azure Container Registry Authentication .