diff --git a/sdk/storage/azure-storage-queue/customization/pom.xml b/sdk/storage/azure-storage-queue/customization/pom.xml new file mode 100644 index 000000000000..2a4b2b8b06e7 --- /dev/null +++ b/sdk/storage/azure-storage-queue/customization/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + + com.azure + azure-code-customization-parent + 1.0.0-beta.1 + ../../../parents/azure-code-customization-parent + + + Microsoft Azure Queue Storage client customization for Java + This package contains client customization for Microsoft Azure Queue Storage + + com.azure.tools + azure-storage-queue-customization + 1.0.0-beta.1 + jar + diff --git a/sdk/storage/azure-storage-queue/customization/src/main/java/QueueStorageCustomizations.java b/sdk/storage/azure-storage-queue/customization/src/main/java/QueueStorageCustomizations.java new file mode 100644 index 000000000000..48ca783e58e7 --- /dev/null +++ b/sdk/storage/azure-storage-queue/customization/src/main/java/QueueStorageCustomizations.java @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import com.azure.autorest.customization.Customization; +import com.azure.autorest.customization.Editor; +import com.azure.autorest.customization.LibraryCustomization; +import com.azure.autorest.customization.PackageCustomization; +import com.github.javaparser.ParseProblemException; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.Modifier; +import com.github.javaparser.ast.Node; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.ConstructorDeclaration; +import com.github.javaparser.ast.body.FieldDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.body.VariableDeclarator; +import com.github.javaparser.ast.expr.NormalAnnotationExpr; +import com.github.javaparser.ast.expr.ObjectCreationExpr; +import com.github.javaparser.ast.expr.SingleMemberAnnotationExpr; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.CatchClause; +import com.github.javaparser.ast.stmt.ReturnStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.stmt.TryStmt; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.ast.type.Type; +import org.slf4j.Logger; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** + * TypeSpec customization for azure-storage-queue. + */ +public class QueueStorageCustomizations extends Customization { + + private static final String ROOT_FILE_PATH = "src/main/java/com/azure/storage/queue/"; + + private static final String[] FILES_TO_REMOVE = new String[] { + "QueueClient.java", + "QueueAsyncClient.java", + "ServiceClient.java", + "ServiceAsyncClient.java", + "MessagesClient.java", + "MessagesAsyncClient.java", + "MessageIdsClient.java", + "MessageIdsAsyncClient.java", + "AzureQueueStorageBuilder.java", + "QueuesServiceVersion.java" + }; + + private static final List FLUENT_MODELS = Arrays.asList( + "QueueRetentionPolicy", "QueueMetrics", "QueueCorsRule", "QueueAnalyticsLogging", "QueueSignedIdentifier", + "GeoReplication", "QueueItem", "QueueServiceStatistics", "SendMessageResult", "UserDelegationKey"); + + @Override + public void customize(LibraryCustomization customization, Logger logger) { + Editor editor = customization.getRawEditor(); + removeGeneratedPublicClients(editor, logger); + preserveHandwrittenModuleInfo(editor, logger); + retargetServiceVersionReferences(editor, logger); + restoreAccessPolicyDateTimeType(editor, logger); + restoreFluentModels(customization, logger); + exposeRawListQueuesResponse(customization.getPackage("com.azure.storage.queue.implementation"), logger); + updateImplToMapInternalException(customization.getPackage("com.azure.storage.queue.implementation"), logger); + } + + private static void restoreAccessPolicyDateTimeType(Editor editor, Logger logger) { + String path = "src/main/java/com/azure/storage/queue/models/QueueAccessPolicy.java"; + String content = editor.getContents().get(path); + if (content == null) { + logger.info("QueueAccessPolicy.java not present; skipping date-time type restoration."); + return; + } + if (content.contains("private OffsetDateTime startsOn;")) { + logger.info("QueueAccessPolicy already uses OffsetDateTime; skipping."); + return; + } + String updated = content + .replace("import com.azure.core.annotation.Generated;", + "import com.azure.core.annotation.Generated;\n" + + "import com.azure.core.util.CoreUtils;\n" + + "import java.time.OffsetDateTime;\n" + + "import java.time.format.DateTimeFormatter;") + .replace("private String startsOn;", "private OffsetDateTime startsOn;") + .replace("private String expiresOn;", "private OffsetDateTime expiresOn;") + .replace("public String getStartsOn() {", "public OffsetDateTime getStartsOn() {") + .replace("public String getExpiresOn() {", "public OffsetDateTime getExpiresOn() {") + .replace("public QueueAccessPolicy setStartsOn(String startsOn) {", + "public QueueAccessPolicy setStartsOn(OffsetDateTime startsOn) {") + .replace("public QueueAccessPolicy setExpiresOn(String expiresOn) {", + "public QueueAccessPolicy setExpiresOn(OffsetDateTime expiresOn) {") + .replace("xmlWriter.writeStringElement(\"Start\", this.startsOn);", + "xmlWriter.writeStringElement(\"Start\",\n" + + " this.startsOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startsOn));") + .replace("xmlWriter.writeStringElement(\"Expiry\", this.expiresOn);", + "xmlWriter.writeStringElement(\"Expiry\",\n" + + " this.expiresOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expiresOn));") + .replace("deserializedQueueAccessPolicy.startsOn = reader.getStringElement();", + "deserializedQueueAccessPolicy.startsOn = reader.getNullableElement(dateString -> CoreUtils.parseBestOffsetDateTime(dateString));") + .replace("deserializedQueueAccessPolicy.expiresOn = reader.getStringElement();", + "deserializedQueueAccessPolicy.expiresOn = reader.getNullableElement(dateString -> CoreUtils.parseBestOffsetDateTime(dateString));"); + editor.replaceFile(path, updated); + logger.info("Restored OffsetDateTime type for QueueAccessPolicy startsOn/expiresOn."); + } + + private static void restoreFluentModels(LibraryCustomization customization, Logger logger) { + PackageCustomization models = customization.getPackage("com.azure.storage.queue.models"); + for (String className : FLUENT_MODELS) { + if (models.getClass(className) == null) { + logger.info("Model {} not present; skipping fluent restoration.", className); + continue; + } + models.getClass(className).customizeAst(ast -> { + ast.addImport("com.azure.core.annotation.Fluent"); + ast.getImports().removeIf(i -> i.getNameAsString().equals("com.azure.core.annotation.Immutable")); + ast.getClassByName(className).ifPresent(clazz -> makeModelFluent(clazz, logger)); + }); + logger.info("Restored @Fluent shape for {}.", className); + } + } + + private static void makeModelFluent(ClassOrInterfaceDeclaration clazz, Logger logger) { + String className = clazz.getNameAsString(); + + clazz.getAnnotationByName("Immutable").ifPresent(a -> a.remove()); + if (!clazz.isAnnotationPresent("Fluent")) { + clazz.addMarkerAnnotation("Fluent"); + } + + clazz.getFields().forEach(field -> { + if (!field.isStatic()) { + field.setFinal(false); + } + }); + + new ArrayList<>(clazz.getConstructors()).forEach(ConstructorDeclaration::remove); + ConstructorDeclaration ctor = clazz.addConstructor(Modifier.Keyword.PUBLIC); + ctor.addMarkerAnnotation("Generated"); + ctor.setBody(new BlockStmt()); + + for (FieldDeclaration field : clazz.getFields()) { + if (field.isStatic()) { + continue; + } + String fieldName = field.getVariable(0).getNameAsString(); + String setterName = "set" + capitalize(fieldName); + if (!clazz.getMethodsByName(setterName).isEmpty()) { + continue; + } + String fieldType = field.getElementType().asString(); + Type accessorType = accessorReturnType(clazz, fieldName).orElse(field.getElementType()).clone(); + String body; + if ("DateTimeRfc1123".equals(fieldType) && "OffsetDateTime".equals(accessorType.asString())) { + body = "{ if (" + fieldName + " == null) { this." + fieldName + " = null; } else { this." + + fieldName + " = new DateTimeRfc1123(" + fieldName + "); } return this; }"; + } else { + body = "{ this." + fieldName + " = " + fieldName + "; return this; }"; + } + MethodDeclaration setter = clazz.addMethod(setterName, Modifier.Keyword.PUBLIC); + setter.addMarkerAnnotation("Generated"); + setter.setType(className); + setter.addParameter(new Parameter(accessorType, fieldName)); + setter.setBody(StaticJavaParser.parseBlock(body)); + } + + clazz.findAll(ObjectCreationExpr.class).stream() + .filter(oce -> oce.getType().getNameAsString().equals(className) && !oce.getArguments().isEmpty()) + .forEach(oce -> rewriteFromXmlConstruction(clazz, oce)); + } + + private static void rewriteFromXmlConstruction(ClassOrInterfaceDeclaration clazz, ObjectCreationExpr oce) { + String className = clazz.getNameAsString(); + List argNames = new ArrayList<>(); + oce.getArguments().forEach(arg -> argNames.add(arg.toString())); + oce.setArguments(new NodeList<>()); // new X() + + Optional asInitializer = oce.getParentNode() + .filter(p -> p instanceof VariableDeclarator).map(p -> (VariableDeclarator) p); + if (asInitializer.isPresent()) { + // Shape: `X deserializedX = new X(args); ` + String localName = asInitializer.get().getNameAsString(); + Statement declStmt = findAncestor(oce, Statement.class).orElseThrow( + () -> new IllegalStateException("No enclosing statement for " + className + " construction.")); + BlockStmt block = (BlockStmt) declStmt.getParentNode().orElseThrow( + () -> new IllegalStateException("No enclosing block for " + className + " construction.")); + int idx = block.getStatements().indexOf(declStmt); + int offset = 1; + for (String argName : argNames) { + block.addStatement(idx + offset, StaticJavaParser.parseStatement( + fieldAssignment(clazz, localName, argName))); + offset++; + } + } else { + // Shape: `return new X(args);` -> introduce a local, assign, and return it. + ReturnStmt ret = findAncestor(oce, ReturnStmt.class).orElseThrow( + () -> new IllegalStateException("Unexpected " + className + " construction context.")); + String localName = "deserialized" + className; + BlockStmt rebuilt = new BlockStmt(); + rebuilt.addStatement(StaticJavaParser.parseStatement(className + " " + localName + " = new " + className + "();")); + for (String argName : argNames) { + rebuilt.addStatement(StaticJavaParser.parseStatement(fieldAssignment(clazz, localName, argName))); + } + rebuilt.addStatement(new ReturnStmt(StaticJavaParser.parseExpression(localName))); + ret.replace(rebuilt); + } + } + + private static String fieldAssignment(ClassOrInterfaceDeclaration clazz, String localName, String fieldName) { + boolean rfc1123 = clazz.getFieldByName(fieldName) + .map(f -> "DateTimeRfc1123".equals(f.getElementType().asString())).orElse(false); + if (rfc1123) { + return localName + "." + fieldName + " = " + fieldName + " == null ? null : new DateTimeRfc1123(" + + fieldName + ");"; + } + return localName + "." + fieldName + " = " + fieldName + ";"; + } + + private static Optional accessorReturnType(ClassOrInterfaceDeclaration clazz, String fieldName) { + String suffix = capitalize(fieldName); + for (String prefix : new String[] { "get", "is" }) { + List getters = clazz.getMethodsByName(prefix + suffix); + for (MethodDeclaration getter : getters) { + if (getter.getParameters().isEmpty()) { + return Optional.of(getter.getType()); + } + } + } + return Optional.empty(); + } + + private static String capitalize(String value) { + return Character.toUpperCase(value.charAt(0)) + value.substring(1); + } + + private static Optional findAncestor(Node node, Class type) { + Optional parent = node.getParentNode(); + while (parent.isPresent()) { + Node current = parent.get(); + if (type.isInstance(current)) { + return Optional.of(type.cast(current)); + } + parent = current.getParentNode(); + } + return Optional.empty(); + } + + private static void exposeRawListQueuesResponse(PackageCustomization implPackage, Logger logger) { + if (implPackage.getClass("ServicesImpl") == null) { + logger.info("ServicesImpl not present; skipping raw list-queues accessor injection."); + return; + } + implPackage.getClass("ServicesImpl").customizeAst(ast -> ast.getClassByName("ServicesImpl").ifPresent(clazz -> { + clazz.addMember(StaticJavaParser.parseMethodDeclaration( + "@ServiceMethod(returns = ReturnType.SINGLE)\n" + + "public Mono> getQueuesWithResponseAsync(RequestOptions requestOptions) {\n" + + " final String accept = \"application/xml\";\n" + + " return FluxUtil.withContext(context -> service.getQueues(this.client.getUrl(),\n" + + " this.client.getServiceVersion().getVersion(), accept, requestOptions, context));\n" + + "}")); + clazz.addMember(StaticJavaParser.parseMethodDeclaration( + "@ServiceMethod(returns = ReturnType.SINGLE)\n" + + "public Response getQueuesWithResponse(RequestOptions requestOptions) {\n" + + " final String accept = \"application/xml\";\n" + + " return service.getQueuesSync(this.client.getUrl(),\n" + + " this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE);\n" + + "}")); + logger.info("Injected raw getQueuesWithResponse[Async] accessors into ServicesImpl."); + })); + } + + private static void retargetServiceVersionReferences(Editor editor, Logger logger) { + String implDir = "src/main/java/com/azure/storage/queue/implementation/"; + for (String fileName : new String[] { + "AzureQueueStorageImpl.java", "ServicesImpl.java", "QueuesImpl.java", + "MessagesImpl.java", "MessageIdsImpl.java" }) { + String path = implDir + fileName; + String content = editor.getContents().get(path); + if (content == null || !content.contains("QueuesServiceVersion")) { + continue; + } + String updated = content.replace("QueuesServiceVersion", "QueueServiceVersion"); + editor.replaceFile(path, updated); + logger.info("Retargeted QueuesServiceVersion -> QueueServiceVersion in {}.", fileName); + } + } + + private static void preserveHandwrittenModuleInfo(Editor editor, Logger logger) { + String path = "src/main/java/module-info.java"; + if (editor.getContents().containsKey(path)) { + editor.removeFile(path); + logger.info("Removed generated module-info.java to preserve the hand-written module descriptor."); + } else { + logger.info("Generated module-info.java not present; nothing to remove."); + } + } + + private static void removeGeneratedPublicClients(Editor editor, Logger logger) { + for (String fileName : FILES_TO_REMOVE) { + String path = ROOT_FILE_PATH + fileName; + if (editor.getContents().containsKey(path)) { + editor.removeFile(path); + logger.info("Removed generated public client {}", path); + } else { + logger.info("Generated file {} not present; skipping removal.", path); + } + } + } + + private static void updateImplToMapInternalException(PackageCustomization implPackage, Logger logger) { + List implsToUpdate = Arrays.asList("MessageIdsImpl", "MessagesImpl", "QueuesImpl", "ServicesImpl"); + for (String implToUpdate : implsToUpdate) { + if (implPackage.getClass(implToUpdate) == null) { + logger.info("Impl class {} not present; skipping exception mapping.", implToUpdate); + continue; + } + implPackage.getClass(implToUpdate).customizeAst(ast -> { + ast.addImport("com.azure.storage.queue.implementation.util.ModelHelper"); + ast.addImport("com.azure.storage.queue.models.QueueStorageException"); + ast.addImport("com.azure.storage.queue.implementation.models.QueueStorageExceptionInternal"); + ast.findAll(NormalAnnotationExpr.class).stream() + .filter(anno -> anno.getNameAsString().equals("UnexpectedResponseExceptionType") + && anno.getPairs().stream().anyMatch(p -> p.getNameAsString().equals("code"))) + .collect(java.util.stream.Collectors.toList()) + .forEach(Node::remove); + ast.findAll(SingleMemberAnnotationExpr.class).forEach(anno -> { + if (anno.getNameAsString().equals("UnexpectedResponseExceptionType") + && "HttpResponseException.class".equals(anno.getMemberValue().toString())) { + anno.setMemberValue(StaticJavaParser.parseExpression("QueueStorageExceptionInternal.class")); + } + }); + ast.getClassByName(implToUpdate).ifPresent(clazz -> { + clazz.getMethods().forEach(methodDeclaration -> { + Type returnType = methodDeclaration.getType(); + // The way code generation works we only need to update the methods that have a class return type. + // As non-class return types, such as "void", call into the Response methods. + if (!returnType.isClassOrInterfaceType()) { + return; + } + + ClassOrInterfaceType returnTypeClass = returnType.asClassOrInterfaceType(); + String returnTypeName = returnTypeClass.getNameAsString(); + if (returnTypeName.equals("PagedFlux") || returnTypeName.equals("PagedIterable") + || returnTypeName.equals("PollerFlux") || returnTypeName.equals("SyncPoller")) { + return; + } + + if (returnTypeName.equals("Mono") || returnTypeName.equals("Flux")) { + addErrorMappingToAsyncMethod(methodDeclaration); + } else { + addErrorMappingToSyncMethod(methodDeclaration); + } + }); + }); + }); + logger.info("Applied QueueStorageExceptionInternal -> QueueStorageException mapping to {}.", implToUpdate); + } + } + + private static void addErrorMappingToAsyncMethod(MethodDeclaration method) { + BlockStmt body = method.getBody().get(); + + // Bit of hack to insert the 'onErrorMap' in the right location. + // Unfortunately, 'onErrorMap' returns which for some calls breaks typing, such as Void -> Object or + // PagedResponse -> PagedResponseBase. So, 'onErrorMap' needs to be inserted after the first method call. + // To do this, we track the first found '(' and the associated closing ')' to insert 'onErrorMap' after the ')'. + // So, 'service.methodCall(parameters).map()' becomes 'service.methodCall(parameters).onErrorMap().map()'. + String originalReturnStatement = body.getStatement(body.getStatements().size() - 1).asReturnStmt() + .getExpression().get().toString(); + int insertionPoint = findAsyncOnErrorMapInsertionPoint(originalReturnStatement); + String newReturnStatement = "return " + originalReturnStatement.substring(0, insertionPoint) + + ".onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException)" + + originalReturnStatement.substring(insertionPoint) + ";"; + try { + Statement newReturn = StaticJavaParser.parseStatement(newReturnStatement); + body.getStatements().set(body.getStatements().size() - 1, newReturn); + } catch (ParseProblemException ex) { + throw new RuntimeException("Failed to parse: " + newReturnStatement, ex); + } + } + + private static int findAsyncOnErrorMapInsertionPoint(String returnStatement) { + int openParenthesis = 0; + int closeParenthesis = 0; + for (int i = 0; i < returnStatement.length(); i++) { + char c = returnStatement.charAt(i); + if (c == '(') { + openParenthesis++; + } else if (c == ')') { + closeParenthesis++; + if (openParenthesis == closeParenthesis) { + return i + 1; + } + } + } + return -1; + } + + private static void addErrorMappingToSyncMethod(MethodDeclaration method) { + // Turn the entire method into a BlockStmt that will be used as the try block. + BlockStmt tryBlock = method.getBody().get(); + BlockStmt catchBlock = new BlockStmt(new NodeList<>(StaticJavaParser.parseStatement( + "throw ModelHelper.mapToQueueStorageException(internalException);"))); + Parameter catchParameter = new Parameter().setType("QueueStorageExceptionInternal") + .setName("internalException"); + CatchClause catchClause = new CatchClause(catchParameter, catchBlock); + TryStmt tryCatchMap = new TryStmt(tryBlock, new NodeList<>(catchClause), null); + + // Replace the last statement with the try-catch block. + method.setBody(new BlockStmt(new NodeList<>(tryCatchMap))); + } +} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java index 57ef891385dd..1e06193a1ebd 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java @@ -10,8 +10,8 @@ import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; @@ -20,6 +20,7 @@ import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.implementation.SasImplUtils; import com.azure.storage.queue.implementation.AzureQueueStorageImpl; +import com.azure.storage.queue.implementation.models.MessageIdsUpdateHeaders; import com.azure.storage.queue.implementation.models.MessagesDequeueHeaders; import com.azure.storage.queue.implementation.models.MessagesPeekHeaders; import com.azure.storage.queue.implementation.models.PeekedMessageItemInternal; @@ -27,6 +28,10 @@ import com.azure.storage.queue.implementation.models.QueueMessage; import com.azure.storage.queue.implementation.models.QueueMessageItemInternal; import com.azure.storage.queue.implementation.models.QueueMessageItemInternalWrapper; +import com.azure.storage.queue.implementation.models.QueueSignedIdentifierWrapper; +import com.azure.storage.queue.implementation.models.QueuesGetAccessPolicyHeaders; +import com.azure.storage.queue.implementation.models.QueuesGetPropertiesHeaders; +import com.azure.storage.queue.implementation.models.SendMessageResultWrapper; import com.azure.storage.queue.implementation.util.ModelHelper; import com.azure.storage.queue.implementation.util.QueueSasImplUtil; import com.azure.storage.queue.models.PeekedMessageItem; @@ -130,7 +135,7 @@ public final class QueueAsyncClient { * @return the URL of the storage queue */ public String getQueueUrl() { - return client.getUrl() + "/" + queueName; + return client.getUrl(); } /** @@ -224,8 +229,9 @@ public Mono> createWithResponse(Map metadata) { } Mono> createWithResponse(Map metadata, Context context) { - context = context == null ? Context.NONE : context; - return client.getQueues().createNoCustomHeadersWithResponseAsync(queueName, null, metadata, null, context); + RequestOptions requestOptions = ModelHelper.requestOptions(context); + ModelHelper.addMetadataHeaders(requestOptions, metadata); + return client.getQueues().createWithResponseAsync(requestOptions); } /** @@ -360,8 +366,7 @@ public Mono> deleteWithResponse() { } Mono> deleteWithResponse(Context context) { - context = context == null ? Context.NONE : context; - return client.getQueues().deleteNoCustomHeadersWithResponseAsync(queueName, null, null, context); + return client.getQueues().deleteWithResponseAsync(ModelHelper.requestOptions(context)); } /** @@ -494,9 +499,9 @@ public Mono getProperties() { public Mono> getPropertiesWithResponse() { try { return withContext(context -> client.getQueues() - .getPropertiesWithResponseAsync(queueName, null, null, context) + .getPropertiesWithResponseAsync(ModelHelper.requestOptions(context)) .map(response -> new SimpleResponse<>(response, - ModelHelper.transformQueueProperties(response.getDeserializedHeaders())))); + ModelHelper.transformQueueProperties(new QueuesGetPropertiesHeaders(response.getHeaders()))))); } catch (RuntimeException ex) { return monoError(LOGGER, ex); } @@ -576,8 +581,11 @@ public Mono setMetadata(Map metadata) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono> setMetadataWithResponse(Map metadata) { try { - return withContext(context -> client.getQueues() - .setMetadataNoCustomHeadersWithResponseAsync(queueName, null, metadata, null, context)); + return withContext(context -> { + RequestOptions requestOptions = ModelHelper.requestOptions(context); + ModelHelper.addMetadataHeaders(requestOptions, metadata); + return client.getQueues().setMetadataWithResponseAsync(requestOptions); + }); } catch (RuntimeException ex) { return monoError(LOGGER, ex); } @@ -608,9 +616,11 @@ public Mono> setMetadataWithResponse(Map metadata public PagedFlux getAccessPolicy() { try { Function>> retriever = marker -> this.client.getQueues() - .getAccessPolicyWithResponseAsync(queueName, null, null, Context.NONE) + .getAccessPolicyWithResponseAsync(ModelHelper.requestOptions(Context.NONE)) .map(response -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), - response.getHeaders(), response.getValue().items(), null, response.getDeserializedHeaders())); + response.getHeaders(), + ModelHelper.deserializeXmlBody(response.getValue(), QueueSignedIdentifierWrapper::fromXml).items(), + null, new QueuesGetAccessPolicyHeaders(response.getHeaders()))); return new PagedFlux<>(() -> retriever.apply(null), retriever); } catch (RuntimeException ex) { @@ -710,8 +720,9 @@ Mono> setAccessPolicyWithResponse(Iterable .stream(permissions != null ? permissions.spliterator() : Spliterators.emptySpliterator(), false) .collect(Collectors.toList()); - return client.getQueues() - .setAccessPolicyNoCustomHeadersWithResponseAsync(queueName, null, null, permissionsList, context); + RequestOptions requestOptions = ModelHelper.requestOptions(context); + requestOptions.setBody(ModelHelper.serializeXmlBody(new QueueSignedIdentifierWrapper(permissionsList))); + return client.getQueues().setAccessPolicyWithResponseAsync(requestOptions); } /** @@ -764,7 +775,7 @@ public Mono clearMessages() { public Mono> clearMessagesWithResponse() { try { return withContext( - context -> client.getMessages().clearNoCustomHeadersWithResponseAsync(queueName, null, null, context)); + context -> client.getMessages().clearWithResponseAsync(ModelHelper.requestOptions(context))); } catch (RuntimeException ex) { return monoError(LOGGER, ex); } @@ -946,11 +957,16 @@ public Mono> sendMessageWithResponse(BinaryData mess try { return withContext(context -> Mono.fromCallable(() -> ModelHelper.encodeMessage(message, messageEncoding)) .flatMap(messageText -> { - QueueMessage queueMessage = new QueueMessage().setMessageText(messageText); + QueueMessage queueMessage = new QueueMessage(messageText); + RequestOptions requestOptions = ModelHelper.requestOptions(context); + ModelHelper.addOptionalQueryParam(requestOptions, "visibilitytimeout", visibilityTimeoutInSeconds); + ModelHelper.addOptionalQueryParam(requestOptions, "messagettl", timeToLiveInSeconds); return client.getMessages() - .enqueueWithResponseAsync(queueName, queueMessage, visibilityTimeoutInSeconds, - timeToLiveInSeconds, null, null, context) - .map(response -> new SimpleResponse<>(response, response.getValue().items().get(0))); + .enqueueWithResponseAsync(ModelHelper.serializeXmlBody(queueMessage), requestOptions) + .map(response -> new SimpleResponse<>(response, + ModelHelper.deserializeXmlBody(response.getValue(), SendMessageResultWrapper::fromXml) + .items() + .get(0))); })); } catch (RuntimeException ex) { return monoError(LOGGER, ex); @@ -1063,10 +1079,12 @@ public PagedFlux receiveMessages(Integer maxMessages) { public PagedFlux receiveMessages(Integer maxMessages, Duration visibilityTimeout) { Integer visibilityTimeoutInSeconds = (visibilityTimeout == null) ? null : (int) visibilityTimeout.getSeconds(); try { - Function>> retriever - = marker -> withContext(context -> this.client.getMessages() - .dequeueWithResponseAsync(queueName, maxMessages, visibilityTimeoutInSeconds, null, null, context)) - .flatMap(this::transformMessagesDequeueResponse); + Function>> retriever = marker -> withContext(context -> { + RequestOptions requestOptions = ModelHelper.requestOptions(context); + ModelHelper.addOptionalQueryParam(requestOptions, "numofmessages", maxMessages); + ModelHelper.addOptionalQueryParam(requestOptions, "visibilitytimeout", visibilityTimeoutInSeconds); + return this.client.getMessages().dequeueWithResponseAsync(requestOptions); + }).flatMap(this::transformMessagesDequeueResponse); return new PagedFlux<>(() -> retriever.apply(null), retriever); } catch (RuntimeException ex) { @@ -1074,12 +1092,12 @@ public PagedFlux receiveMessages(Integer maxMessages, Duration } } - private Mono> transformMessagesDequeueResponse( - ResponseBase response) { - List queueMessageInternalItems = response.getValue().items(); - if (queueMessageInternalItems == null) { - queueMessageInternalItems = Collections.emptyList(); - } + private Mono> + transformMessagesDequeueResponse(Response response) { + QueueMessageItemInternalWrapper wrapper + = ModelHelper.deserializeXmlBody(response.getValue(), QueueMessageItemInternalWrapper::fromXml); + List queueMessageInternalItems + = (wrapper == null || wrapper.items() == null) ? Collections.emptyList() : wrapper.items(); return Flux.fromIterable(queueMessageInternalItems) .flatMapSequential(queueMessageItemInternal -> Mono @@ -1109,7 +1127,7 @@ private Mono> transf })) .collectList() .map(queueMessageItems -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), - response.getHeaders(), queueMessageItems, null, response.getDeserializedHeaders())); + response.getHeaders(), queueMessageItems, null, new MessagesDequeueHeaders(response.getHeaders()))); } /** @@ -1177,10 +1195,13 @@ public Mono peekMessage() { @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux peekMessages(Integer maxMessages) { try { - Function>> retriever - = marker -> withContext(context -> this.client.getMessages() - .peekWithResponseAsync(queueName, maxMessages, null, null, context) - .flatMap(this::transformMessagesPeekResponse)); + Function>> retriever = marker -> withContext(context -> { + RequestOptions requestOptions = ModelHelper.requestOptions(context); + ModelHelper.addOptionalQueryParam(requestOptions, "numofmessages", maxMessages); + return this.client.getMessages() + .peekWithResponseAsync(requestOptions) + .flatMap(this::transformMessagesPeekResponse); + }); return new PagedFlux<>(() -> retriever.apply(null), retriever); } catch (RuntimeException ex) { @@ -1189,11 +1210,11 @@ public PagedFlux peekMessages(Integer maxMessages) { } private Mono> - transformMessagesPeekResponse(ResponseBase response) { - List peekedMessageInternalItems = response.getValue().items(); - if (peekedMessageInternalItems == null) { - peekedMessageInternalItems = Collections.emptyList(); - } + transformMessagesPeekResponse(Response response) { + PeekedMessageItemInternalWrapper wrapper + = ModelHelper.deserializeXmlBody(response.getValue(), PeekedMessageItemInternalWrapper::fromXml); + List peekedMessageInternalItems + = (wrapper == null || wrapper.items() == null) ? Collections.emptyList() : wrapper.items(); return Flux.fromIterable(peekedMessageInternalItems) .flatMapSequential(peekedMessageItemInternal -> Mono @@ -1223,7 +1244,7 @@ public PagedFlux peekMessages(Integer maxMessages) { })) .collectList() .map(peekedMessageItems -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), - response.getHeaders(), peekedMessageItems, null, response.getDeserializedHeaders())); + response.getHeaders(), peekedMessageItems, null, new MessagesPeekHeaders(response.getHeaders()))); } /** @@ -1318,18 +1339,25 @@ public Mono> updateMessageWithResponse(String mess QueueMessage message; if (messageText != null) { String finalMessage = ModelHelper.encodeMessage(BinaryData.fromString(messageText), messageEncoding); - message = new QueueMessage().setMessageText(finalMessage); + message = new QueueMessage(finalMessage); } else { message = null; } Duration visTimeout = visibilityTimeout == null ? Duration.ZERO : visibilityTimeout; try { - return withContext(context -> client.getMessageIds() - .updateWithResponseAsync(queueName, messageId, popReceipt, (int) visTimeout.getSeconds(), null, null, - message, context) - .map(response -> new SimpleResponse<>(response, - new UpdateMessageResult(response.getDeserializedHeaders().getXMsPopreceipt(), - response.getDeserializedHeaders().getXMsTimeNextVisible())))); + return withContext(context -> { + RequestOptions requestOptions = ModelHelper.requestOptions(context); + if (message != null) { + requestOptions.setBody(ModelHelper.serializeXmlBody(message)); + } + return client.getMessageIds() + .updateWithResponseAsync(messageId, popReceipt, (int) visTimeout.getSeconds(), requestOptions) + .map(response -> { + MessageIdsUpdateHeaders headers = new MessageIdsUpdateHeaders(response.getHeaders()); + return new SimpleResponse<>(response, + new UpdateMessageResult(headers.getXMsPopreceipt(), headers.getXMsTimeNextVisible())); + }); + }); } catch (RuntimeException ex) { return monoError(LOGGER, ex); } @@ -1411,7 +1439,7 @@ public Mono deleteMessage(String messageId, String popReceipt) { public Mono> deleteMessageWithResponse(String messageId, String popReceipt) { try { return withContext(context -> client.getMessageIds() - .deleteNoCustomHeadersWithResponseAsync(queueName, messageId, popReceipt, null, null, context)); + .deleteWithResponseAsync(messageId, popReceipt, ModelHelper.requestOptions(context))); } catch (RuntimeException ex) { return monoError(LOGGER, ex); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java index 6bd3751a4328..e04f5a7e7f73 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java @@ -10,8 +10,8 @@ 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.RequestOptions; import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; @@ -21,7 +21,6 @@ import com.azure.storage.queue.implementation.AzureQueueStorageImpl; import com.azure.storage.queue.implementation.models.MessageIdsUpdateHeaders; import com.azure.storage.queue.implementation.models.MessagesDequeueHeaders; -import com.azure.storage.queue.implementation.models.MessagesEnqueueHeaders; import com.azure.storage.queue.implementation.models.MessagesPeekHeaders; import com.azure.storage.queue.implementation.models.PeekedMessageItemInternal; import com.azure.storage.queue.implementation.models.PeekedMessageItemInternalWrapper; @@ -128,7 +127,7 @@ public final class QueueClient { * @return the URL of the storage queue. */ public String getQueueUrl() { - return azureQueueStorage.getUrl() + "/" + queueName; + return azureQueueStorage.getUrl(); } /** @@ -214,8 +213,11 @@ public void create() { public Response createWithResponse(Map metadata, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; try { - Supplier> operation = () -> this.azureQueueStorage.getQueues() - .createNoCustomHeadersWithResponse(queueName, null, metadata, null, finalContext); + Supplier> operation = () -> { + RequestOptions requestOptions = ModelHelper.requestOptions(finalContext); + ModelHelper.addMetadataHeaders(requestOptions, metadata); + return this.azureQueueStorage.getQueues().createWithResponse(requestOptions); + }; return submitThreadPool(operation, LOGGER, timeout); } catch (RuntimeException e) { @@ -282,8 +284,11 @@ public Response createIfNotExistsWithResponse(Map metad Context context) { Context finalContext = context == null ? Context.NONE : context; try { - Supplier> operation = () -> this.azureQueueStorage.getQueues() - .createNoCustomHeadersWithResponse(queueName, null, metadata, null, finalContext); + Supplier> operation = () -> { + RequestOptions requestOptions = ModelHelper.requestOptions(finalContext); + ModelHelper.addMetadataHeaders(requestOptions, metadata); + return this.azureQueueStorage.getQueues().createWithResponse(requestOptions); + }; Response response = submitThreadPool(operation, LOGGER, timeout); return new SimpleResponse<>(response, true); } catch (QueueStorageException e) { @@ -347,8 +352,8 @@ public void delete() { @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation = () -> this.azureQueueStorage.getQueues() - .deleteNoCustomHeadersWithResponse(queueName, null, null, finalContext); + Supplier> operation + = () -> this.azureQueueStorage.getQueues().deleteWithResponse(ModelHelper.requestOptions(finalContext)); return submitThreadPool(operation, LOGGER, timeout); } @@ -407,8 +412,8 @@ public boolean deleteIfExists() { public Response deleteIfExistsWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; try { - Supplier> operation = () -> this.azureQueueStorage.getQueues() - .deleteNoCustomHeadersWithResponse(queueName, null, null, finalContext); + Supplier> operation + = () -> this.azureQueueStorage.getQueues().deleteWithResponse(ModelHelper.requestOptions(finalContext)); Response response = submitThreadPool(operation, LOGGER, timeout); return new SimpleResponse<>(response, true); @@ -479,11 +484,12 @@ public QueueProperties getProperties() { @ServiceMethod(returns = ReturnType.SINGLE) public Response getPropertiesWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation - = () -> this.azureQueueStorage.getQueues().getPropertiesWithResponse(queueName, null, null, finalContext); + Supplier> operation = () -> this.azureQueueStorage.getQueues() + .getPropertiesWithResponse(ModelHelper.requestOptions(finalContext)); - ResponseBase response = submitThreadPool(operation, LOGGER, timeout); - return new SimpleResponse<>(response, ModelHelper.transformQueueProperties(response.getDeserializedHeaders())); + Response response = submitThreadPool(operation, LOGGER, timeout); + return new SimpleResponse<>(response, + ModelHelper.transformQueueProperties(new QueuesGetPropertiesHeaders(response.getHeaders()))); } /** @@ -563,8 +569,11 @@ public void setMetadata(Map metadata) { @ServiceMethod(returns = ReturnType.SINGLE) public Response setMetadataWithResponse(Map metadata, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation = () -> this.azureQueueStorage.getQueues() - .setMetadataNoCustomHeadersWithResponse(queueName, null, metadata, null, finalContext); + Supplier> operation = () -> { + RequestOptions requestOptions = ModelHelper.requestOptions(finalContext); + ModelHelper.addMetadataHeaders(requestOptions, metadata); + return this.azureQueueStorage.getQueues().setMetadataWithResponse(requestOptions); + }; return submitThreadPool(operation, LOGGER, timeout); } @@ -593,13 +602,14 @@ public Response setMetadataWithResponse(Map metadata, Dura */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable getAccessPolicy() { - ResponseBase responseBase - = azureQueueStorage.getQueues().getAccessPolicyWithResponse(queueName, null, null, Context.NONE); + Response responseBase + = azureQueueStorage.getQueues().getAccessPolicyWithResponse(ModelHelper.requestOptions(Context.NONE)); Supplier> response = () -> new PagedResponseBase<>(responseBase.getRequest(), responseBase.getStatusCode(), - responseBase.getHeaders(), responseBase.getValue().items(), null, - responseBase.getDeserializedHeaders()); + responseBase.getHeaders(), + ModelHelper.deserializeXmlBody(responseBase.getValue(), QueueSignedIdentifierWrapper::fromXml).items(), + null, new QueuesGetAccessPolicyHeaders(responseBase.getHeaders())); return new PagedIterable<>(response); } @@ -669,8 +679,11 @@ public void setAccessPolicy(List permissions) { public Response setAccessPolicyWithResponse(List permissions, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation = () -> this.azureQueueStorage.getQueues() - .setAccessPolicyNoCustomHeadersWithResponse(queueName, null, null, permissions, finalContext); + Supplier> operation = () -> { + RequestOptions requestOptions = ModelHelper.requestOptions(finalContext); + requestOptions.setBody(ModelHelper.serializeXmlBody(new QueueSignedIdentifierWrapper(permissions))); + return this.azureQueueStorage.getQueues().setAccessPolicyWithResponse(requestOptions); + }; return submitThreadPool(operation, LOGGER, timeout); } @@ -726,8 +739,8 @@ public void clearMessages() { @ServiceMethod(returns = ReturnType.SINGLE) public Response clearMessagesWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation = () -> this.azureQueueStorage.getMessages() - .clearNoCustomHeadersWithResponse(queueName, null, null, finalContext); + Supplier> operation + = () -> this.azureQueueStorage.getMessages().clearWithResponse(ModelHelper.requestOptions(finalContext)); return submitThreadPool(operation, LOGGER, timeout); } @@ -898,17 +911,20 @@ public Response sendMessageWithResponse(BinaryData message, D Integer timeToLiveInSeconds = (timeToLive == null) ? null : (int) timeToLive.getSeconds(); Context finalContext = context == null ? Context.NONE : context; String finalMessage = ModelHelper.encodeMessage(message, messageEncoding); - QueueMessage queueMessage = new QueueMessage().setMessageText(finalMessage); + QueueMessage queueMessage = new QueueMessage(finalMessage); - Supplier> operation - = () -> this.azureQueueStorage.getMessages() - .enqueueWithResponse(queueName, queueMessage, visibilityTimeoutInSeconds, timeToLiveInSeconds, null, - null, finalContext); + Supplier> operation = () -> { + RequestOptions requestOptions = ModelHelper.requestOptions(finalContext); + ModelHelper.addOptionalQueryParam(requestOptions, "visibilitytimeout", visibilityTimeoutInSeconds); + ModelHelper.addOptionalQueryParam(requestOptions, "messagettl", timeToLiveInSeconds); + return this.azureQueueStorage.getMessages() + .enqueueWithResponse(ModelHelper.serializeXmlBody(queueMessage), requestOptions); + }; - ResponseBase response - = submitThreadPool(operation, LOGGER, timeout); + Response response = submitThreadPool(operation, LOGGER, timeout); - return new SimpleResponse<>(response, response.getValue().items().get(0)); + return new SimpleResponse<>(response, + ModelHelper.deserializeXmlBody(response.getValue(), SendMessageResultWrapper::fromXml).items().get(0)); } /** @@ -1022,28 +1038,31 @@ PagedIterable receiveMessagesWithOptionalTimeout(Integer maxMe Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; Integer visibilityTimeoutInSeconds = (visibilityTimeout == null) ? null : (int) visibilityTimeout.getSeconds(); - Supplier> operation - = () -> this.azureQueueStorage.getMessages() - .dequeueWithResponse(queueName, maxMessages, visibilityTimeoutInSeconds, null, null, finalContext); + Supplier> operation = () -> { + RequestOptions requestOptions = ModelHelper.requestOptions(finalContext); + ModelHelper.addOptionalQueryParam(requestOptions, "numofmessages", maxMessages); + ModelHelper.addOptionalQueryParam(requestOptions, "visibilitytimeout", visibilityTimeoutInSeconds); + return this.azureQueueStorage.getMessages().dequeueWithResponse(requestOptions); + }; - ResponseBase response - = submitThreadPool(operation, LOGGER, timeout); + Response response = submitThreadPool(operation, LOGGER, timeout); PagedResponseBase transformedMessages = transformMessagesDequeueResponse(response); - Supplier> res = () -> new PagedResponseBase<>(response.getRequest(), - response.getStatusCode(), response.getHeaders(), transformedMessages, response.getDeserializedHeaders()); + Supplier> res + = () -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), + transformedMessages, new MessagesDequeueHeaders(response.getHeaders())); return new PagedIterable<>(res); } - private PagedResponseBase transformMessagesDequeueResponse( - ResponseBase response) { - List queueMessageInternalItems = response.getValue().items(); - if (queueMessageInternalItems == null) { - queueMessageInternalItems = Collections.emptyList(); - } + private PagedResponseBase + transformMessagesDequeueResponse(Response response) { + QueueMessageItemInternalWrapper wrapper + = ModelHelper.deserializeXmlBody(response.getValue(), QueueMessageItemInternalWrapper::fromXml); + List queueMessageInternalItems + = (wrapper == null || wrapper.items() == null) ? Collections.emptyList() : wrapper.items(); List messageItems = new ArrayList<>(); for (QueueMessageItemInternal queueMessageInternalItem : queueMessageInternalItems) { @@ -1073,7 +1092,7 @@ private PagedResponseBase transformMes } } return new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), - messageItems, null, response.getDeserializedHeaders()); + messageItems, null, new MessagesDequeueHeaders(response.getHeaders())); } /** @@ -1146,26 +1165,28 @@ public PagedIterable peekMessages(Integer maxMessages, Durati PagedIterable peekMessagesWithOptionalTimeout(Integer maxMessages, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation - = () -> this.azureQueueStorage.getMessages() - .peekWithResponse(queueName, maxMessages, null, null, finalContext); + Supplier> operation = () -> { + RequestOptions requestOptions = ModelHelper.requestOptions(finalContext); + ModelHelper.addOptionalQueryParam(requestOptions, "numofmessages", maxMessages); + return this.azureQueueStorage.getMessages().peekWithResponse(requestOptions); + }; - ResponseBase response - = submitThreadPool(operation, LOGGER, timeout); + Response response = submitThreadPool(operation, LOGGER, timeout); PagedResponseBase transformedMessages = transformMessagesPeekResponse(response); - Supplier> res = () -> new PagedResponseBase<>(response.getRequest(), - response.getStatusCode(), response.getHeaders(), transformedMessages, response.getDeserializedHeaders()); + Supplier> res + = () -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), + transformedMessages, new MessagesPeekHeaders(response.getHeaders())); return new PagedIterable<>(res); } private PagedResponseBase - transformMessagesPeekResponse(ResponseBase response) { - List peekedMessageInternalItems = response.getValue().items(); - if (peekedMessageInternalItems == null) { - peekedMessageInternalItems = Collections.emptyList(); - } + transformMessagesPeekResponse(Response response) { + PeekedMessageItemInternalWrapper wrapper + = ModelHelper.deserializeXmlBody(response.getValue(), PeekedMessageItemInternalWrapper::fromXml); + List peekedMessageInternalItems + = (wrapper == null || wrapper.items() == null) ? Collections.emptyList() : wrapper.items(); List messageItems = new ArrayList<>(); for (PeekedMessageItemInternal peekedMessageInternalItem : peekedMessageInternalItems) { @@ -1195,7 +1216,7 @@ PagedIterable peekMessagesWithOptionalTimeout(Integer maxMess } } return new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), - messageItems, null, response.getDeserializedHeaders()); + messageItems, null, new MessagesPeekHeaders(response.getHeaders())); } /** @@ -1276,20 +1297,26 @@ public Response updateMessageWithResponse(String messageId, QueueMessage message; if (messageText != null) { String finalMessage = ModelHelper.encodeMessage(BinaryData.fromString(messageText), messageEncoding); - message = new QueueMessage().setMessageText(finalMessage); + message = new QueueMessage(finalMessage); } else { message = null; } Context finalContext = context == null ? Context.NONE : context; Duration finalVisibilityTimeout = visibilityTimeout == null ? Duration.ZERO : visibilityTimeout; - Supplier> operation = () -> this.azureQueueStorage.getMessageIds() - .updateWithResponse(queueName, messageId, popReceipt, (int) finalVisibilityTimeout.getSeconds(), null, null, - message, finalContext); + Supplier> operation = () -> { + RequestOptions requestOptions = ModelHelper.requestOptions(finalContext); + if (message != null) { + requestOptions.setBody(ModelHelper.serializeXmlBody(message)); + } + return this.azureQueueStorage.getMessageIds() + .updateWithResponse(messageId, popReceipt, (int) finalVisibilityTimeout.getSeconds(), requestOptions); + }; - ResponseBase response = submitThreadPool(operation, LOGGER, timeout); + Response response = submitThreadPool(operation, LOGGER, timeout); - UpdateMessageResult result = new UpdateMessageResult(response.getDeserializedHeaders().getXMsPopreceipt(), - response.getDeserializedHeaders().getXMsTimeNextVisible()); + MessageIdsUpdateHeaders headers = new MessageIdsUpdateHeaders(response.getHeaders()); + UpdateMessageResult result + = new UpdateMessageResult(headers.getXMsPopreceipt(), headers.getXMsTimeNextVisible()); return new SimpleResponse<>(response, result); } @@ -1355,7 +1382,7 @@ public Response deleteMessageWithResponse(String messageId, String popRece Context context) { Context finalContext = context == null ? Context.NONE : context; Supplier> operation = () -> this.azureQueueStorage.getMessageIds() - .deleteNoCustomHeadersWithResponse(queueName, messageId, popReceipt, null, null, finalContext); + .deleteWithResponse(messageId, popReceipt, ModelHelper.requestOptions(finalContext)); return submitThreadPool(operation, LOGGER, timeout); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java index f7e6d6f724ed..f19b2485496f 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java @@ -721,7 +721,7 @@ private AzureQueueStorageImpl createAzureQueueStorageImpl(QueueServiceVersion ve endpoint, retryOptions, coreRetryOptions, logOptions, clientOptions, httpClient, perCallPolicies, perRetryPolicies, configuration, audience, LOGGER); - return new AzureQueueStorageImpl(pipeline, endpoint, version.getVersion()); + return new AzureQueueStorageImpl(pipeline, endpoint + "/" + queueName, version); } /** diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java index d7abba61026f..b67e95d9cf82 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java @@ -9,6 +9,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; @@ -22,6 +23,7 @@ import com.azure.storage.common.sas.AccountSasSignatureValues; import com.azure.storage.queue.implementation.AzureQueueStorageImpl; import com.azure.storage.queue.implementation.models.KeyInfo; +import com.azure.storage.queue.implementation.util.ModelHelper; import com.azure.storage.queue.models.QueueCorsRule; import com.azure.storage.queue.models.QueueGetUserDelegationKeyOptions; import com.azure.storage.queue.models.QueueItem; @@ -132,9 +134,11 @@ public QueueMessageEncoding getMessageEncoding() { * @return QueueAsyncClient that interacts with the specified queue */ public QueueAsyncClient getQueueAsyncClient(String queueName) { - QueueClient queueClient = new QueueClient(client, queueName, accountName, serviceVersion, messageEncoding, + AzureQueueStorageImpl queueStorage = new AzureQueueStorageImpl(client.getHttpPipeline(), + client.getSerializerAdapter(), client.getUrl() + "/" + queueName, client.getServiceVersion()); + QueueClient queueClient = new QueueClient(queueStorage, queueName, accountName, serviceVersion, messageEncoding, processMessageDecodingErrorAsyncHandler, processMessageDecodingErrorHandler, null); - return new QueueAsyncClient(client, queueName, accountName, serviceVersion, messageEncoding, + return new QueueAsyncClient(queueStorage, queueName, accountName, serviceVersion, messageEncoding, processMessageDecodingErrorAsyncHandler, processMessageDecodingErrorHandler, queueClient); } @@ -349,9 +353,9 @@ PagedFlux listQueuesWithOptionalTimeout(String marker, QueuesSegmentO BiFunction>> retriever = (nextMarker, pageSize) -> StorageImplUtils.applyOptionalTimeout(this.client.getServices() - .listQueuesSegmentSinglePageAsync(prefix, nextMarker, pageSize == null ? maxResultsPerPage : pageSize, - include, null, null, context), - timeout); + .getQueuesWithResponseAsync(ModelHelper.listQueuesRequestOptions(context, prefix, nextMarker, + pageSize == null ? maxResultsPerPage : pageSize, include)) + .map(ModelHelper::toQueueItemPage), timeout); return new PagedFlux<>(pageSize -> retriever.apply(marker, pageSize), retriever); } @@ -420,10 +424,10 @@ public Mono> getPropertiesWithResponse() { } Mono> getPropertiesWithResponse(Context context) { - context = context == null ? Context.NONE : context; return client.getServices() - .getPropertiesWithResponseAsync(null, null, context) - .map(response -> new SimpleResponse<>(response, response.getValue())); + .getPropertiesWithResponseAsync(ModelHelper.requestOptions(context)) + .map(response -> new SimpleResponse<>(response, + ModelHelper.deserializeXmlBody(response.getValue(), QueueServiceProperties::fromXml))); } /** @@ -545,8 +549,9 @@ public Mono> setPropertiesWithResponse(QueueServiceProperties pro } Mono> setPropertiesWithResponse(QueueServiceProperties properties, Context context) { - context = context == null ? Context.NONE : context; - return client.getServices().setPropertiesNoCustomHeadersWithResponseAsync(properties, null, null, context); + return client.getServices() + .setPropertiesWithResponseAsync(ModelHelper.serializeXmlBody(properties), + ModelHelper.requestOptions(context)); } /** @@ -609,10 +614,10 @@ public Mono> getStatisticsWithResponse() { } Mono> getStatisticsWithResponse(Context context) { - context = context == null ? Context.NONE : context; return client.getServices() - .getStatisticsWithResponseAsync(null, null, context) - .map(response -> new SimpleResponse<>(response, response.getValue())); + .getStatisticsWithResponseAsync(ModelHelper.requestOptions(context)) + .map(response -> new SimpleResponse<>(response, + ModelHelper.deserializeXmlBody(response.getValue(), QueueServiceStatistics::fromXml))); } /** @@ -788,12 +793,11 @@ Mono> getUserDelegationKeyWithResponse(OffsetDateTim new IllegalArgumentException("`start` must be null or a datetime before `expiry`.")); } + KeyInfo keyInfo = new KeyInfo(expiry).setStart(start).setDelegatedUserTenantId(delegatedUserTenantId); return client.getServices() - .getUserDelegationKeyWithResponseAsync( - new KeyInfo().setStart(start == null ? "" : Constants.ISO_8601_UTC_DATE_FORMATTER.format(start)) - .setExpiry(Constants.ISO_8601_UTC_DATE_FORMATTER.format(expiry)) - .setDelegatedUserTenantId(delegatedUserTenantId), - null, null, context) - .map(rb -> new SimpleResponse<>(rb, rb.getValue())); + .getUserDelegationKeyWithResponseAsync(ModelHelper.serializeXmlBody(keyInfo), + ModelHelper.requestOptions(context)) + .map(rb -> new SimpleResponse<>(rb, + ModelHelper.deserializeXmlBody(rb.getValue(), UserDelegationKey::fromXml))); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java index b7a630025160..e9d76849ea83 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java @@ -12,6 +12,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.StorageSharedKeyCredential; @@ -21,6 +22,7 @@ import com.azure.storage.common.implementation.StorageImplUtils; import com.azure.storage.common.sas.AccountSasSignatureValues; import com.azure.storage.queue.implementation.AzureQueueStorageImpl; +import com.azure.storage.queue.implementation.util.ModelHelper; import com.azure.storage.queue.implementation.models.KeyInfo; import com.azure.storage.queue.implementation.models.ServicesGetStatisticsHeaders; import com.azure.storage.queue.implementation.models.ServicesGetUserDelegationKeyHeaders; @@ -141,10 +143,12 @@ public QueueMessageEncoding getMessageEncoding() { * @return QueueClient that interacts with the specified queue */ public QueueClient getQueueClient(String queueName) { - QueueAsyncClient queueAsyncClient - = new QueueAsyncClient(this.azureQueueStorage, queueName, accountName, serviceVersion, messageEncoding, - processMessageDecodingErrorAsyncHandler, processMessageDecodingErrorHandler, null); - return new QueueClient(this.azureQueueStorage, queueName, accountName, serviceVersion, messageEncoding, + AzureQueueStorageImpl queueStorage = new AzureQueueStorageImpl(this.azureQueueStorage.getHttpPipeline(), + this.azureQueueStorage.getSerializerAdapter(), this.azureQueueStorage.getUrl() + "/" + queueName, + this.azureQueueStorage.getServiceVersion()); + QueueAsyncClient queueAsyncClient = new QueueAsyncClient(queueStorage, queueName, accountName, serviceVersion, + messageEncoding, processMessageDecodingErrorAsyncHandler, processMessageDecodingErrorHandler, null); + return new QueueClient(queueStorage, queueName, accountName, serviceVersion, messageEncoding, processMessageDecodingErrorAsyncHandler, processMessageDecodingErrorHandler, queueAsyncClient); } @@ -335,9 +339,10 @@ public PagedIterable listQueues(QueuesSegmentOptions options, Duratio } } BiFunction> retriever = (nextMarker, pageSize) -> { - Supplier> operation = () -> this.azureQueueStorage.getServices() - .listQueuesSegmentSinglePage(prefix, nextMarker, pageSize == null ? maxResultsPerPage : pageSize, - include, null, null, finalContext); + Supplier> operation + = () -> ModelHelper.toQueueItemPage(this.azureQueueStorage.getServices() + .getQueuesWithResponse(ModelHelper.listQueuesRequestOptions(finalContext, prefix, nextMarker, + pageSize == null ? maxResultsPerPage : pageSize, include))); return submitThreadPool(operation, LOGGER, timeout); @@ -403,8 +408,12 @@ public QueueServiceProperties getProperties() { @ServiceMethod(returns = ReturnType.SINGLE) public Response getPropertiesWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation - = () -> this.azureQueueStorage.getServices().getPropertiesWithResponse(null, null, finalContext); + Supplier> operation = () -> { + Response response = this.azureQueueStorage.getServices() + .getPropertiesWithResponse(ModelHelper.requestOptions(finalContext)); + return new SimpleResponse<>(response, + ModelHelper.deserializeXmlBody(response.getValue(), QueueServiceProperties::fromXml)); + }; return submitThreadPool(operation, LOGGER, timeout); } @@ -538,7 +547,8 @@ public Response setPropertiesWithResponse(QueueServiceProperties propertie Context context) { Context finalContext = context == null ? Context.NONE : context; Supplier> operation = () -> this.azureQueueStorage.getServices() - .setPropertiesNoCustomHeadersWithResponse(properties, null, null, finalContext); + .setPropertiesWithResponse(ModelHelper.serializeXmlBody(properties), + ModelHelper.requestOptions(finalContext)); return submitThreadPool(operation, LOGGER, timeout); } @@ -596,8 +606,12 @@ public QueueServiceStatistics getStatistics() { @ServiceMethod(returns = ReturnType.SINGLE) public Response getStatisticsWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation - = () -> this.azureQueueStorage.getServices().getStatisticsWithResponse(null, null, finalContext); + Supplier> operation = () -> { + Response response = this.azureQueueStorage.getServices() + .getStatisticsWithResponse(ModelHelper.requestOptions(finalContext)); + return new SimpleResponse<>(response, + ModelHelper.deserializeXmlBody(response.getValue(), QueueServiceStatistics::fromXml)); + }; return submitThreadPool(operation, LOGGER, timeout); } @@ -754,17 +768,16 @@ public Response getUserDelegationKeyWithResponse(QueueGetUser new IllegalArgumentException("`start` must be null or a datetime before `expiry`.")); } - Callable> operation - = () -> this.azureQueueStorage.getServices() - .getUserDelegationKeyWithResponse(new KeyInfo() - .setStart(options.getStartsOn() == null - ? "" - : Constants.ISO_8601_UTC_DATE_FORMATTER.format(options.getStartsOn())) - .setExpiry(Constants.ISO_8601_UTC_DATE_FORMATTER.format(options.getExpiresOn())) - .setDelegatedUserTenantId(options.getDelegatedUserTenantId()), null, null, finalContext); - - ResponseBase response - = sendRequest(operation, timeout, QueueStorageException.class); + KeyInfo keyInfo = new KeyInfo(options.getExpiresOn()).setStart(options.getStartsOn()) + .setDelegatedUserTenantId(options.getDelegatedUserTenantId()); + Callable> operation = () -> { + Response rb = this.azureQueueStorage.getServices() + .getUserDelegationKeyWithResponse(ModelHelper.serializeXmlBody(keyInfo), + ModelHelper.requestOptions(finalContext)); + return new SimpleResponse<>(rb, ModelHelper.deserializeXmlBody(rb.getValue(), UserDelegationKey::fromXml)); + }; + + Response response = sendRequest(operation, timeout, QueueStorageException.class); return new SimpleResponse<>(response, response.getValue()); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClientBuilder.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClientBuilder.java index 917b4e424250..0d66350e9b39 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClientBuilder.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClientBuilder.java @@ -702,7 +702,7 @@ private AzureQueueStorageImpl createAzureQueueStorageImpl(QueueServiceVersion ve endpoint, retryOptions, coreRetryOptions, logOptions, clientOptions, httpClient, perCallPolicies, perRetryPolicies, configuration, audience, LOGGER); - return new AzureQueueStorageImpl(pipeline, endpoint, version.getVersion()); + return new AzureQueueStorageImpl(pipeline, endpoint, version); } /** diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java index f94306482fde..a2e7450140c3 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.implementation; @@ -10,18 +10,19 @@ import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.util.serializer.JacksonAdapter; import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.storage.queue.QueueServiceVersion; /** * Initializes a new instance of the AzureQueueStorage type. */ public final class AzureQueueStorageImpl { /** - * The URL of the service account, queue or message that is the target of the desired operation. + * The host name of the queue storage account, e.g. accountName.queue.core.windows.net. */ private final String url; /** - * Gets The URL of the service account, queue or message that is the target of the desired operation. + * Gets The host name of the queue storage account, e.g. accountName.queue.core.windows.net. * * @return the url value. */ @@ -30,17 +31,17 @@ public String getUrl() { } /** - * Specifies the version of the operation to use for this request. + * Service version. */ - private final String version; + private final QueueServiceVersion serviceVersion; /** - * Gets Specifies the version of the operation to use for this request. + * Gets Service version. * - * @return the version value. + * @return the serviceVersion value. */ - public String getVersion() { - return this.version; + public QueueServiceVersion getServiceVersion() { + return this.serviceVersion; } /** @@ -130,23 +131,23 @@ public MessageIdsImpl getMessageIds() { /** * Initializes an instance of AzureQueueStorage client. * - * @param url The URL of the service account, queue or message that is the target of the desired operation. - * @param version Specifies the version of the operation to use for this request. + * @param url The host name of the queue storage account, e.g. accountName.queue.core.windows.net. + * @param serviceVersion Service version. */ - public AzureQueueStorageImpl(String url, String version) { + public AzureQueueStorageImpl(String url, QueueServiceVersion serviceVersion) { this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), url, version); + JacksonAdapter.createDefaultSerializerAdapter(), url, serviceVersion); } /** * Initializes an instance of AzureQueueStorage client. * * @param httpPipeline The HTTP pipeline to send requests through. - * @param url The URL of the service account, queue or message that is the target of the desired operation. - * @param version Specifies the version of the operation to use for this request. + * @param url The host name of the queue storage account, e.g. accountName.queue.core.windows.net. + * @param serviceVersion Service version. */ - public AzureQueueStorageImpl(HttpPipeline httpPipeline, String url, String version) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), url, version); + public AzureQueueStorageImpl(HttpPipeline httpPipeline, String url, QueueServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), url, serviceVersion); } /** @@ -154,15 +155,15 @@ public AzureQueueStorageImpl(HttpPipeline httpPipeline, String url, String versi * * @param httpPipeline The HTTP pipeline to send requests through. * @param serializerAdapter The serializer to serialize an object into a string. - * @param url The URL of the service account, queue or message that is the target of the desired operation. - * @param version Specifies the version of the operation to use for this request. + * @param url The host name of the queue storage account, e.g. accountName.queue.core.windows.net. + * @param serviceVersion Service version. */ public AzureQueueStorageImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String url, - String version) { + QueueServiceVersion serviceVersion) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.url = url; - this.version = version; + this.serviceVersion = serviceVersion; this.services = new ServicesImpl(this); this.queues = new QueuesImpl(this); this.messages = new MessagesImpl(this); diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java index a5d084edbf61..941ec9dc29d2 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java @@ -1,9 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.implementation; -import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.Delete; import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.HeaderParam; @@ -16,14 +15,17 @@ import com.azure.core.annotation.ServiceInterface; import com.azure.core.annotation.ServiceMethod; import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.RestProxy; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.storage.queue.implementation.models.MessageIdsDeleteHeaders; -import com.azure.storage.queue.implementation.models.MessageIdsUpdateHeaders; -import com.azure.storage.queue.implementation.models.QueueMessage; +import com.azure.storage.queue.QueueServiceVersion; import com.azure.storage.queue.implementation.models.QueueStorageExceptionInternal; import com.azure.storage.queue.implementation.util.ModelHelper; import reactor.core.publisher.Mono; @@ -54,6 +56,19 @@ public final class MessageIdsImpl { this.client = client; } + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public QueueServiceVersion getServiceVersion() { + try { + return client.getServiceVersion(); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } + } + /** * The interface defining all the services for AzureQueueStorageMessageIds to be used by the proxy service to * perform REST calls. @@ -62,639 +77,220 @@ public final class MessageIdsImpl { @ServiceInterface(name = "AzureQueueStorageMessageIds") public interface MessageIdsService { - @Put("/{queueName}/messages/{messageid}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> update(@HostParam("url") String url, - @PathParam("queueName") String queueName, @PathParam("messageid") String messageid, - @QueryParam("popreceipt") String popReceipt, @QueryParam("visibilitytimeout") int visibilitytimeout, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueMessage queueMessage, @HeaderParam("Accept") String accept, - Context context); - - @Put("/{queueName}/messages/{messageid}") + @Put("/messages/{messageId}") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> updateNoCustomHeaders(@HostParam("url") String url, - @PathParam("queueName") String queueName, @PathParam("messageid") String messageid, - @QueryParam("popreceipt") String popReceipt, @QueryParam("visibilitytimeout") int visibilitytimeout, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueMessage queueMessage, @HeaderParam("Accept") String accept, - Context context); + Mono> update(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + @PathParam("messageId") String messageId, @QueryParam("popreceipt") String popReceipt, + @QueryParam("visibilitytimeout") int visibilityTimeout, RequestOptions requestOptions, Context context); - @Put("/{queueName}/messages/{messageid}") + @Put("/messages/{messageId}") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase updateSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @PathParam("messageid") String messageid, - @QueryParam("popreceipt") String popReceipt, @QueryParam("visibilitytimeout") int visibilitytimeout, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueMessage queueMessage, @HeaderParam("Accept") String accept, - Context context); + Response updateSync(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + @PathParam("messageId") String messageId, @QueryParam("popreceipt") String popReceipt, + @QueryParam("visibilitytimeout") int visibilityTimeout, RequestOptions requestOptions, Context context); - @Put("/{queueName}/messages/{messageid}") + @Delete("/messages/{messageId}") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response updateNoCustomHeadersSync(@HostParam("url") String url, @PathParam("queueName") String queueName, - @PathParam("messageid") String messageid, @QueryParam("popreceipt") String popReceipt, - @QueryParam("visibilitytimeout") int visibilitytimeout, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueMessage queueMessage, @HeaderParam("Accept") String accept, - Context context); + Mono> delete(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + @PathParam("messageId") String messageId, @QueryParam("popreceipt") String popReceipt, + RequestOptions requestOptions, Context context); - @Delete("/{queueName}/messages/{messageid}") + @Delete("/messages/{messageId}") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> delete(@HostParam("url") String url, - @PathParam("queueName") String queueName, @PathParam("messageid") String messageid, - @QueryParam("popreceipt") String popReceipt, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - - @Delete("/{queueName}/messages/{messageid}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> deleteNoCustomHeaders(@HostParam("url") String url, - @PathParam("queueName") String queueName, @PathParam("messageid") String messageid, - @QueryParam("popreceipt") String popReceipt, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - - @Delete("/{queueName}/messages/{messageid}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase deleteSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @PathParam("messageid") String messageid, - @QueryParam("popreceipt") String popReceipt, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - - @Delete("/{queueName}/messages/{messageid}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response deleteNoCustomHeadersSync(@HostParam("url") String url, @PathParam("queueName") String queueName, - @PathParam("messageid") String messageid, @QueryParam("popreceipt") String popReceipt, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - } - - /** - * The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message - * operation updates the visibility timeout of a message. You can also use this operation to update the contents of - * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the - * encoded message can be up to 64KB in size. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueMessage A Message object which can be stored in a Queue. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateWithResponseAsync(String queueName, String messageid, - String popReceipt, int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage) { - return FluxUtil - .withContext(context -> updateWithResponseAsync(queueName, messageid, popReceipt, visibilitytimeout, - timeout, requestId, queueMessage, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message - * operation updates the visibility timeout of a message. You can also use this operation to update the contents of - * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the - * encoded message can be up to 64KB in size. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueMessage A Message object which can be stored in a Queue. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateWithResponseAsync(String queueName, String messageid, - String popReceipt, int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage, - Context context) { - final String accept = "application/xml"; - return service - .update(this.client.getUrl(), queueName, messageid, popReceipt, visibilitytimeout, timeout, - this.client.getVersion(), requestId, queueMessage, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message - * operation updates the visibility timeout of a message. You can also use this operation to update the contents of - * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the - * encoded message can be up to 64KB in size. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueMessage A Message object which can be stored in a Queue. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateAsync(String queueName, String messageid, String popReceipt, int visibilitytimeout, - Integer timeout, String requestId, QueueMessage queueMessage) { - return updateWithResponseAsync(queueName, messageid, popReceipt, visibilitytimeout, timeout, requestId, - queueMessage).onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); + Response deleteSync(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + @PathParam("messageId") String messageId, @QueryParam("popreceipt") String popReceipt, + RequestOptions requestOptions, Context context); } /** - * The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message - * operation updates the visibility timeout of a message. You can also use this operation to update the contents of - * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the - * encoded message can be up to 64KB in size. + * Updates the visibility timeout of a message. This operation can also be used to update the contents of a message. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/xml".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     MessageText: String (Required)
+     * }
+     * }
+     * 
* - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueMessage A Message object which can be stored in a Queue. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateAsync(String queueName, String messageid, String popReceipt, int visibilitytimeout, - Integer timeout, String requestId, QueueMessage queueMessage, Context context) { - return updateWithResponseAsync(queueName, messageid, popReceipt, visibilitytimeout, timeout, requestId, - queueMessage, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message - * operation updates the visibility timeout of a message. You can also use this operation to update the contents of - * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the - * encoded message can be up to 64KB in size. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueMessage A Message object which can be stored in a Queue. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param messageId The ID of the queue message. + * @param popReceipt An opaque value required to delete the message. If deletion fails using this + * PopReceipt then the message has been dequeued by another client. + * @param visibilityTimeout Specifies the new visibility timeout value, in seconds, relative to server time. A + * specified value must be + * larger than or equal to 1 second, and cannot be larger than 7 days. The visibility timeout of a message + * can be set to a value later than the expiry time. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateNoCustomHeadersWithResponseAsync(String queueName, String messageid, - String popReceipt, int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage) { + public Mono> updateWithResponseAsync(String messageId, String popReceipt, int visibilityTimeout, + RequestOptions requestOptions) { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/xml"); + } + }); return FluxUtil - .withContext(context -> updateNoCustomHeadersWithResponseAsync(queueName, messageid, popReceipt, - visibilitytimeout, timeout, requestId, queueMessage, context)) + .withContext(context -> service.update(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + messageId, popReceipt, visibilityTimeout, requestOptionsLocal, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message - * operation updates the visibility timeout of a message. You can also use this operation to update the contents of - * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the - * encoded message can be up to 64KB in size. + * Updates the visibility timeout of a message. This operation can also be used to update the contents of a message. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/xml".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     MessageText: String (Required)
+     * }
+     * }
+     * 
* - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueMessage A Message object which can be stored in a Queue. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateNoCustomHeadersWithResponseAsync(String queueName, String messageid, - String popReceipt, int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage, - Context context) { - final String accept = "application/xml"; - return service - .updateNoCustomHeaders(this.client.getUrl(), queueName, messageid, popReceipt, visibilitytimeout, timeout, - this.client.getVersion(), requestId, queueMessage, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message - * operation updates the visibility timeout of a message. You can also use this operation to update the contents of - * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the - * encoded message can be up to 64KB in size. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueMessage A Message object which can be stored in a Queue. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase updateWithResponse(String queueName, String messageid, - String popReceipt, int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage, - Context context) { - try { - final String accept = "application/xml"; - return service.updateSync(this.client.getUrl(), queueName, messageid, popReceipt, visibilitytimeout, - timeout, this.client.getVersion(), requestId, queueMessage, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message - * operation updates the visibility timeout of a message. You can also use this operation to update the contents of - * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the - * encoded message can be up to 64KB in size. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueMessage A Message object which can be stored in a Queue. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal 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 update(String queueName, String messageid, String popReceipt, int visibilitytimeout, Integer timeout, - String requestId, QueueMessage queueMessage) { - updateWithResponse(queueName, messageid, popReceipt, visibilitytimeout, timeout, requestId, queueMessage, - Context.NONE); - } - - /** - * The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message - * operation updates the visibility timeout of a message. You can also use this operation to update the contents of - * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the - * encoded message can be up to 64KB in size. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueMessage A Message object which can be stored in a Queue. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param messageId The ID of the queue message. + * @param popReceipt An opaque value required to delete the message. If deletion fails using this + * PopReceipt then the message has been dequeued by another client. + * @param visibilityTimeout Specifies the new visibility timeout value, in seconds, relative to server time. A + * specified value must be + * larger than or equal to 1 second, and cannot be larger than 7 days. The visibility timeout of a message + * can be set to a value later than the expiry time. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateNoCustomHeadersWithResponse(String queueName, String messageid, String popReceipt, - int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage, Context context) { + public Response updateWithResponse(String messageId, String popReceipt, int visibilityTimeout, + RequestOptions requestOptions) { try { - final String accept = "application/xml"; - return service.updateNoCustomHeadersSync(this.client.getUrl(), queueName, messageid, popReceipt, - visibilitytimeout, timeout, this.client.getVersion(), requestId, queueMessage, accept, context); + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null + && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/xml"); + } + }); + return service.updateSync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), messageId, + popReceipt, visibilityTimeout, requestOptionsLocal, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * The Delete operation deletes the specified message. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithResponseAsync(String queueName, String messageid, - String popReceipt, Integer timeout, String requestId) { - return FluxUtil - .withContext( - context -> deleteWithResponseAsync(queueName, messageid, popReceipt, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Delete operation deletes the specified message. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithResponseAsync(String queueName, String messageid, - String popReceipt, Integer timeout, String requestId, Context context) { - final String accept = "application/xml"; - return service - .delete(this.client.getUrl(), queueName, messageid, popReceipt, timeout, this.client.getVersion(), - requestId, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Delete operation deletes the specified message. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteAsync(String queueName, String messageid, String popReceipt, Integer timeout, - String requestId) { - return deleteWithResponseAsync(queueName, messageid, popReceipt, timeout, requestId) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * The Delete operation deletes the specified message. + * Deletes the specified message. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteAsync(String queueName, String messageid, String popReceipt, Integer timeout, - String requestId, Context context) { - return deleteWithResponseAsync(queueName, messageid, popReceipt, timeout, requestId, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * The Delete operation deletes the specified message. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param messageId The ID of the queue message. + * @param popReceipt An opaque value required to delete the message. If deletion fails using this + * PopReceipt then the message has been dequeued by another client. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteNoCustomHeadersWithResponseAsync(String queueName, String messageid, - String popReceipt, Integer timeout, String requestId) { + public Mono> deleteWithResponseAsync(String messageId, String popReceipt, + RequestOptions requestOptions) { return FluxUtil - .withContext(context -> deleteNoCustomHeadersWithResponseAsync(queueName, messageid, popReceipt, timeout, - requestId, context)) + .withContext(context -> service.delete(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + messageId, popReceipt, requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * The Delete operation deletes the specified message. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteNoCustomHeadersWithResponseAsync(String queueName, String messageid, - String popReceipt, Integer timeout, String requestId, Context context) { - final String accept = "application/xml"; - return service - .deleteNoCustomHeaders(this.client.getUrl(), queueName, messageid, popReceipt, timeout, - this.client.getVersion(), requestId, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Delete operation deletes the specified message. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase deleteWithResponse(String queueName, String messageid, - String popReceipt, Integer timeout, String requestId, Context context) { - try { - final String accept = "application/xml"; - return service.deleteSync(this.client.getUrl(), queueName, messageid, popReceipt, timeout, - this.client.getVersion(), requestId, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * The Delete operation deletes the specified message. - * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal 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 queueName, String messageid, String popReceipt, Integer timeout, String requestId) { - deleteWithResponse(queueName, messageid, popReceipt, timeout, requestId, Context.NONE); - } - - /** - * The Delete operation deletes the specified message. + * Deletes the specified message. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} * - * @param queueName The queue name. - * @param messageid The message ID name. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get - * Messages or Update Message operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param messageId The ID of the queue message. + * @param popReceipt An opaque value required to delete the message. If deletion fails using this + * PopReceipt then the message has been dequeued by another client. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteNoCustomHeadersWithResponse(String queueName, String messageid, String popReceipt, - Integer timeout, String requestId, Context context) { + public Response deleteWithResponse(String messageId, String popReceipt, RequestOptions requestOptions) { try { - final String accept = "application/xml"; - return service.deleteNoCustomHeadersSync(this.client.getUrl(), queueName, messageid, popReceipt, timeout, - this.client.getVersion(), requestId, accept, context); + return service.deleteSync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), messageId, + popReceipt, requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java index 3e17b2d41e9a..67eebe36dd91 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.implementation; import com.azure.core.annotation.BodyParam; @@ -10,27 +10,23 @@ import com.azure.core.annotation.HeaderParam; 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.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.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.storage.queue.implementation.models.MessagesClearHeaders; -import com.azure.storage.queue.implementation.models.MessagesDequeueHeaders; -import com.azure.storage.queue.implementation.models.MessagesEnqueueHeaders; -import com.azure.storage.queue.implementation.models.MessagesPeekHeaders; -import com.azure.storage.queue.implementation.models.PeekedMessageItemInternalWrapper; -import com.azure.storage.queue.implementation.models.QueueMessage; -import com.azure.storage.queue.implementation.models.QueueMessageItemInternalWrapper; +import com.azure.storage.queue.QueueServiceVersion; import com.azure.storage.queue.implementation.models.QueueStorageExceptionInternal; -import com.azure.storage.queue.implementation.models.SendMessageResultWrapper; import com.azure.storage.queue.implementation.util.ModelHelper; import reactor.core.publisher.Mono; @@ -59,6 +55,19 @@ public final class MessagesImpl { this.client = client; } + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public QueueServiceVersion getServiceVersion() { + try { + return client.getServiceVersion(); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } + } + /** * The interface defining all the services for AzureQueueStorageMessages to be used by the proxy service to perform * REST calls. @@ -67,1250 +76,485 @@ public final class MessagesImpl { @ServiceInterface(name = "AzureQueueStorageMessages") public interface MessagesService { - @Get("/{queueName}/messages") + @Get("/messages") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> dequeue( - @HostParam("url") String url, @PathParam("queueName") String queueName, - @QueryParam("numofmessages") Integer numberOfMessages, - @QueryParam("visibilitytimeout") Integer visibilitytimeout, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + Mono> dequeue(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/{queueName}/messages") + @Get("/messages") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> dequeueNoCustomHeaders(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("numofmessages") Integer numberOfMessages, - @QueryParam("visibilitytimeout") Integer visibilitytimeout, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - - @Get("/{queueName}/messages") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase dequeueSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("numofmessages") Integer numberOfMessages, - @QueryParam("visibilitytimeout") Integer visibilitytimeout, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - - @Get("/{queueName}/messages") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response dequeueNoCustomHeadersSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("numofmessages") Integer numberOfMessages, - @QueryParam("visibilitytimeout") Integer visibilitytimeout, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - - @Delete("/{queueName}/messages") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> clear(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + Response dequeueSync(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Delete("/{queueName}/messages") + @Delete("/messages") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> clearNoCustomHeaders(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + Mono> clear(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + RequestOptions requestOptions, Context context); - @Delete("/{queueName}/messages") + @Delete("/messages") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase clearSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + Response clearSync(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + RequestOptions requestOptions, Context context); - @Delete("/{queueName}/messages") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response clearNoCustomHeadersSync(@HostParam("url") String url, @PathParam("queueName") String queueName, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Post("/{queueName}/messages") - @ExpectedResponses({ 201 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> enqueue(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("visibilitytimeout") Integer visibilitytimeout, - @QueryParam("messagettl") Integer messageTimeToLive, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueMessage queueMessage, @HeaderParam("Accept") String accept, - Context context); - - @Post("/{queueName}/messages") - @ExpectedResponses({ 201 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> enqueueNoCustomHeaders(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("visibilitytimeout") Integer visibilitytimeout, - @QueryParam("messagettl") Integer messageTimeToLive, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueMessage queueMessage, @HeaderParam("Accept") String accept, - Context context); - - @Post("/{queueName}/messages") + @Post("/messages") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase enqueueSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("visibilitytimeout") Integer visibilitytimeout, - @QueryParam("messagettl") Integer messageTimeToLive, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueMessage queueMessage, @HeaderParam("Accept") String accept, - Context context); + Mono> enqueue(@HostParam("url") String url, + @HeaderParam("Content-Type") String contentType, @HeaderParam("x-ms-version") String xMsVersion, + @HeaderParam("Accept") String accept, @BodyParam("application/xml") BinaryData queueMessage, + RequestOptions requestOptions, Context context); - @Post("/{queueName}/messages") + @Post("/messages") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response enqueueNoCustomHeadersSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("visibilitytimeout") Integer visibilitytimeout, - @QueryParam("messagettl") Integer messageTimeToLive, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueMessage queueMessage, @HeaderParam("Accept") String accept, - Context context); + Response enqueueSync(@HostParam("url") String url, @HeaderParam("Content-Type") String contentType, + @HeaderParam("x-ms-version") String xMsVersion, @HeaderParam("Accept") String accept, + @BodyParam("application/xml") BinaryData queueMessage, RequestOptions requestOptions, Context context); - @Get("/{queueName}/messages") + @Get("/messages?peekonly=true") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> peek(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("peekonly") String peekonly, - @QueryParam("numofmessages") Integer numberOfMessages, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + Mono> peek(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - @Get("/{queueName}/messages") + @Get("/messages?peekonly=true") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> peekNoCustomHeaders(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("peekonly") String peekonly, - @QueryParam("numofmessages") Integer numberOfMessages, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - - @Get("/{queueName}/messages") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase peekSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("peekonly") String peekonly, - @QueryParam("numofmessages") Integer numberOfMessages, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - - @Get("/{queueName}/messages") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response peekNoCustomHeadersSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("peekonly") String peekonly, - @QueryParam("numofmessages") Integer numberOfMessages, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * The Dequeue operation retrieves one or more messages from the front of the queue. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Get Messages on a Queue along with {@link ResponseBase} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> dequeueWithResponseAsync( - String queueName, Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId) { - return FluxUtil - .withContext(context -> dequeueWithResponseAsync(queueName, numberOfMessages, visibilitytimeout, timeout, - requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Dequeue operation retrieves one or more messages from the front of the queue. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Get Messages on a Queue along with {@link ResponseBase} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> dequeueWithResponseAsync( - String queueName, Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId, - Context context) { + Response peekSync(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * Retrieves one or more messages from the front of the queue. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
numofmessagesIntegerNoA nonzero integer value that specifies the number of + * messages to + * retrieve from the queue, up to a maximum of 32. If fewer are visible, the + * visible messages are returned. By default, a single message is retrieved from + * the queue with this operation.
visibilitytimeoutIntegerNoSpecifies the new visibility timeout value, in + * seconds, relative to server time. A specified value must be + * larger than or equal to 1 second, and cannot be larger than 7 days. The visibility timeout of a message + * can be set to a value later than the expiry time.
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     QueueMessage (Required): [
+     *          (Required){
+     *             MessageId: String (Required)
+     *             InsertionTime: DateTimeRfc1123 (Required)
+     *             ExpirationTime: DateTimeRfc1123 (Required)
+     *             PopReceipt: String (Required)
+     *             TimeNextVisible: DateTimeRfc1123 (Required)
+     *             DequeueCount: long (Required)
+     *             MessageText: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response of receive messages along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> dequeueWithResponseAsync(RequestOptions requestOptions) { final String accept = "application/xml"; - return service - .dequeue(this.client.getUrl(), queueName, numberOfMessages, visibilitytimeout, timeout, - this.client.getVersion(), requestId, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Dequeue operation retrieves one or more messages from the front of the queue. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Get Messages on a Queue on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono dequeueAsync(String queueName, Integer numberOfMessages, - Integer visibilitytimeout, Integer timeout, String requestId) { - return dequeueWithResponseAsync(queueName, numberOfMessages, visibilitytimeout, timeout, requestId) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The Dequeue operation retrieves one or more messages from the front of the queue. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Get Messages on a Queue on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono dequeueAsync(String queueName, Integer numberOfMessages, - Integer visibilitytimeout, Integer timeout, String requestId, Context context) { - return dequeueWithResponseAsync(queueName, numberOfMessages, visibilitytimeout, timeout, requestId, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The Dequeue operation retrieves one or more messages from the front of the queue. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Get Messages on a Queue along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> dequeueNoCustomHeadersWithResponseAsync(String queueName, - Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId) { return FluxUtil - .withContext(context -> dequeueNoCustomHeadersWithResponseAsync(queueName, numberOfMessages, - visibilitytimeout, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Dequeue operation retrieves one or more messages from the front of the queue. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Get Messages on a Queue along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> dequeueNoCustomHeadersWithResponseAsync(String queueName, - Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId, Context context) { - final String accept = "application/xml"; - return service - .dequeueNoCustomHeaders(this.client.getUrl(), queueName, numberOfMessages, visibilitytimeout, timeout, - this.client.getVersion(), requestId, accept, context) + .withContext(context -> service.dequeue(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + accept, requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * The Dequeue operation retrieves one or more messages from the front of the queue. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Get Messages on a Queue along with {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase dequeueWithResponse(String queueName, - Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId, Context context) { + * Retrieves one or more messages from the front of the queue. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
numofmessagesIntegerNoA nonzero integer value that specifies the number of + * messages to + * retrieve from the queue, up to a maximum of 32. If fewer are visible, the + * visible messages are returned. By default, a single message is retrieved from + * the queue with this operation.
visibilitytimeoutIntegerNoSpecifies the new visibility timeout value, in + * seconds, relative to server time. A specified value must be + * larger than or equal to 1 second, and cannot be larger than 7 days. The visibility timeout of a message + * can be set to a value later than the expiry time.
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     QueueMessage (Required): [
+     *          (Required){
+     *             MessageId: String (Required)
+     *             InsertionTime: DateTimeRfc1123 (Required)
+     *             ExpirationTime: DateTimeRfc1123 (Required)
+     *             PopReceipt: String (Required)
+     *             TimeNextVisible: DateTimeRfc1123 (Required)
+     *             DequeueCount: long (Required)
+     *             MessageText: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response of receive messages along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response dequeueWithResponse(RequestOptions requestOptions) { try { final String accept = "application/xml"; - return service.dequeueSync(this.client.getUrl(), queueName, numberOfMessages, visibilitytimeout, timeout, - this.client.getVersion(), requestId, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * The Dequeue operation retrieves one or more messages from the front of the queue. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Get Messages on a Queue. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public QueueMessageItemInternalWrapper dequeue(String queueName, Integer numberOfMessages, - Integer visibilitytimeout, Integer timeout, String requestId) { - try { - return dequeueWithResponse(queueName, numberOfMessages, visibilitytimeout, timeout, requestId, Context.NONE) - .getValue(); + return service.dequeueSync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * The Dequeue operation retrieves one or more messages from the front of the queue. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server - * time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be - * larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility - * timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Get Messages on a Queue along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response dequeueNoCustomHeadersWithResponse(String queueName, - Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId, Context context) { - try { - final String accept = "application/xml"; - return service.dequeueNoCustomHeadersSync(this.client.getUrl(), queueName, numberOfMessages, - visibilitytimeout, timeout, this.client.getVersion(), requestId, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * The Clear operation deletes all messages from the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> clearWithResponseAsync(String queueName, Integer timeout, - String requestId) { - return FluxUtil.withContext(context -> clearWithResponseAsync(queueName, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Clear operation deletes all messages from the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> clearWithResponseAsync(String queueName, Integer timeout, - String requestId, Context context) { - final String accept = "application/xml"; - return service - .clear(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Clear operation deletes all messages from the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono clearAsync(String queueName, Integer timeout, String requestId) { - return clearWithResponseAsync(queueName, timeout, requestId) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * The Clear operation deletes all messages from the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono clearAsync(String queueName, Integer timeout, String requestId, Context context) { - return clearWithResponseAsync(queueName, timeout, requestId, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * The Clear operation deletes all messages from the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * Deletes all messages from the specified queue. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> clearNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, - String requestId) { + public Mono> clearWithResponseAsync(RequestOptions requestOptions) { return FluxUtil - .withContext(context -> clearNoCustomHeadersWithResponseAsync(queueName, timeout, requestId, context)) + .withContext(context -> service.clear(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * The Clear operation deletes all messages from the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> clearNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, - String requestId, Context context) { - final String accept = "application/xml"; - return service - .clearNoCustomHeaders(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, accept, - context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Clear operation deletes all messages from the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase clearWithResponse(String queueName, Integer timeout, - String requestId, Context context) { - try { - final String accept = "application/xml"; - return service.clearSync(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, - accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * The Clear operation deletes all messages from the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal 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 clear(String queueName, Integer timeout, String requestId) { - clearWithResponse(queueName, timeout, requestId, Context.NONE); - } - - /** - * The Clear operation deletes all messages from the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * Deletes all messages from the specified queue. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response clearNoCustomHeadersWithResponse(String queueName, Integer timeout, String requestId, - Context context) { + public Response clearWithResponse(RequestOptions requestOptions) { try { - final String accept = "application/xml"; - return service.clearNoCustomHeadersSync(this.client.getUrl(), queueName, timeout, this.client.getVersion(), - requestId, accept, context); + return service.clearSync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), requestOptions, + Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be - * specified to make the message invisible until the visibility timeout expires. A message must be in a format that - * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for - * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * - * @param queueName The queue name. - * @param queueMessage A Message object which can be stored in a Queue. - * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or - * later. If not specified, the default value is 0. Specifies the new visibility timeout value, in seconds, relative - * to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility - * timeout of a message cannot be set to a value later than the expiry time. visibilitytimeout should be set to a - * value smaller than the time-to-live value. - * @param messageTimeToLive Optional. Specifies the time-to-live interval for the message, in seconds. Prior to - * version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum - * time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this - * parameter is omitted, the default time-to-live is 7 days. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Put Message on a Queue along with {@link ResponseBase} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> enqueueWithResponseAsync( - String queueName, QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, - Integer timeout, String requestId) { - return FluxUtil - .withContext(context -> enqueueWithResponseAsync(queueName, queueMessage, visibilitytimeout, - messageTimeToLive, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be - * specified to make the message invisible until the visibility timeout expires. A message must be in a format that - * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for - * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * - * @param queueName The queue name. - * @param queueMessage A Message object which can be stored in a Queue. - * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or - * later. If not specified, the default value is 0. Specifies the new visibility timeout value, in seconds, relative - * to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility - * timeout of a message cannot be set to a value later than the expiry time. visibilitytimeout should be set to a - * value smaller than the time-to-live value. - * @param messageTimeToLive Optional. Specifies the time-to-live interval for the message, in seconds. Prior to - * version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum - * time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this - * parameter is omitted, the default time-to-live is 7 days. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Put Message on a Queue along with {@link ResponseBase} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> enqueueWithResponseAsync( - String queueName, QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, - Integer timeout, String requestId, Context context) { + * Adds a new message to the back of the message queue. A visibility timeout + * can also be specified to make the message invisible until the visibility timeout + * expires. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
visibilitytimeoutIntegerNoSpecifies the new visibility timeout value, in + * seconds, relative to server time. A specified value must be + * larger than or equal to 1 second, and cannot be larger than 7 days. The visibility timeout of a message + * can be set to a value later than the expiry time.
messagettlIntegerNoSpecifies the time-to-live interval for the message, in + * seconds. + * Prior to version 2017-07-29, the maximum time-to-live allowed is 7 days. For + * version 2017-07-29 or later, the maximum time-to-live can be any positive + * number, as well as -1 indicating that the message does not expire. If this + * parameter is omitted, the default time-to-live is 7 days.
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     MessageText: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     QueueMessage (Required): [
+     *          (Required){
+     *             MessageId: String (Required)
+     *             InsertionTime: DateTimeRfc1123 (Required)
+     *             ExpirationTime: DateTimeRfc1123 (Required)
+     *             PopReceipt: String (Required)
+     *             TimeNextVisible: DateTimeRfc1123 (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param queueMessage The queue message. The message must be in a format that can be included in an XML request + * with UTF-8 + * encoding. The encoded message can be up to 64 KB in size. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response of send message along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> enqueueWithResponseAsync(BinaryData queueMessage, RequestOptions requestOptions) { + final String contentType = "application/xml"; final String accept = "application/xml"; - return service - .enqueue(this.client.getUrl(), queueName, visibilitytimeout, messageTimeToLive, timeout, - this.client.getVersion(), requestId, queueMessage, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be - * specified to make the message invisible until the visibility timeout expires. A message must be in a format that - * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for - * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * - * @param queueName The queue name. - * @param queueMessage A Message object which can be stored in a Queue. - * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or - * later. If not specified, the default value is 0. Specifies the new visibility timeout value, in seconds, relative - * to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility - * timeout of a message cannot be set to a value later than the expiry time. visibilitytimeout should be set to a - * value smaller than the time-to-live value. - * @param messageTimeToLive Optional. Specifies the time-to-live interval for the message, in seconds. Prior to - * version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum - * time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this - * parameter is omitted, the default time-to-live is 7 days. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Put Message on a Queue on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono enqueueAsync(String queueName, QueueMessage queueMessage, - Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, String requestId) { - return enqueueWithResponseAsync(queueName, queueMessage, visibilitytimeout, messageTimeToLive, timeout, - requestId).onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be - * specified to make the message invisible until the visibility timeout expires. A message must be in a format that - * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for - * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * - * @param queueName The queue name. - * @param queueMessage A Message object which can be stored in a Queue. - * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or - * later. If not specified, the default value is 0. Specifies the new visibility timeout value, in seconds, relative - * to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility - * timeout of a message cannot be set to a value later than the expiry time. visibilitytimeout should be set to a - * value smaller than the time-to-live value. - * @param messageTimeToLive Optional. Specifies the time-to-live interval for the message, in seconds. Prior to - * version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum - * time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this - * parameter is omitted, the default time-to-live is 7 days. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Put Message on a Queue on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono enqueueAsync(String queueName, QueueMessage queueMessage, - Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, String requestId, Context context) { - return enqueueWithResponseAsync(queueName, queueMessage, visibilitytimeout, messageTimeToLive, timeout, - requestId, context).onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be - * specified to make the message invisible until the visibility timeout expires. A message must be in a format that - * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for - * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * - * @param queueName The queue name. - * @param queueMessage A Message object which can be stored in a Queue. - * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or - * later. If not specified, the default value is 0. Specifies the new visibility timeout value, in seconds, relative - * to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility - * timeout of a message cannot be set to a value later than the expiry time. visibilitytimeout should be set to a - * value smaller than the time-to-live value. - * @param messageTimeToLive Optional. Specifies the time-to-live interval for the message, in seconds. Prior to - * version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum - * time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this - * parameter is omitted, the default time-to-live is 7 days. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Put Message on a Queue along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> enqueueNoCustomHeadersWithResponseAsync(String queueName, - QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, - String requestId) { return FluxUtil - .withContext(context -> enqueueNoCustomHeadersWithResponseAsync(queueName, queueMessage, visibilitytimeout, - messageTimeToLive, timeout, requestId, context)) + .withContext(context -> service.enqueue(this.client.getUrl(), contentType, + this.client.getServiceVersion().getVersion(), accept, queueMessage, requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be - * specified to make the message invisible until the visibility timeout expires. A message must be in a format that - * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for - * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * - * @param queueName The queue name. - * @param queueMessage A Message object which can be stored in a Queue. - * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or - * later. If not specified, the default value is 0. Specifies the new visibility timeout value, in seconds, relative - * to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility - * timeout of a message cannot be set to a value later than the expiry time. visibilitytimeout should be set to a - * value smaller than the time-to-live value. - * @param messageTimeToLive Optional. Specifies the time-to-live interval for the message, in seconds. Prior to - * version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum - * time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this - * parameter is omitted, the default time-to-live is 7 days. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Put Message on a Queue along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> enqueueNoCustomHeadersWithResponseAsync(String queueName, - QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, - String requestId, Context context) { - final String accept = "application/xml"; - return service - .enqueueNoCustomHeaders(this.client.getUrl(), queueName, visibilitytimeout, messageTimeToLive, timeout, - this.client.getVersion(), requestId, queueMessage, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be - * specified to make the message invisible until the visibility timeout expires. A message must be in a format that - * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for - * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * - * @param queueName The queue name. - * @param queueMessage A Message object which can be stored in a Queue. - * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or - * later. If not specified, the default value is 0. Specifies the new visibility timeout value, in seconds, relative - * to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility - * timeout of a message cannot be set to a value later than the expiry time. visibilitytimeout should be set to a - * value smaller than the time-to-live value. - * @param messageTimeToLive Optional. Specifies the time-to-live interval for the message, in seconds. Prior to - * version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum - * time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this - * parameter is omitted, the default time-to-live is 7 days. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Put Message on a Queue along with {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase enqueueWithResponse(String queueName, - QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, - String requestId, Context context) { + * Adds a new message to the back of the message queue. A visibility timeout + * can also be specified to make the message invisible until the visibility timeout + * expires. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
visibilitytimeoutIntegerNoSpecifies the new visibility timeout value, in + * seconds, relative to server time. A specified value must be + * larger than or equal to 1 second, and cannot be larger than 7 days. The visibility timeout of a message + * can be set to a value later than the expiry time.
messagettlIntegerNoSpecifies the time-to-live interval for the message, in + * seconds. + * Prior to version 2017-07-29, the maximum time-to-live allowed is 7 days. For + * version 2017-07-29 or later, the maximum time-to-live can be any positive + * number, as well as -1 indicating that the message does not expire. If this + * parameter is omitted, the default time-to-live is 7 days.
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     MessageText: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     QueueMessage (Required): [
+     *          (Required){
+     *             MessageId: String (Required)
+     *             InsertionTime: DateTimeRfc1123 (Required)
+     *             ExpirationTime: DateTimeRfc1123 (Required)
+     *             PopReceipt: String (Required)
+     *             TimeNextVisible: DateTimeRfc1123 (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param queueMessage The queue message. The message must be in a format that can be included in an XML request + * with UTF-8 + * encoding. The encoded message can be up to 64 KB in size. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response of send message along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response enqueueWithResponse(BinaryData queueMessage, RequestOptions requestOptions) { try { + final String contentType = "application/xml"; final String accept = "application/xml"; - return service.enqueueSync(this.client.getUrl(), queueName, visibilitytimeout, messageTimeToLive, timeout, - this.client.getVersion(), requestId, queueMessage, accept, context); + return service.enqueueSync(this.client.getUrl(), contentType, this.client.getServiceVersion().getVersion(), + accept, queueMessage, requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be - * specified to make the message invisible until the visibility timeout expires. A message must be in a format that - * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for - * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * - * @param queueName The queue name. - * @param queueMessage A Message object which can be stored in a Queue. - * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or - * later. If not specified, the default value is 0. Specifies the new visibility timeout value, in seconds, relative - * to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility - * timeout of a message cannot be set to a value later than the expiry time. visibilitytimeout should be set to a - * value smaller than the time-to-live value. - * @param messageTimeToLive Optional. Specifies the time-to-live interval for the message, in seconds. Prior to - * version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum - * time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this - * parameter is omitted, the default time-to-live is 7 days. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Put Message on a Queue. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SendMessageResultWrapper enqueue(String queueName, QueueMessage queueMessage, Integer visibilitytimeout, - Integer messageTimeToLive, Integer timeout, String requestId) { - try { - return enqueueWithResponse(queueName, queueMessage, visibilitytimeout, messageTimeToLive, timeout, - requestId, Context.NONE).getValue(); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be - * specified to make the message invisible until the visibility timeout expires. A message must be in a format that - * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for - * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * - * @param queueName The queue name. - * @param queueMessage A Message object which can be stored in a Queue. - * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or - * later. If not specified, the default value is 0. Specifies the new visibility timeout value, in seconds, relative - * to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility - * timeout of a message cannot be set to a value later than the expiry time. visibilitytimeout should be set to a - * value smaller than the time-to-live value. - * @param messageTimeToLive Optional. Specifies the time-to-live interval for the message, in seconds. Prior to - * version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum - * time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this - * parameter is omitted, the default time-to-live is 7 days. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Put Message on a Queue along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response enqueueNoCustomHeadersWithResponse(String queueName, - QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, - String requestId, Context context) { - try { - final String accept = "application/xml"; - return service.enqueueNoCustomHeadersSync(this.client.getUrl(), queueName, visibilitytimeout, - messageTimeToLive, timeout, this.client.getVersion(), requestId, queueMessage, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility - * of the message. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Peek Messages on a Queue along with {@link ResponseBase} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - peekWithResponseAsync(String queueName, Integer numberOfMessages, Integer timeout, String requestId) { - return FluxUtil - .withContext(context -> peekWithResponseAsync(queueName, numberOfMessages, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility - * of the message. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Peek Messages on a Queue along with {@link ResponseBase} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> peekWithResponseAsync( - String queueName, Integer numberOfMessages, Integer timeout, String requestId, Context context) { - final String peekonly = "true"; + * Retrieves one or more messages from the front of the queue, but does not alter the visibility of the message. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
numofmessagesIntegerNoA nonzero integer value that specifies the number of + * messages to + * retrieve from the queue, up to a maximum of 32. If fewer are visible, the + * visible messages are returned. By default, a single message is retrieved from + * the queue with this operation.
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     QueueMessage (Required): [
+     *          (Required){
+     *             MessageId: String (Required)
+     *             InsertionTime: DateTimeRfc1123 (Required)
+     *             ExpirationTime: DateTimeRfc1123 (Required)
+     *             DequeueCount: long (Required)
+     *             MessageText: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response of peek messages along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> peekWithResponseAsync(RequestOptions requestOptions) { final String accept = "application/xml"; - return service - .peek(this.client.getUrl(), queueName, peekonly, numberOfMessages, timeout, this.client.getVersion(), - requestId, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility - * of the message. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Peek Messages on a Queue on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono peekAsync(String queueName, Integer numberOfMessages, Integer timeout, - String requestId) { - return peekWithResponseAsync(queueName, numberOfMessages, timeout, requestId) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility - * of the message. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Peek Messages on a Queue on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono peekAsync(String queueName, Integer numberOfMessages, Integer timeout, - String requestId, Context context) { - return peekWithResponseAsync(queueName, numberOfMessages, timeout, requestId, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility - * of the message. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Peek Messages on a Queue along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> peekNoCustomHeadersWithResponseAsync(String queueName, - Integer numberOfMessages, Integer timeout, String requestId) { - return FluxUtil.withContext( - context -> peekNoCustomHeadersWithResponseAsync(queueName, numberOfMessages, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility - * of the message. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Peek Messages on a Queue along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> peekNoCustomHeadersWithResponseAsync(String queueName, - Integer numberOfMessages, Integer timeout, String requestId, Context context) { - final String peekonly = "true"; - final String accept = "application/xml"; - return service - .peekNoCustomHeaders(this.client.getUrl(), queueName, peekonly, numberOfMessages, timeout, - this.client.getVersion(), requestId, accept, context) + return FluxUtil + .withContext(context -> service.peek(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + accept, requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility - * of the message. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Peek Messages on a Queue along with {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase peekWithResponse(String queueName, - Integer numberOfMessages, Integer timeout, String requestId, Context context) { - try { - final String peekonly = "true"; - final String accept = "application/xml"; - return service.peekSync(this.client.getUrl(), queueName, peekonly, numberOfMessages, timeout, - this.client.getVersion(), requestId, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility - * of the message. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Peek Messages on a Queue. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PeekedMessageItemInternalWrapper peek(String queueName, Integer numberOfMessages, Integer timeout, - String requestId) { - try { - return peekWithResponse(queueName, numberOfMessages, timeout, requestId, Context.NONE).getValue(); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility - * of the message. - * - * @param queueName The queue name. - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from - * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single - * message is retrieved from the queue with this operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling Peek Messages on a Queue along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response peekNoCustomHeadersWithResponse(String queueName, - Integer numberOfMessages, Integer timeout, String requestId, Context context) { + * Retrieves one or more messages from the front of the queue, but does not alter the visibility of the message. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
numofmessagesIntegerNoA nonzero integer value that specifies the number of + * messages to + * retrieve from the queue, up to a maximum of 32. If fewer are visible, the + * visible messages are returned. By default, a single message is retrieved from + * the queue with this operation.
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     QueueMessage (Required): [
+     *          (Required){
+     *             MessageId: String (Required)
+     *             InsertionTime: DateTimeRfc1123 (Required)
+     *             ExpirationTime: DateTimeRfc1123 (Required)
+     *             DequeueCount: long (Required)
+     *             MessageText: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response of peek messages along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response peekWithResponse(RequestOptions requestOptions) { try { - final String peekonly = "true"; final String accept = "application/xml"; - return service.peekNoCustomHeadersSync(this.client.getUrl(), queueName, peekonly, numberOfMessages, timeout, - this.client.getVersion(), requestId, accept, context); + return service.peekSync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java index 0f654704faa3..7efa0cc2b32e 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java @@ -1,39 +1,33 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.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.Host; import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; import com.azure.core.annotation.Put; -import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceInterface; import com.azure.core.annotation.ServiceMethod; import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.storage.queue.implementation.models.QueueSignedIdentifierWrapper; +import com.azure.storage.queue.QueueServiceVersion; import com.azure.storage.queue.implementation.models.QueueStorageExceptionInternal; -import com.azure.storage.queue.implementation.models.QueuesCreateHeaders; -import com.azure.storage.queue.implementation.models.QueuesDeleteHeaders; -import com.azure.storage.queue.implementation.models.QueuesGetAccessPolicyHeaders; -import com.azure.storage.queue.implementation.models.QueuesGetPropertiesHeaders; -import com.azure.storage.queue.implementation.models.QueuesSetAccessPolicyHeaders; -import com.azure.storage.queue.implementation.models.QueuesSetMetadataHeaders; import com.azure.storage.queue.implementation.util.ModelHelper; -import com.azure.storage.queue.models.QueueSignedIdentifier; -import java.util.List; -import java.util.Map; import reactor.core.publisher.Mono; /** @@ -61,6 +55,19 @@ public final class QueuesImpl { this.client = client; } + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public QueueServiceVersion getServiceVersion() { + try { + return client.getServiceVersion(); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } + } + /** * The interface defining all the services for AzureQueueStorageQueues to be used by the proxy service to perform * REST calls. @@ -69,1605 +76,570 @@ public final class QueuesImpl { @ServiceInterface(name = "AzureQueueStorageQueues") public interface QueuesService { - @Put("/{queueName}") - @ExpectedResponses({ 201, 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> create(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Put("/{queueName}") + @Put("/") @ExpectedResponses({ 201, 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> createNoCustomHeaders(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); + Mono> create(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + RequestOptions requestOptions, Context context); - @Put("/{queueName}") + @Put("/") @ExpectedResponses({ 201, 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase createSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); + Response createSync(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + RequestOptions requestOptions, Context context); - @Put("/{queueName}") - @ExpectedResponses({ 201, 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response createNoCustomHeadersSync(@HostParam("url") String url, @PathParam("queueName") String queueName, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - - @Delete("/{queueName}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> delete(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - - @Delete("/{queueName}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> deleteNoCustomHeaders(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - - @Delete("/{queueName}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase deleteSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - - @Delete("/{queueName}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response deleteNoCustomHeadersSync(@HostParam("url") String url, @PathParam("queueName") String queueName, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Get("/{queueName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> getProperties(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Get("/{queueName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> getPropertiesNoCustomHeaders(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Get("/{queueName}") + @Get("?comp=metadata") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase getPropertiesSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); + Mono> getProperties(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + RequestOptions requestOptions, Context context); - @Get("/{queueName}") + @Get("?comp=metadata") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response getPropertiesNoCustomHeadersSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); + Response getPropertiesSync(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + RequestOptions requestOptions, Context context); - @Put("/{queueName}") + @Delete("/") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> setMetadata(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + Mono> delete(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + RequestOptions requestOptions, Context context); - @Put("/{queueName}") + @Delete("/") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> setMetadataNoCustomHeaders(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + Response deleteSync(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + RequestOptions requestOptions, Context context); - @Put("/{queueName}") + @Put("?comp=metadata") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase setMetadataSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + Mono> setMetadata(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + RequestOptions requestOptions, Context context); - @Put("/{queueName}") + @Put("?comp=metadata") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response setMetadataNoCustomHeadersSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - - @Get("/{queueName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> getAccessPolicy( - @HostParam("url") String url, @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Get("/{queueName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> getAccessPolicyNoCustomHeaders(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); + Response setMetadataSync(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + RequestOptions requestOptions, Context context); - @Get("/{queueName}") + @Get("?comp=acl") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase getAccessPolicySync( - @HostParam("url") String url, @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); + Mono> getAccessPolicy(@HostParam("url") String url, + @HeaderParam("x-ms-version") String xMsVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); - @Get("/{queueName}") + @Get("?comp=acl") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response getAccessPolicyNoCustomHeadersSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Put("/{queueName}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> setAccessPolicy(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueSignedIdentifierWrapper queueAcl, @HeaderParam("Accept") String accept, - Context context); - - @Put("/{queueName}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> setAccessPolicyNoCustomHeaders(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueSignedIdentifierWrapper queueAcl, @HeaderParam("Accept") String accept, - Context context); + Response getAccessPolicySync(@HostParam("url") String url, + @HeaderParam("x-ms-version") String xMsVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); - @Put("/{queueName}") + @Put("?comp=acl") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase setAccessPolicySync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueSignedIdentifierWrapper queueAcl, @HeaderParam("Accept") String accept, - Context context); + Mono> setAccessPolicy(@HostParam("url") String url, + @HeaderParam("x-ms-version") String xMsVersion, RequestOptions requestOptions, Context context); - @Put("/{queueName}") + @Put("?comp=acl") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response setAccessPolicyNoCustomHeadersSync(@HostParam("url") String url, - @PathParam("queueName") String queueName, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueSignedIdentifierWrapper queueAcl, @HeaderParam("Accept") String accept, - Context context); - } - - /** - * creates a new queue under the given account. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createWithResponseAsync(String queueName, Integer timeout, - Map metadata, String requestId) { - return FluxUtil - .withContext(context -> createWithResponseAsync(queueName, timeout, metadata, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * creates a new queue under the given account. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createWithResponseAsync(String queueName, Integer timeout, - Map metadata, String requestId, Context context) { - final String accept = "application/xml"; - return service - .create(this.client.getUrl(), queueName, timeout, metadata, this.client.getVersion(), requestId, accept, - context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * creates a new queue under the given account. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createAsync(String queueName, Integer timeout, Map metadata, String requestId) { - return createWithResponseAsync(queueName, timeout, metadata, requestId) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * creates a new queue under the given account. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createAsync(String queueName, Integer timeout, Map metadata, String requestId, - Context context) { - return createWithResponseAsync(queueName, timeout, metadata, requestId, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * creates a new queue under the given account. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + Response setAccessPolicySync(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + RequestOptions requestOptions, Context context); + } + + /** + * Creates a new queue. If a queue with the same name already exists, the operation succeeds when the metadata + * is identical. If the metadata differs, the operation fails. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
x-ms-metaStringNoThe metadata headers.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, - Map metadata, String requestId) { + public Mono> createWithResponseAsync(RequestOptions requestOptions) { return FluxUtil - .withContext( - context -> createNoCustomHeadersWithResponseAsync(queueName, timeout, metadata, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * creates a new queue under the given account. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, - Map metadata, String requestId, Context context) { - final String accept = "application/xml"; - return service - .createNoCustomHeaders(this.client.getUrl(), queueName, timeout, metadata, this.client.getVersion(), - requestId, accept, context) + .withContext(context -> service.create(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * creates a new queue under the given account. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase createWithResponse(String queueName, Integer timeout, - Map metadata, String requestId, Context context) { - try { - final String accept = "application/xml"; - return service.createSync(this.client.getUrl(), queueName, timeout, metadata, this.client.getVersion(), - requestId, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * creates a new queue under the given account. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal 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 create(String queueName, Integer timeout, Map metadata, String requestId) { - createWithResponse(queueName, timeout, metadata, requestId, Context.NONE); - } - - /** - * creates a new queue under the given account. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * Creates a new queue. If a queue with the same name already exists, the operation succeeds when the metadata + * is identical. If the metadata differs, the operation fails. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
x-ms-metaStringNoThe metadata headers.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createNoCustomHeadersWithResponse(String queueName, Integer timeout, - Map metadata, String requestId, Context context) { + public Response createWithResponse(RequestOptions requestOptions) { try { - final String accept = "application/xml"; - return service.createNoCustomHeadersSync(this.client.getUrl(), queueName, timeout, metadata, - this.client.getVersion(), requestId, accept, context); + return service.createSync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * operation permanently deletes the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithResponseAsync(String queueName, Integer timeout, - String requestId) { - return FluxUtil.withContext(context -> deleteWithResponseAsync(queueName, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * operation permanently deletes the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithResponseAsync(String queueName, Integer timeout, - String requestId, Context context) { - final String accept = "application/xml"; - return service - .delete(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * operation permanently deletes the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteAsync(String queueName, Integer timeout, String requestId) { - return deleteWithResponseAsync(queueName, timeout, requestId) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * operation permanently deletes the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteAsync(String queueName, Integer timeout, String requestId, Context context) { - return deleteWithResponseAsync(queueName, timeout, requestId, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * operation permanently deletes the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * Returns all user-defined metadata and system properties for the specified queue. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, - String requestId) { + public Mono> getPropertiesWithResponseAsync(RequestOptions requestOptions) { return FluxUtil - .withContext(context -> deleteNoCustomHeadersWithResponseAsync(queueName, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * operation permanently deletes the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, - String requestId, Context context) { - final String accept = "application/xml"; - return service - .deleteNoCustomHeaders(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, - accept, context) + .withContext(context -> service.getProperties(this.client.getUrl(), + this.client.getServiceVersion().getVersion(), requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * operation permanently deletes the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase deleteWithResponse(String queueName, Integer timeout, - String requestId, Context context) { - try { - final String accept = "application/xml"; - return service.deleteSync(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, - accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * operation permanently deletes the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal 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 queueName, Integer timeout, String requestId) { - deleteWithResponse(queueName, timeout, requestId, Context.NONE); - } - - /** - * operation permanently deletes the specified queue. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * Returns all user-defined metadata and system properties for the specified queue. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteNoCustomHeadersWithResponse(String queueName, Integer timeout, String requestId, - Context context) { + public Response getPropertiesWithResponse(RequestOptions requestOptions) { try { - final String accept = "application/xml"; - return service.deleteNoCustomHeadersSync(this.client.getUrl(), queueName, timeout, this.client.getVersion(), - requestId, accept, context); + return service.getPropertiesSync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the - * queue as name-values pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPropertiesWithResponseAsync(String queueName, - Integer timeout, String requestId) { - return FluxUtil.withContext(context -> getPropertiesWithResponseAsync(queueName, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the - * queue as name-values pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPropertiesWithResponseAsync(String queueName, - Integer timeout, String requestId, Context context) { - final String comp = "metadata"; - final String accept = "application/xml"; - return service - .getProperties(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), requestId, accept, - context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the - * queue as name-values pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPropertiesAsync(String queueName, Integer timeout, String requestId) { - return getPropertiesWithResponseAsync(queueName, timeout, requestId) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the - * queue as name-values pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPropertiesAsync(String queueName, Integer timeout, String requestId, Context context) { - return getPropertiesWithResponseAsync(queueName, timeout, requestId, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the - * queue as name-values pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * Permanently deletes the specified queue. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, - String requestId) { + public Mono> deleteWithResponseAsync(RequestOptions requestOptions) { return FluxUtil - .withContext( - context -> getPropertiesNoCustomHeadersWithResponseAsync(queueName, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the - * queue as name-values pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, - String requestId, Context context) { - final String comp = "metadata"; - final String accept = "application/xml"; - return service - .getPropertiesNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), - requestId, accept, context) + .withContext(context -> service.delete(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the - * queue as name-values pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase getPropertiesWithResponse(String queueName, Integer timeout, - String requestId, Context context) { - try { - final String comp = "metadata"; - final String accept = "application/xml"; - return service.getPropertiesSync(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), - requestId, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the - * queue as name-values pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal 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 getProperties(String queueName, Integer timeout, String requestId) { - getPropertiesWithResponse(queueName, timeout, requestId, Context.NONE); - } - - /** - * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the - * queue as name-values pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * Permanently deletes the specified queue. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getPropertiesNoCustomHeadersWithResponse(String queueName, Integer timeout, String requestId, - Context context) { + public Response deleteWithResponse(RequestOptions requestOptions) { try { - final String comp = "metadata"; - final String accept = "application/xml"; - return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), queueName, comp, timeout, - this.client.getVersion(), requestId, accept, context); + return service.deleteSync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setMetadataWithResponseAsync(String queueName, - Integer timeout, Map metadata, String requestId) { - return FluxUtil - .withContext(context -> setMetadataWithResponseAsync(queueName, timeout, metadata, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setMetadataWithResponseAsync(String queueName, - Integer timeout, Map metadata, String requestId, Context context) { - final String comp = "metadata"; - final String accept = "application/xml"; - return service - .setMetadata(this.client.getUrl(), queueName, comp, timeout, metadata, this.client.getVersion(), requestId, - accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setMetadataAsync(String queueName, Integer timeout, Map metadata, - String requestId) { - return setMetadataWithResponseAsync(queueName, timeout, metadata, requestId) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setMetadataAsync(String queueName, Integer timeout, Map metadata, - String requestId, Context context) { - return setMetadataWithResponseAsync(queueName, timeout, metadata, requestId, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * Sets user-defined metadata for the specified queue. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
x-ms-metaStringNoThe metadata headers.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setMetadataNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, - Map metadata, String requestId) { - return FluxUtil.withContext( - context -> setMetadataNoCustomHeadersWithResponseAsync(queueName, timeout, metadata, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setMetadataNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, - Map metadata, String requestId, Context context) { - final String comp = "metadata"; - final String accept = "application/xml"; - return service - .setMetadataNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, metadata, - this.client.getVersion(), requestId, accept, context) + public Mono> setMetadataWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.setMetadata(this.client.getUrl(), + this.client.getServiceVersion().getVersion(), requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase setMetadataWithResponse(String queueName, Integer timeout, - Map metadata, String requestId, Context context) { - try { - final String comp = "metadata"; - final String accept = "application/xml"; - return service.setMetadataSync(this.client.getUrl(), queueName, comp, timeout, metadata, - this.client.getVersion(), requestId, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal 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 setMetadata(String queueName, Integer timeout, Map metadata, String requestId) { - setMetadataWithResponse(queueName, timeout, metadata, requestId, Context.NONE); - } - - /** - * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the - * response body. Note that metadata requested with this parameter must be stored in accordance with the naming - * restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata - * names must adhere to the naming conventions for C# identifiers. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * Sets user-defined metadata for the specified queue. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
x-ms-metaStringNoThe metadata headers.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response setMetadataNoCustomHeadersWithResponse(String queueName, Integer timeout, - Map metadata, String requestId, Context context) { + public Response setMetadataWithResponse(RequestOptions requestOptions) { try { - final String comp = "metadata"; - final String accept = "application/xml"; - return service.setMetadataNoCustomHeadersSync(this.client.getUrl(), queueName, comp, timeout, metadata, - this.client.getVersion(), requestId, accept, context); + return service.setMetadataSync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * returns details about any stored access policies specified on the queue that may be used with Shared Access - * Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a collection of signed identifiers along with {@link ResponseBase} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getAccessPolicyWithResponseAsync(String queueName, Integer timeout, String requestId) { - return FluxUtil.withContext(context -> getAccessPolicyWithResponseAsync(queueName, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * returns details about any stored access policies specified on the queue that may be used with Shared Access - * Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a collection of signed identifiers along with {@link ResponseBase} on successful completion of + * Gets the access policy for the specified queue. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     SignedIdentifier (Required): [
+     *          (Required){
+     *             Id: String (Required)
+     *             AccessPolicy (Required): {
+     *                 Start: String (Optional)
+     *                 Expiry: String (Optional)
+     *                 Permission: String (Optional)
+     *             }
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the access policy for the specified queue along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getAccessPolicyWithResponseAsync(String queueName, Integer timeout, String requestId, Context context) { - final String comp = "acl"; + public Mono> getAccessPolicyWithResponseAsync(RequestOptions requestOptions) { final String accept = "application/xml"; - return service - .getAccessPolicy(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), requestId, - accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * returns details about any stored access policies specified on the queue that may be used with Shared Access - * Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a collection of signed identifiers on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAccessPolicyAsync(String queueName, Integer timeout, - String requestId) { - return getAccessPolicyWithResponseAsync(queueName, timeout, requestId) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * returns details about any stored access policies specified on the queue that may be used with Shared Access - * Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a collection of signed identifiers on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAccessPolicyAsync(String queueName, Integer timeout, String requestId, - Context context) { - return getAccessPolicyWithResponseAsync(queueName, timeout, requestId, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * returns details about any stored access policies specified on the queue that may be used with Shared Access - * Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a collection of signed identifiers along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getAccessPolicyNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, String requestId) { return FluxUtil - .withContext( - context -> getAccessPolicyNoCustomHeadersWithResponseAsync(queueName, timeout, requestId, context)) + .withContext(context -> service.getAccessPolicy(this.client.getUrl(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * returns details about any stored access policies specified on the queue that may be used with Shared Access - * Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a collection of signed identifiers along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAccessPolicyNoCustomHeadersWithResponseAsync( - String queueName, Integer timeout, String requestId, Context context) { - final String comp = "acl"; - final String accept = "application/xml"; - return service - .getAccessPolicyNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), - requestId, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * returns details about any stored access policies specified on the queue that may be used with Shared Access - * Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a collection of signed identifiers along with {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase - getAccessPolicyWithResponse(String queueName, Integer timeout, String requestId, Context context) { + * Gets the access policy for the specified queue. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     SignedIdentifier (Required): [
+     *          (Required){
+     *             Id: String (Required)
+     *             AccessPolicy (Required): {
+     *                 Start: String (Optional)
+     *                 Expiry: String (Optional)
+     *                 Permission: String (Optional)
+     *             }
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the access policy for the specified queue along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAccessPolicyWithResponse(RequestOptions requestOptions) { try { - final String comp = "acl"; final String accept = "application/xml"; - return service.getAccessPolicySync(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), - requestId, accept, context); + return service.getAccessPolicySync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + accept, requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * returns details about any stored access policies specified on the queue that may be used with Shared Access - * Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a collection of signed identifiers. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public QueueSignedIdentifierWrapper getAccessPolicy(String queueName, Integer timeout, String requestId) { - try { - return getAccessPolicyWithResponse(queueName, timeout, requestId, Context.NONE).getValue(); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * returns details about any stored access policies specified on the queue that may be used with Shared Access - * Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a collection of signed identifiers along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAccessPolicyNoCustomHeadersWithResponse(String queueName, - Integer timeout, String requestId, Context context) { - try { - final String comp = "acl"; - final String accept = "application/xml"; - return service.getAccessPolicyNoCustomHeadersSync(this.client.getUrl(), queueName, comp, timeout, - this.client.getVersion(), requestId, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * sets stored access policies for the queue that may be used with Shared Access Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueAcl the acls for the queue. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setAccessPolicyWithResponseAsync(String queueName, - Integer timeout, String requestId, List queueAcl) { - return FluxUtil - .withContext(context -> setAccessPolicyWithResponseAsync(queueName, timeout, requestId, queueAcl, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * sets stored access policies for the queue that may be used with Shared Access Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueAcl the acls for the queue. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setAccessPolicyWithResponseAsync(String queueName, - Integer timeout, String requestId, List queueAcl, Context context) { - final String comp = "acl"; - final String accept = "application/xml"; - QueueSignedIdentifierWrapper queueAclConverted = new QueueSignedIdentifierWrapper(queueAcl); - return service - .setAccessPolicy(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), requestId, - queueAclConverted, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * sets stored access policies for the queue that may be used with Shared Access Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueAcl the acls for the queue. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setAccessPolicyAsync(String queueName, Integer timeout, String requestId, - List queueAcl) { - return setAccessPolicyWithResponseAsync(queueName, timeout, requestId, queueAcl) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * sets stored access policies for the queue that may be used with Shared Access Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueAcl the acls for the queue. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setAccessPolicyAsync(String queueName, Integer timeout, String requestId, - List queueAcl, Context context) { - return setAccessPolicyWithResponseAsync(queueName, timeout, requestId, queueAcl, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * sets stored access policies for the queue that may be used with Shared Access Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueAcl the acls for the queue. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * Sets the permissions for the specified queue. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/xml".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     SignedIdentifier (Required): [
+     *          (Required){
+     *             Id: String (Required)
+     *             AccessPolicy (Required): {
+     *                 Start: String (Optional)
+     *                 Expiry: String (Optional)
+     *                 Permission: String (Optional)
+     *             }
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, - String requestId, List queueAcl) { + public Mono> setAccessPolicyWithResponseAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/xml"); + } + }); return FluxUtil - .withContext(context -> setAccessPolicyNoCustomHeadersWithResponseAsync(queueName, timeout, requestId, - queueAcl, context)) + .withContext(context -> service.setAccessPolicy(this.client.getUrl(), + this.client.getServiceVersion().getVersion(), requestOptionsLocal, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * sets stored access policies for the queue that may be used with Shared Access Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueAcl the acls for the queue. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, - String requestId, List queueAcl, Context context) { - final String comp = "acl"; - final String accept = "application/xml"; - QueueSignedIdentifierWrapper queueAclConverted = new QueueSignedIdentifierWrapper(queueAcl); - return service - .setAccessPolicyNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), - requestId, queueAclConverted, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * sets stored access policies for the queue that may be used with Shared Access Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueAcl the acls for the queue. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase setAccessPolicyWithResponse(String queueName, - Integer timeout, String requestId, List queueAcl, Context context) { - try { - final String comp = "acl"; - final String accept = "application/xml"; - QueueSignedIdentifierWrapper queueAclConverted = new QueueSignedIdentifierWrapper(queueAcl); - return service.setAccessPolicySync(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), - requestId, queueAclConverted, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * sets stored access policies for the queue that may be used with Shared Access Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueAcl the acls for the queue. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal 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 setAccessPolicy(String queueName, Integer timeout, String requestId, - List queueAcl) { - setAccessPolicyWithResponse(queueName, timeout, requestId, queueAcl, Context.NONE); - } - - /** - * sets stored access policies for the queue that may be used with Shared Access Signatures. - * - * @param queueName The queue name. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param queueAcl the acls for the queue. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * Sets the permissions for the specified queue. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/xml".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     SignedIdentifier (Required): [
+     *          (Required){
+     *             Id: String (Required)
+     *             AccessPolicy (Required): {
+     *                 Start: String (Optional)
+     *                 Expiry: String (Optional)
+     *                 Permission: String (Optional)
+     *             }
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response setAccessPolicyNoCustomHeadersWithResponse(String queueName, Integer timeout, - String requestId, List queueAcl, Context context) { + public Response setAccessPolicyWithResponse(RequestOptions requestOptions) { try { - final String comp = "acl"; - final String accept = "application/xml"; - QueueSignedIdentifierWrapper queueAclConverted = new QueueSignedIdentifierWrapper(queueAcl); - return service.setAccessPolicyNoCustomHeadersSync(this.client.getUrl(), queueName, comp, timeout, - this.client.getVersion(), requestId, queueAclConverted, accept, context); + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null + && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/xml"); + } + }); + return service.setAccessPolicySync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + requestOptionsLocal, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java index e73a6302b761..39444fbc7327 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.implementation; import com.azure.core.annotation.BodyParam; @@ -9,39 +9,31 @@ import com.azure.core.annotation.HeaderParam; 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.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; 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.RequestOptions; import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.storage.queue.implementation.models.KeyInfo; -import com.azure.storage.queue.implementation.models.ListQueuesSegmentResponse; +import com.azure.storage.queue.QueueServiceVersion; import com.azure.storage.queue.implementation.models.QueueStorageExceptionInternal; -import com.azure.storage.queue.implementation.models.ServicesGetPropertiesHeaders; -import com.azure.storage.queue.implementation.models.ServicesGetStatisticsHeaders; -import com.azure.storage.queue.implementation.models.ServicesGetUserDelegationKeyHeaders; -import com.azure.storage.queue.implementation.models.ServicesListQueuesSegmentHeaders; -import com.azure.storage.queue.implementation.models.ServicesListQueuesSegmentNextHeaders; -import com.azure.storage.queue.implementation.models.ServicesSetPropertiesHeaders; import com.azure.storage.queue.implementation.util.ModelHelper; -import com.azure.storage.queue.models.QueueItem; -import com.azure.storage.queue.models.QueueServiceProperties; -import com.azure.storage.queue.models.QueueServiceStatistics; -import com.azure.storage.queue.models.UserDelegationKey; import java.util.List; -import java.util.Objects; +import java.util.Map; import java.util.stream.Collectors; import reactor.core.publisher.Mono; @@ -70,6 +62,19 @@ public final class ServicesImpl { this.client = client; } + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public QueueServiceVersion getServiceVersion() { + try { + return client.getServiceVersion(); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } + } + /** * The interface defining all the services for AzureQueueStorageServices to be used by the proxy service to perform * REST calls. @@ -78,1987 +83,818 @@ public final class ServicesImpl { @ServiceInterface(name = "AzureQueueStorageServices") public interface ServicesService { - @Put("/") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> setProperties(@HostParam("url") String url, - @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueServiceProperties queueServiceProperties, - @HeaderParam("Accept") String accept, Context context); - - @Put("/") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> setPropertiesNoCustomHeaders(@HostParam("url") String url, - @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueServiceProperties queueServiceProperties, - @HeaderParam("Accept") String accept, Context context); - - @Put("/") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase setPropertiesSync(@HostParam("url") String url, - @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueServiceProperties queueServiceProperties, - @HeaderParam("Accept") String accept, Context context); - - @Put("/") + @Put("?restype=service&comp=properties") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response setPropertiesNoCustomHeadersSync(@HostParam("url") String url, - @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, - @BodyParam("application/xml") QueueServiceProperties queueServiceProperties, - @HeaderParam("Accept") String accept, Context context); - - @Get("/") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> getProperties( - @HostParam("url") String url, @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Get("/") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> getPropertiesNoCustomHeaders(@HostParam("url") String url, - @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Get("/") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase getPropertiesSync( - @HostParam("url") String url, @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Get("/") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response getPropertiesNoCustomHeadersSync(@HostParam("url") String url, - @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Get("/") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> getStatistics( - @HostParam("url") String url, @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Get("/") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> getStatisticsNoCustomHeaders(@HostParam("url") String url, - @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Get("/") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase getStatisticsSync( - @HostParam("url") String url, @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Mono> setProperties(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/xml") BinaryData queueServiceProperties, RequestOptions requestOptions, Context context); - @Get("/") - @ExpectedResponses({ 200 }) + @Put("?restype=service&comp=properties") + @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response getStatisticsNoCustomHeadersSync(@HostParam("url") String url, - @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Response setPropertiesSync(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/xml") BinaryData queueServiceProperties, RequestOptions requestOptions, Context context); - @Post("/") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> getUserDelegationKey( - @HostParam("url") String url, @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @BodyParam("application/xml") KeyInfo keyInfo, - @HeaderParam("Accept") String accept, Context context); - - @Post("/") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> getUserDelegationKeyNoCustomHeaders(@HostParam("url") String url, - @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @BodyParam("application/xml") KeyInfo keyInfo, - @HeaderParam("Accept") String accept, Context context); - - @Post("/") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase getUserDelegationKeySync( - @HostParam("url") String url, @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @BodyParam("application/xml") KeyInfo keyInfo, - @HeaderParam("Accept") String accept, Context context); - - @Post("/") + @Get("?restype=service&comp=properties") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response getUserDelegationKeyNoCustomHeadersSync(@HostParam("url") String url, - @QueryParam("restype") String restype, @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @BodyParam("application/xml") KeyInfo keyInfo, - @HeaderParam("Accept") String accept, Context context); + Mono> getProperties(@HostParam("url") String url, + @HeaderParam("x-ms-version") String xMsVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); - @Get("/") + @Get("?restype=service&comp=properties") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> listQueuesSegment( - @HostParam("url") String url, @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, - @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, - @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + Response getPropertiesSync(@HostParam("url") String url, + @HeaderParam("x-ms-version") String xMsVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); - @Get("/") + @Get("?restype=service&comp=stats") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> listQueuesSegmentNoCustomHeaders(@HostParam("url") String url, - @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, - @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); - - @Get("/") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase listQueuesSegmentSync( - @HostParam("url") String url, @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, - @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, - @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + Mono> getStatistics(@HostParam("url") String url, + @HeaderParam("x-ms-version") String xMsVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); - @Get("/") + @Get("?restype=service&comp=stats") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response listQueuesSegmentNoCustomHeadersSync(@HostParam("url") String url, - @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, - @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, - Context context); + Response getStatisticsSync(@HostParam("url") String url, + @HeaderParam("x-ms-version") String xMsVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); - @Get("{nextLink}") + @Post("?restype=service&comp=userdelegationkey") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> listQueuesSegmentNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("url") String url, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + Mono> getUserDelegationKey(@HostParam("url") String url, + @HeaderParam("Content-Type") String contentType, @HeaderParam("x-ms-version") String xMsVersion, + @HeaderParam("Accept") String accept, @BodyParam("application/xml") BinaryData keyInfo, + RequestOptions requestOptions, Context context); - @Get("{nextLink}") + @Post("?restype=service&comp=userdelegationkey") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Mono> listQueuesSegmentNextNoCustomHeaders( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("url") String url, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + Response getUserDelegationKeySync(@HostParam("url") String url, + @HeaderParam("Content-Type") String contentType, @HeaderParam("x-ms-version") String xMsVersion, + @HeaderParam("Accept") String accept, @BodyParam("application/xml") BinaryData keyInfo, + RequestOptions requestOptions, Context context); - @Get("{nextLink}") + @Get("?comp=list") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - ResponseBase listQueuesSegmentNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("url") String url, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + Mono> getQueues(@HostParam("url") String url, + @HeaderParam("x-ms-version") String xMsVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); - @Get("{nextLink}") + @Get("?comp=list") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) - Response listQueuesSegmentNextNoCustomHeadersSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("url") String url, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and - * CORS (Cross-Origin Resource Sharing) rules. - * - * @param queueServiceProperties The StorageService properties. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setPropertiesWithResponseAsync( - QueueServiceProperties queueServiceProperties, Integer timeout, String requestId) { - return FluxUtil - .withContext(context -> setPropertiesWithResponseAsync(queueServiceProperties, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and - * CORS (Cross-Origin Resource Sharing) rules. - * - * @param queueServiceProperties The StorageService properties. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setPropertiesWithResponseAsync( - QueueServiceProperties queueServiceProperties, Integer timeout, String requestId, Context context) { - final String restype = "service"; - final String comp = "properties"; - final String accept = "application/xml"; - return service - .setProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, - queueServiceProperties, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and - * CORS (Cross-Origin Resource Sharing) rules. - * - * @param queueServiceProperties The StorageService properties. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setPropertiesAsync(QueueServiceProperties queueServiceProperties, Integer timeout, - String requestId) { - return setPropertiesWithResponseAsync(queueServiceProperties, timeout, requestId) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and - * CORS (Cross-Origin Resource Sharing) rules. - * - * @param queueServiceProperties The StorageService properties. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setPropertiesAsync(QueueServiceProperties queueServiceProperties, Integer timeout, - String requestId, Context context) { - return setPropertiesWithResponseAsync(queueServiceProperties, timeout, requestId, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and - * CORS (Cross-Origin Resource Sharing) rules. - * - * @param queueServiceProperties The StorageService properties. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + Response getQueuesSync(@HostParam("url") String url, @HeaderParam("x-ms-version") String xMsVersion, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics + * and CORS (Cross-Origin Resource Sharing) rules. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     Logging (Optional): {
+     *         Version: String (Required)
+     *         Delete: boolean (Required)
+     *         Read: boolean (Required)
+     *         Write: boolean (Required)
+     *         RetentionPolicy (Required): {
+     *             Enabled: boolean (Required)
+     *             Days: Integer (Optional)
+     *         }
+     *     }
+     *     HourMetrics (Optional): {
+     *         Version: String (Optional)
+     *         Enabled: boolean (Required)
+     *         IncludeAPIs: Boolean (Optional)
+     *         RetentionPolicy (Optional): (recursive schema, see RetentionPolicy above)
+     *     }
+     *     MinuteMetrics (Optional): (recursive schema, see MinuteMetrics above)
+     *     Cors (Optional): [
+     *          (Optional){
+     *             AllowedOrigins: String (Required)
+     *             AllowedMethods: String (Required)
+     *             AllowedHeaders: String (Required)
+     *             ExposedHeaders: String (Required)
+     *             MaxAgeInSeconds: int (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param queueServiceProperties The storage service properties to set. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setPropertiesNoCustomHeadersWithResponseAsync( - QueueServiceProperties queueServiceProperties, Integer timeout, String requestId) { + public Mono> setPropertiesWithResponseAsync(BinaryData queueServiceProperties, + RequestOptions requestOptions) { + final String contentType = "application/xml"; return FluxUtil - .withContext(context -> setPropertiesNoCustomHeadersWithResponseAsync(queueServiceProperties, timeout, - requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and - * CORS (Cross-Origin Resource Sharing) rules. - * - * @param queueServiceProperties The StorageService properties. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setPropertiesNoCustomHeadersWithResponseAsync( - QueueServiceProperties queueServiceProperties, Integer timeout, String requestId, Context context) { - final String restype = "service"; - final String comp = "properties"; - final String accept = "application/xml"; - return service - .setPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - requestId, queueServiceProperties, accept, context) + .withContext( + context -> service.setProperties(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + contentType, queueServiceProperties, requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and - * CORS (Cross-Origin Resource Sharing) rules. - * - * @param queueServiceProperties The StorageService properties. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase setPropertiesWithResponse( - QueueServiceProperties queueServiceProperties, Integer timeout, String requestId, Context context) { - try { - final String restype = "service"; - final String comp = "properties"; - final String accept = "application/xml"; - return service.setPropertiesSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - requestId, queueServiceProperties, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and - * CORS (Cross-Origin Resource Sharing) rules. - * - * @param queueServiceProperties The StorageService properties. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal 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 setProperties(QueueServiceProperties queueServiceProperties, Integer timeout, String requestId) { - setPropertiesWithResponse(queueServiceProperties, timeout, requestId, Context.NONE); - } - - /** - * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and - * CORS (Cross-Origin Resource Sharing) rules. - * - * @param queueServiceProperties The StorageService properties. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics + * and CORS (Cross-Origin Resource Sharing) rules. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     Logging (Optional): {
+     *         Version: String (Required)
+     *         Delete: boolean (Required)
+     *         Read: boolean (Required)
+     *         Write: boolean (Required)
+     *         RetentionPolicy (Required): {
+     *             Enabled: boolean (Required)
+     *             Days: Integer (Optional)
+     *         }
+     *     }
+     *     HourMetrics (Optional): {
+     *         Version: String (Optional)
+     *         Enabled: boolean (Required)
+     *         IncludeAPIs: Boolean (Optional)
+     *         RetentionPolicy (Optional): (recursive schema, see RetentionPolicy above)
+     *     }
+     *     MinuteMetrics (Optional): (recursive schema, see MinuteMetrics above)
+     *     Cors (Optional): [
+     *          (Optional){
+     *             AllowedOrigins: String (Required)
+     *             AllowedMethods: String (Required)
+     *             AllowedHeaders: String (Required)
+     *             ExposedHeaders: String (Required)
+     *             MaxAgeInSeconds: int (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param queueServiceProperties The storage service properties to set. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response setPropertiesNoCustomHeadersWithResponse(QueueServiceProperties queueServiceProperties, - Integer timeout, String requestId, Context context) { + public Response setPropertiesWithResponse(BinaryData queueServiceProperties, RequestOptions requestOptions) { try { - final String restype = "service"; - final String comp = "properties"; - final String accept = "application/xml"; - return service.setPropertiesNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, queueServiceProperties, accept, context); + final String contentType = "application/xml"; + return service.setPropertiesSync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), + contentType, queueServiceProperties, requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules along with {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getPropertiesWithResponseAsync(Integer timeout, String requestId) { - return FluxUtil.withContext(context -> getPropertiesWithResponseAsync(timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules along with {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getPropertiesWithResponseAsync(Integer timeout, String requestId, Context context) { - final String restype = "service"; - final String comp = "properties"; + * Retrieves properties of a storage account's Queue service, including properties for Storage Analytics and + * CORS (Cross-Origin Resource Sharing) rules. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     Logging (Optional): {
+     *         Version: String (Required)
+     *         Delete: boolean (Required)
+     *         Read: boolean (Required)
+     *         Write: boolean (Required)
+     *         RetentionPolicy (Required): {
+     *             Enabled: boolean (Required)
+     *             Days: Integer (Optional)
+     *         }
+     *     }
+     *     HourMetrics (Optional): {
+     *         Version: String (Optional)
+     *         Enabled: boolean (Required)
+     *         IncludeAPIs: Boolean (Optional)
+     *         RetentionPolicy (Optional): (recursive schema, see RetentionPolicy above)
+     *     }
+     *     MinuteMetrics (Optional): (recursive schema, see MinuteMetrics above)
+     *     Cors (Optional): [
+     *          (Optional){
+     *             AllowedOrigins: String (Required)
+     *             AllowedMethods: String (Required)
+     *             AllowedHeaders: String (Required)
+     *             ExposedHeaders: String (Required)
+     *             MaxAgeInSeconds: int (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the service properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPropertiesWithResponseAsync(RequestOptions requestOptions) { final String accept = "application/xml"; - return service - .getProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, accept, - context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPropertiesAsync(Integer timeout, String requestId) { - return getPropertiesWithResponseAsync(timeout, requestId) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPropertiesAsync(Integer timeout, String requestId, Context context) { - return getPropertiesWithResponseAsync(timeout, requestId, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPropertiesNoCustomHeadersWithResponseAsync(Integer timeout, - String requestId) { return FluxUtil - .withContext(context -> getPropertiesNoCustomHeadersWithResponseAsync(timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPropertiesNoCustomHeadersWithResponseAsync(Integer timeout, - String requestId, Context context) { - final String restype = "service"; - final String comp = "properties"; - final String accept = "application/xml"; - return service - .getPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - requestId, accept, context) + .withContext(context -> service.getProperties(this.client.getUrl(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules along with {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase getPropertiesWithResponse(Integer timeout, - String requestId, Context context) { - try { - final String restype = "service"; - final String comp = "properties"; - final String accept = "application/xml"; - return service.getPropertiesSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - requestId, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public QueueServiceProperties getProperties(Integer timeout, String requestId) { - try { - return getPropertiesWithResponse(timeout, requestId, Context.NONE).getValue(); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of a storage account's Queue service, including properties for Storage Analytics and CORS - * (Cross-Origin Resource Sharing) rules along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getPropertiesNoCustomHeadersWithResponse(Integer timeout, String requestId, - Context context) { + * Retrieves properties of a storage account's Queue service, including properties for Storage Analytics and + * CORS (Cross-Origin Resource Sharing) rules. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     Logging (Optional): {
+     *         Version: String (Required)
+     *         Delete: boolean (Required)
+     *         Read: boolean (Required)
+     *         Write: boolean (Required)
+     *         RetentionPolicy (Required): {
+     *             Enabled: boolean (Required)
+     *             Days: Integer (Optional)
+     *         }
+     *     }
+     *     HourMetrics (Optional): {
+     *         Version: String (Optional)
+     *         Enabled: boolean (Required)
+     *         IncludeAPIs: Boolean (Optional)
+     *         RetentionPolicy (Optional): (recursive schema, see RetentionPolicy above)
+     *     }
+     *     MinuteMetrics (Optional): (recursive schema, see MinuteMetrics above)
+     *     Cors (Optional): [
+     *          (Optional){
+     *             AllowedOrigins: String (Required)
+     *             AllowedMethods: String (Required)
+     *             AllowedHeaders: String (Required)
+     *             ExposedHeaders: String (Required)
+     *             MaxAgeInSeconds: int (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the service properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPropertiesWithResponse(RequestOptions requestOptions) { try { - final String restype = "service"; - final String comp = "properties"; final String accept = "application/xml"; - return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, accept, context); + return service.getPropertiesSync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location - * endpoint when read-access geo-redundant replication is enabled for the storage account. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stats for the storage service along with {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getStatisticsWithResponseAsync(Integer timeout, String requestId) { - return FluxUtil.withContext(context -> getStatisticsWithResponseAsync(timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location - * endpoint when read-access geo-redundant replication is enabled for the storage account. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stats for the storage service along with {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getStatisticsWithResponseAsync(Integer timeout, String requestId, Context context) { - final String restype = "service"; - final String comp = "stats"; + * Retrieves statistics related to replication for the Queue service. It is only available on the secondary + * location endpoint when read-access geo-redundant replication is enabled for the storage account. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     GeoReplication (Optional): {
+     *         Status: String(live/bootstrap/unavailable) (Required)
+     *         LastSyncTime: DateTimeRfc1123 (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return statistics for the storage queue service along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getStatisticsWithResponseAsync(RequestOptions requestOptions) { final String accept = "application/xml"; - return service - .getStatistics(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, accept, - context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location - * endpoint when read-access geo-redundant replication is enabled for the storage account. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stats for the storage service on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getStatisticsAsync(Integer timeout, String requestId) { - return getStatisticsWithResponseAsync(timeout, requestId) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location - * endpoint when read-access geo-redundant replication is enabled for the storage account. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stats for the storage service on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getStatisticsAsync(Integer timeout, String requestId, Context context) { - return getStatisticsWithResponseAsync(timeout, requestId, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location - * endpoint when read-access geo-redundant replication is enabled for the storage account. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stats for the storage service along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getStatisticsNoCustomHeadersWithResponseAsync(Integer timeout, - String requestId) { return FluxUtil - .withContext(context -> getStatisticsNoCustomHeadersWithResponseAsync(timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location - * endpoint when read-access geo-redundant replication is enabled for the storage account. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stats for the storage service along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getStatisticsNoCustomHeadersWithResponseAsync(Integer timeout, - String requestId, Context context) { - final String restype = "service"; - final String comp = "stats"; - final String accept = "application/xml"; - return service - .getStatisticsNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - requestId, accept, context) + .withContext(context -> service.getStatistics(this.client.getUrl(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location - * endpoint when read-access geo-redundant replication is enabled for the storage account. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stats for the storage service along with {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase getStatisticsWithResponse(Integer timeout, - String requestId, Context context) { - try { - final String restype = "service"; - final String comp = "stats"; - final String accept = "application/xml"; - return service.getStatisticsSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - requestId, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location - * endpoint when read-access geo-redundant replication is enabled for the storage account. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stats for the storage service. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public QueueServiceStatistics getStatistics(Integer timeout, String requestId) { - try { - return getStatisticsWithResponse(timeout, requestId, Context.NONE).getValue(); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location - * endpoint when read-access geo-redundant replication is enabled for the storage account. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stats for the storage service along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getStatisticsNoCustomHeadersWithResponse(Integer timeout, String requestId, - Context context) { + * Retrieves statistics related to replication for the Queue service. It is only available on the secondary + * location endpoint when read-access geo-redundant replication is enabled for the storage account. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     GeoReplication (Optional): {
+     *         Status: String(live/bootstrap/unavailable) (Required)
+     *         LastSyncTime: DateTimeRfc1123 (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return statistics for the storage queue service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getStatisticsWithResponse(RequestOptions requestOptions) { try { - final String restype = "service"; - final String comp = "stats"; final String accept = "application/xml"; - return service.getStatisticsNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, accept, context); + return service.getStatisticsSync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * Retrieves a user delegation key for the Queue service. This is only a valid operation when using bearer token - * authentication. - * - * @param keyInfo Key information. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a user delegation key along with {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getUserDelegationKeyWithResponseAsync(KeyInfo keyInfo, Integer timeout, String requestId) { - return FluxUtil - .withContext(context -> getUserDelegationKeyWithResponseAsync(keyInfo, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * Retrieves a user delegation key for the Queue service. This is only a valid operation when using bearer token - * authentication. - * - * @param keyInfo Key information. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a user delegation key along with {@link ResponseBase} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getUserDelegationKeyWithResponseAsync(KeyInfo keyInfo, Integer timeout, String requestId, Context context) { - final String restype = "service"; - final String comp = "userdelegationkey"; - final String accept = "application/xml"; - return service - .getUserDelegationKey(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, - keyInfo, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * Retrieves a user delegation key for the Queue service. This is only a valid operation when using bearer token - * authentication. - * - * @param keyInfo Key information. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a user delegation key on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getUserDelegationKeyAsync(KeyInfo keyInfo, Integer timeout, String requestId) { - return getUserDelegationKeyWithResponseAsync(keyInfo, timeout, requestId) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Retrieves a user delegation key for the Queue service. This is only a valid operation when using bearer token - * authentication. - * - * @param keyInfo Key information. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a user delegation key on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getUserDelegationKeyAsync(KeyInfo keyInfo, Integer timeout, String requestId, - Context context) { - return getUserDelegationKeyWithResponseAsync(keyInfo, timeout, requestId, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Retrieves a user delegation key for the Queue service. This is only a valid operation when using bearer token - * authentication. - * - * @param keyInfo Key information. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a user delegation key along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getUserDelegationKeyNoCustomHeadersWithResponseAsync(KeyInfo keyInfo, - Integer timeout, String requestId) { - return FluxUtil - .withContext( - context -> getUserDelegationKeyNoCustomHeadersWithResponseAsync(keyInfo, timeout, requestId, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); - } - - /** - * Retrieves a user delegation key for the Queue service. This is only a valid operation when using bearer token - * authentication. + * Retrieves a user delegation key for the Queue service. This is only a valid operation when using bearer + * token authentication. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     Start: OffsetDateTime (Optional)
+     *     Expiry: OffsetDateTime (Required)
+     *     DelegatedUserTid: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     SignedOid: String (Required)
+     *     SignedTid: String (Required)
+     *     SignedStart: OffsetDateTime (Required)
+     *     SignedExpiry: OffsetDateTime (Required)
+     *     SignedService: String (Required)
+     *     SignedVersion: String (Required)
+     *     SignedDelegatedUserTid: String (Optional)
+     *     Value: String (Required)
+     * }
+     * }
+     * 
* * @param keyInfo Key information. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return a user delegation key along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getUserDelegationKeyNoCustomHeadersWithResponseAsync(KeyInfo keyInfo, - Integer timeout, String requestId, Context context) { - final String restype = "service"; - final String comp = "userdelegationkey"; + public Mono> getUserDelegationKeyWithResponseAsync(BinaryData keyInfo, + RequestOptions requestOptions) { + final String contentType = "application/xml"; final String accept = "application/xml"; - return service - .getUserDelegationKeyNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - requestId, keyInfo, accept, context) + return FluxUtil + .withContext(context -> service.getUserDelegationKey(this.client.getUrl(), contentType, + this.client.getServiceVersion().getVersion(), accept, keyInfo, requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** - * Retrieves a user delegation key for the Queue service. This is only a valid operation when using bearer token - * authentication. + * Retrieves a user delegation key for the Queue service. This is only a valid operation when using bearer + * token authentication. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     Start: OffsetDateTime (Optional)
+     *     Expiry: OffsetDateTime (Required)
+     *     DelegatedUserTid: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     SignedOid: String (Required)
+     *     SignedTid: String (Required)
+     *     SignedStart: OffsetDateTime (Required)
+     *     SignedExpiry: OffsetDateTime (Required)
+     *     SignedService: String (Required)
+     *     SignedVersion: String (Required)
+     *     SignedDelegatedUserTid: String (Optional)
+     *     Value: String (Required)
+     * }
+     * }
+     * 
* * @param keyInfo Key information. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a user delegation key along with {@link ResponseBase}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseBase - getUserDelegationKeyWithResponse(KeyInfo keyInfo, Integer timeout, String requestId, Context context) { - try { - final String restype = "service"; - final String comp = "userdelegationkey"; - final String accept = "application/xml"; - return service.getUserDelegationKeySync(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, keyInfo, accept, context); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * Retrieves a user delegation key for the Queue service. This is only a valid operation when using bearer token - * authentication. - * - * @param keyInfo Key information. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a user delegation key. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public UserDelegationKey getUserDelegationKey(KeyInfo keyInfo, Integer timeout, String requestId) { - try { - return getUserDelegationKeyWithResponse(keyInfo, timeout, requestId, Context.NONE).getValue(); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * Retrieves a user delegation key for the Queue service. This is only a valid operation when using bearer token - * authentication. - * - * @param keyInfo Key information. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return a user delegation key along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getUserDelegationKeyNoCustomHeadersWithResponse(KeyInfo keyInfo, Integer timeout, - String requestId, Context context) { + public Response getUserDelegationKeyWithResponse(BinaryData keyInfo, RequestOptions requestOptions) { try { - final String restype = "service"; - final String comp = "userdelegationkey"; + final String contentType = "application/xml"; final String accept = "application/xml"; - return service.getUserDelegationKeyNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, keyInfo, accept, context); + return service.getUserDelegationKeySync(this.client.getUrl(), contentType, + this.client.getServiceVersion().getVersion(), accept, keyInfo, requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listQueuesSegmentSinglePageAsync(String prefix, String marker, - Integer maxresults, List include, Integer timeout, String requestId) { - final String comp = "list"; + * Returns a list of queues. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
prefixStringNoFilters the results to return only queues whose name begins with + * the specified prefix.
markerStringNoIdentifies the portion of the list of queues to be returned with + * the next listing operation. The operation + * returns the marker value if the listing operation did not return all queues remaining. The marker value can + * be used as the value for the marker parameter in a subsequent call to request the next page of list items. + * The marker value is opaque to the client.
maxresultsIntegerNoSpecifies the maximum number of queues to return. If the + * request does not specify maxresults, or specifies + * a value greater than 5000, the server will return up to 5000 items.
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
includeList<String>NoSpecify to include additional, optional + * information. In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     Name: String (Required)
+     *     Metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the list queues response along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getQueuesSinglePageAsync(RequestOptions requestOptions) { final String accept = "application/xml"; - String includeConverted = (include == null) - ? null - : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); return FluxUtil - .withContext(context -> service.listQueuesSegment(this.client.getUrl(), comp, prefix, marker, maxresults, - includeConverted, timeout, this.client.getVersion(), requestId, accept, context)) + .withContext(context -> service.getQueues(this.client.getUrl(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); - } - - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listQueuesSegmentSinglePageAsync(String prefix, String marker, - Integer maxresults, List include, Integer timeout, String requestId, Context context) { - final String comp = "list"; - final String accept = "application/xml"; - String includeConverted = (include == null) - ? null - : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service - .listQueuesSegment(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, - this.client.getVersion(), requestId, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); - } - - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service as paginated response with - * {@link PagedFlux}. + getValues(res.getValue(), "Queues"), null, null)); + } + + /** + * Returns a list of queues. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
prefixStringNoFilters the results to return only queues whose name begins with + * the specified prefix.
markerStringNoIdentifies the portion of the list of queues to be returned with + * the next listing operation. The operation + * returns the marker value if the listing operation did not return all queues remaining. The marker value can + * be used as the value for the marker parameter in a subsequent call to request the next page of list items. + * The marker value is opaque to the client.
maxresultsIntegerNoSpecifies the maximum number of queues to return. If the + * request does not specify maxresults, or specifies + * a value greater than 5000, the server will return up to 5000 items.
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
includeList<String>NoSpecify to include additional, optional + * information. In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     Name: String (Required)
+     *     Metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the list queues response as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listQueuesSegmentAsync(String prefix, String marker, Integer maxresults, - List include, Integer timeout, String requestId) { - return new PagedFlux<>( - () -> listQueuesSegmentSinglePageAsync(prefix, marker, maxresults, include, timeout, requestId), - nextLink -> listQueuesSegmentNextSinglePageAsync(nextLink, requestId)); - } - - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service as paginated response with - * {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listQueuesSegmentAsync(String prefix, String marker, Integer maxresults, - List include, Integer timeout, String requestId, Context context) { - return new PagedFlux<>( - () -> listQueuesSegmentSinglePageAsync(prefix, marker, maxresults, include, timeout, requestId, context), - nextLink -> listQueuesSegmentNextSinglePageAsync(nextLink, requestId, context)); - } - - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listQueuesSegmentNoCustomHeadersSinglePageAsync(String prefix, String marker, - Integer maxresults, List include, Integer timeout, String requestId) { - final String comp = "list"; - final String accept = "application/xml"; - String includeConverted = (include == null) - ? null - : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil - .withContext(context -> service.listQueuesSegmentNoCustomHeaders(this.client.getUrl(), comp, prefix, marker, - maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), null)); - } - - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listQueuesSegmentNoCustomHeadersSinglePageAsync(String prefix, String marker, - Integer maxresults, List include, Integer timeout, String requestId, Context context) { - final String comp = "list"; - final String accept = "application/xml"; - String includeConverted = (include == null) - ? null - : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service - .listQueuesSegmentNoCustomHeaders(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, - timeout, this.client.getVersion(), requestId, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), null)); - } - - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service as paginated response with - * {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listQueuesSegmentNoCustomHeadersAsync(String prefix, String marker, Integer maxresults, - List include, Integer timeout, String requestId) { - return new PagedFlux<>(() -> listQueuesSegmentNoCustomHeadersSinglePageAsync(prefix, marker, maxresults, - include, timeout, requestId), nextLink -> listQueuesSegmentNextSinglePageAsync(nextLink, requestId)); - } - - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service as paginated response with - * {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listQueuesSegmentNoCustomHeadersAsync(String prefix, String marker, Integer maxresults, - List include, Integer timeout, String requestId, Context context) { - return new PagedFlux<>(() -> listQueuesSegmentNoCustomHeadersSinglePageAsync(prefix, marker, maxresults, - include, timeout, requestId, context), - nextLink -> listQueuesSegmentNextSinglePageAsync(nextLink, requestId, context)); - } - - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse listQueuesSegmentSinglePage(String prefix, String marker, Integer maxresults, - List include, Integer timeout, String requestId) { - try { - final String comp = "list"; - final String accept = "application/xml"; - String includeConverted = (include == null) - ? null - : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - ResponseBase res - = service.listQueuesSegmentSync(this.client.getUrl(), comp, prefix, marker, maxresults, - includeConverted, timeout, this.client.getVersion(), requestId, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse listQueuesSegmentSinglePage(String prefix, String marker, Integer maxresults, - List include, Integer timeout, String requestId, Context context) { + public PagedFlux getQueuesAsync(RequestOptions requestOptions) { + return new PagedFlux<>(() -> getQueuesSinglePageAsync(requestOptions)); + } + + /** + * Returns a list of queues. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
prefixStringNoFilters the results to return only queues whose name begins with + * the specified prefix.
markerStringNoIdentifies the portion of the list of queues to be returned with + * the next listing operation. The operation + * returns the marker value if the listing operation did not return all queues remaining. The marker value can + * be used as the value for the marker parameter in a subsequent call to request the next page of list items. + * The marker value is opaque to the client.
maxresultsIntegerNoSpecifies the maximum number of queues to return. If the + * request does not specify maxresults, or specifies + * a value greater than 5000, the server will return up to 5000 items.
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
includeList<String>NoSpecify to include additional, optional + * information. In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     Name: String (Required)
+     *     Metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the list queues response along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse getQueuesSinglePage(RequestOptions requestOptions) { try { - final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) - ? null - : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - ResponseBase res - = service.listQueuesSegmentSync(this.client.getUrl(), comp, prefix, marker, maxresults, - includeConverted, timeout, this.client.getVersion(), requestId, accept, context); + Response res = service.getQueuesSync(this.client.getUrl(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + getValues(res.getValue(), "Queues"), null, null); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listQueuesSegment(String prefix, String marker, Integer maxresults, - List include, Integer timeout, String requestId) { - return new PagedIterable<>( - () -> listQueuesSegmentSinglePage(prefix, marker, maxresults, include, timeout, requestId), - nextLink -> listQueuesSegmentNextSinglePage(nextLink, requestId)); - } - - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service as paginated response with - * {@link PagedIterable}. + * Returns a list of queues. + *

Query Parameters

+ * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
prefixStringNoFilters the results to return only queues whose name begins with + * the specified prefix.
markerStringNoIdentifies the portion of the list of queues to be returned with + * the next listing operation. The operation + * returns the marker value if the listing operation did not return all queues remaining. The marker value can + * be used as the value for the marker parameter in a subsequent call to request the next page of list items. + * The marker value is opaque to the client.
maxresultsIntegerNoSpecifies the maximum number of queues to return. If the + * request does not specify maxresults, or specifies + * a value greater than 5000, the server will return up to 5000 items.
timeoutIntegerNoThe timeout parameter is expressed in seconds. For more + * information, see + * <a + * href="https://learn.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations">Setting + * Timeouts for Queue Service Operations.</a>
includeList<String>NoSpecify to include additional, optional + * information. In the form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     Name: String (Required)
+     *     Metadata (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the list queues response as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listQueuesSegment(String prefix, String marker, Integer maxresults, - List include, Integer timeout, String requestId, Context context) { - return new PagedIterable<>( - () -> listQueuesSegmentSinglePage(prefix, marker, maxresults, include, timeout, requestId, context), - nextLink -> listQueuesSegmentNextSinglePage(nextLink, requestId, context)); + public PagedIterable getQueues(RequestOptions requestOptions) { + return new PagedIterable<>(() -> getQueuesSinglePage(requestOptions)); } - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse listQueuesSegmentNoCustomHeadersSinglePage(String prefix, String marker, - Integer maxresults, List include, Integer timeout, String requestId) { + private List getValues(BinaryData binaryData, String path) { try { - final String comp = "list"; - final String accept = "application/xml"; - String includeConverted = (include == null) - ? null - : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - Response res - = service.listQueuesSegmentNoCustomHeadersSync(this.client.getUrl(), comp, prefix, marker, maxresults, - includeConverted, timeout, this.client.getVersion(), requestId, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), null); + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse listQueuesSegmentNoCustomHeadersSinglePage(String prefix, String marker, - Integer maxresults, List include, Integer timeout, String requestId, Context context) { + private String getNextLink(BinaryData binaryData, String path) { try { - final String comp = "list"; - final String accept = "application/xml"; - String includeConverted = (include == null) - ? null - : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - Response res - = service.listQueuesSegmentNoCustomHeadersSync(this.client.getUrl(), comp, prefix, marker, maxresults, - includeConverted, timeout, this.client.getVersion(), requestId, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), null); + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } } - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listQueuesSegmentNoCustomHeaders(String prefix, String marker, Integer maxresults, - List include, Integer timeout, String requestId) { - return new PagedIterable<>( - () -> listQueuesSegmentNoCustomHeadersSinglePage(prefix, marker, maxresults, include, timeout, requestId), - nextLink -> listQueuesSegmentNextSinglePage(nextLink, requestId)); - } - - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next - * listing operation. The operation returns the NextMarker value within the response body if the listing operation - * did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the - * value for the marker parameter in a subsequent call to request the next page of list items. The marker value is - * opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, - * or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing - * operation crosses a partition boundary, then the service will return a continuation token for retrieving the - * remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues' metadata be returned as part of the response - * body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a - * href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting - * Timeouts for Queue Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listQueuesSegmentNoCustomHeaders(String prefix, String marker, Integer maxresults, - List include, Integer timeout, String requestId, Context context) { - return new PagedIterable<>(() -> listQueuesSegmentNoCustomHeadersSinglePage(prefix, marker, maxresults, include, - timeout, requestId, context), nextLink -> listQueuesSegmentNextSinglePage(nextLink, requestId, context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listQueuesSegmentNextSinglePageAsync(String nextLink, String requestId) { - final String accept = "application/xml"; - return FluxUtil - .withContext(context -> service.listQueuesSegmentNext(nextLink, this.client.getUrl(), - this.client.getVersion(), requestId, accept, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listQueuesSegmentNextSinglePageAsync(String nextLink, String requestId, - Context context) { - final String accept = "application/xml"; - return service - .listQueuesSegmentNext(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listQueuesSegmentNextNoCustomHeadersSinglePageAsync(String nextLink, - String requestId) { + public Mono> getQueuesWithResponseAsync(RequestOptions requestOptions) { final String accept = "application/xml"; return FluxUtil - .withContext(context -> service.listQueuesSegmentNextNoCustomHeaders(nextLink, this.client.getUrl(), - this.client.getVersion(), requestId, accept, context)) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listQueuesSegmentNextNoCustomHeadersSinglePageAsync(String nextLink, - String requestId, Context context) { - final String accept = "application/xml"; - return service - .listQueuesSegmentNextNoCustomHeaders(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, - accept, context) - .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse listQueuesSegmentNextSinglePage(String nextLink, String requestId) { - try { - final String accept = "application/xml"; - ResponseBase res - = service.listQueuesSegmentNextSync(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, - accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse listQueuesSegmentNextSinglePage(String nextLink, String requestId, - Context context) { - try { - final String accept = "application/xml"; - ResponseBase res - = service.listQueuesSegmentNextSync(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, - accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse listQueuesSegmentNextNoCustomHeadersSinglePage(String nextLink, String requestId) { - try { - final String accept = "application/xml"; - Response res = service.listQueuesSegmentNextNoCustomHeadersSync(nextLink, - this.client.getUrl(), this.client.getVersion(), requestId, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), null); - } catch (QueueStorageExceptionInternal internalException) { - throw ModelHelper.mapToQueueStorageException(internalException); - } + .withContext(context -> service.getQueues(this.client.getUrl(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the - * analytics logs when storage analytics logging is enabled. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws QueueStorageExceptionInternal thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the object returned when calling List Queues on a Queue Service along with {@link PagedResponse}. - */ @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse listQueuesSegmentNextNoCustomHeadersSinglePage(String nextLink, String requestId, - Context context) { + public Response getQueuesWithResponse(RequestOptions requestOptions) { try { final String accept = "application/xml"; - Response res = service.listQueuesSegmentNextNoCustomHeadersSync(nextLink, - this.client.getUrl(), this.client.getVersion(), requestId, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), null); + return service.getQueuesSync(this.client.getUrl(), this.client.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); } catch (QueueStorageExceptionInternal internalException) { throw ModelHelper.mapToQueueStorageException(internalException); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/KeyInfo.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/KeyInfo.java index 23bee3d2d266..32ba77103eb9 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/KeyInfo.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/KeyInfo.java @@ -1,95 +1,89 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.implementation.models; import com.azure.core.annotation.Fluent; import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; import com.azure.xml.XmlReader; import com.azure.xml.XmlSerializable; import com.azure.xml.XmlToken; import com.azure.xml.XmlWriter; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; /** - * Key information. + * Key information for user delegation key. */ @Fluent public final class KeyInfo implements XmlSerializable { + /* - * The date-time the key is active in ISO 8601 UTC time + * The date-time the key is active in ISO 8601 UTC time. */ @Generated - private String start; + private OffsetDateTime start; /* - * The date-time the key expires in ISO 8601 UTC time + * The date-time the key expires in ISO 8601 UTC time. */ @Generated - private String expiry; + private final OffsetDateTime expiry; /* - * The delegated user tenant id in Azure AD + * The delegated user tenant ID in Entra ID. */ @Generated private String delegatedUserTenantId; /** * Creates an instance of KeyInfo class. + * + * @param expiry the expiry value to set. */ @Generated - public KeyInfo() { + public KeyInfo(OffsetDateTime expiry) { + this.expiry = expiry; } /** * Get the start property: The date-time the key is active in ISO 8601 UTC time. - * + * * @return the start value. */ @Generated - public String getStart() { + public OffsetDateTime getStart() { return this.start; } /** * Set the start property: The date-time the key is active in ISO 8601 UTC time. - * + * * @param start the start value to set. * @return the KeyInfo object itself. */ @Generated - public KeyInfo setStart(String start) { + public KeyInfo setStart(OffsetDateTime start) { this.start = start; return this; } /** * Get the expiry property: The date-time the key expires in ISO 8601 UTC time. - * + * * @return the expiry value. */ @Generated - public String getExpiry() { + public OffsetDateTime getExpiry() { return this.expiry; } /** - * Set the expiry property: The date-time the key expires in ISO 8601 UTC time. - * - * @param expiry the expiry value to set. - * @return the KeyInfo object itself. - */ - @Generated - public KeyInfo setExpiry(String expiry) { - this.expiry = expiry; - return this; - } - - /** - * Get the delegatedUserTenantId property: The delegated user tenant id in Azure AD. - * + * Get the delegatedUserTenantId property: The delegated user tenant ID in Entra ID. + * * @return the delegatedUserTenantId value. */ @Generated @@ -98,8 +92,8 @@ public String getDelegatedUserTenantId() { } /** - * Set the delegatedUserTenantId property: The delegated user tenant id in Azure AD. - * + * Set the delegatedUserTenantId property: The delegated user tenant ID in Entra ID. + * * @param delegatedUserTenantId the delegatedUserTenantId value to set. * @return the KeyInfo object itself. */ @@ -120,18 +114,21 @@ public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { rootElementName = rootElementName == null || rootElementName.isEmpty() ? "KeyInfo" : rootElementName; xmlWriter.writeStartElement(rootElementName); - xmlWriter.writeStringElement("Start", this.start); - xmlWriter.writeStringElement("Expiry", this.expiry); + xmlWriter.writeStringElement("Start", + this.start == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.start)); + xmlWriter.writeStringElement("Expiry", + this.expiry == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expiry)); xmlWriter.writeStringElement("DelegatedUserTid", this.delegatedUserTenantId); return xmlWriter.writeEndElement(); } /** * Reads an instance of KeyInfo from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of KeyInfo if the XmlReader was pointing to an instance of it, or null if it was pointing to * XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the KeyInfo. */ @Generated @@ -141,12 +138,13 @@ public static KeyInfo fromXml(XmlReader xmlReader) throws XMLStreamException { /** * Reads an instance of KeyInfo from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. * @return An instance of KeyInfo if the XmlReader was pointing to an instance of it, or null if it was pointing to * XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the KeyInfo. */ @Generated @@ -154,21 +152,24 @@ public static KeyInfo fromXml(XmlReader xmlReader, String rootElementName) throw String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "KeyInfo" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { - KeyInfo deserializedKeyInfo = new KeyInfo(); + OffsetDateTime start = null; + OffsetDateTime expiry = null; + String delegatedUserTenantId = null; while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("Start".equals(elementName.getLocalPart())) { - deserializedKeyInfo.start = reader.getStringElement(); + start = reader.getNullableElement(dateString -> CoreUtils.parseBestOffsetDateTime(dateString)); } else if ("Expiry".equals(elementName.getLocalPart())) { - deserializedKeyInfo.expiry = reader.getStringElement(); + expiry = reader.getNullableElement(dateString -> CoreUtils.parseBestOffsetDateTime(dateString)); } else if ("DelegatedUserTid".equals(elementName.getLocalPart())) { - deserializedKeyInfo.delegatedUserTenantId = reader.getStringElement(); + delegatedUserTenantId = reader.getStringElement(); } else { reader.skipElement(); } } - + KeyInfo deserializedKeyInfo = new KeyInfo(expiry); + deserializedKeyInfo.start = start; + deserializedKeyInfo.delegatedUserTenantId = delegatedUserTenantId; return deserializedKeyInfo; }); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ListOfSentMessage.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ListOfSentMessage.java new file mode 100644 index 000000000000..ea2dad5dedf7 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ListOfSentMessage.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.storage.queue.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.storage.queue.models.SendMessageResult; +import com.azure.xml.XmlReader; +import com.azure.xml.XmlSerializable; +import com.azure.xml.XmlToken; +import com.azure.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The response of send message. + */ +@Immutable +public final class ListOfSentMessage implements XmlSerializable { + + /* + * The list of sent messages. + */ + @Generated + private final List items; + + /** + * Creates an instance of ListOfSentMessage class. + * + * @param items the items value to set. + */ + @Generated + private ListOfSentMessage(List items) { + this.items = items; + } + + /** + * Get the items property: The list of sent messages. + * + * @return the items value. + */ + @Generated + public List getItems() { + return this.items; + } + + @Generated + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Generated + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "QueueMessagesList" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + if (this.items != null) { + for (SendMessageResult element : this.items) { + xmlWriter.writeXml(element, "QueueMessage"); + } + } + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of ListOfSentMessage from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of ListOfSentMessage if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. + * @throws XMLStreamException If an error occurs while reading the ListOfSentMessage. + */ + @Generated + public static ListOfSentMessage fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of ListOfSentMessage from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of ListOfSentMessage if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. + * @throws XMLStreamException If an error occurs while reading the ListOfSentMessage. + */ + @Generated + public static ListOfSentMessage fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "QueueMessagesList" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + List items = null; + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + if ("QueueMessage".equals(elementName.getLocalPart())) { + if (items == null) { + items = new ArrayList<>(); + } + items.add(SendMessageResult.fromXml(reader, "QueueMessage")); + } else { + reader.skipElement(); + } + } + return new ListOfSentMessage(items); + }); + } +} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ListQueuesIncludeType.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ListQueuesIncludeType.java new file mode 100644 index 000000000000..09ec5a5cc0ff --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ListQueuesIncludeType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.storage.queue.implementation.models; + +/** + * Specify to include additional, optional information. + */ +public enum ListQueuesIncludeType { + /** + * Include queue metadata. + */ + METADATA("metadata"); + + /** + * The actual serialized value for a ListQueuesIncludeType instance. + */ + private final String value; + + ListQueuesIncludeType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ListQueuesIncludeType instance. + * + * @param value the serialized value to parse. + * @return the parsed ListQueuesIncludeType object, or null if unable to parse. + */ + public static ListQueuesIncludeType fromString(String value) { + if (value == null) { + return null; + } + ListQueuesIncludeType[] items = ListQueuesIncludeType.values(); + for (ListQueuesIncludeType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/PeekedMessageItemInternal.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/PeekedMessageItemInternal.java index 8b46a2c57961..50791009388c 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/PeekedMessageItemInternal.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/PeekedMessageItemInternal.java @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.implementation.models; -import com.azure.core.annotation.Fluent; import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; import com.azure.core.util.DateTimeRfc1123; import com.azure.xml.XmlReader; import com.azure.xml.XmlSerializable; @@ -17,50 +16,71 @@ import javax.xml.stream.XMLStreamException; /** - * The object returned in the QueueMessageList array when calling Peek Messages on a Queue. + * The peeked queue message. */ -@Fluent +@Immutable public final class PeekedMessageItemInternal implements XmlSerializable { + /* - * The Id of the Message. + * The ID of the message. */ @Generated - private String messageId; + private final String messageId; /* - * The time the Message was inserted into the Queue. + * The time the message was inserted into the queue. */ @Generated - private DateTimeRfc1123 insertionTime; + private final DateTimeRfc1123 insertionTime; /* - * The time that the Message will expire and be automatically deleted. + * The time that the message will expire and be automatically deleted. */ @Generated - private DateTimeRfc1123 expirationTime; + private final DateTimeRfc1123 expirationTime; /* * The number of times the message has been dequeued. */ @Generated - private long dequeueCount; + private final long dequeueCount; /* - * The content of the Message. + * The content of the message. */ @Generated - private String messageText; + private final String messageText; /** * Creates an instance of PeekedMessageItemInternal class. + * + * @param messageId the messageId value to set. + * @param insertionTime the insertionTime value to set. + * @param expirationTime the expirationTime value to set. + * @param dequeueCount the dequeueCount value to set. + * @param messageText the messageText value to set. */ @Generated - public PeekedMessageItemInternal() { + private PeekedMessageItemInternal(String messageId, OffsetDateTime insertionTime, OffsetDateTime expirationTime, + long dequeueCount, String messageText) { + this.messageId = messageId; + if (insertionTime == null) { + this.insertionTime = null; + } else { + this.insertionTime = new DateTimeRfc1123(insertionTime); + } + if (expirationTime == null) { + this.expirationTime = null; + } else { + this.expirationTime = new DateTimeRfc1123(expirationTime); + } + this.dequeueCount = dequeueCount; + this.messageText = messageText; } /** - * Get the messageId property: The Id of the Message. - * + * Get the messageId property: The ID of the message. + * * @return the messageId value. */ @Generated @@ -69,20 +89,8 @@ public String getMessageId() { } /** - * Set the messageId property: The Id of the Message. - * - * @param messageId the messageId value to set. - * @return the PeekedMessageItemInternal object itself. - */ - @Generated - public PeekedMessageItemInternal setMessageId(String messageId) { - this.messageId = messageId; - return this; - } - - /** - * Get the insertionTime property: The time the Message was inserted into the Queue. - * + * Get the insertionTime property: The time the message was inserted into the queue. + * * @return the insertionTime value. */ @Generated @@ -94,24 +102,8 @@ public OffsetDateTime getInsertionTime() { } /** - * Set the insertionTime property: The time the Message was inserted into the Queue. - * - * @param insertionTime the insertionTime value to set. - * @return the PeekedMessageItemInternal object itself. - */ - @Generated - public PeekedMessageItemInternal setInsertionTime(OffsetDateTime insertionTime) { - if (insertionTime == null) { - this.insertionTime = null; - } else { - this.insertionTime = new DateTimeRfc1123(insertionTime); - } - return this; - } - - /** - * Get the expirationTime property: The time that the Message will expire and be automatically deleted. - * + * Get the expirationTime property: The time that the message will expire and be automatically deleted. + * * @return the expirationTime value. */ @Generated @@ -122,25 +114,9 @@ public OffsetDateTime getExpirationTime() { return this.expirationTime.getDateTime(); } - /** - * Set the expirationTime property: The time that the Message will expire and be automatically deleted. - * - * @param expirationTime the expirationTime value to set. - * @return the PeekedMessageItemInternal object itself. - */ - @Generated - public PeekedMessageItemInternal setExpirationTime(OffsetDateTime expirationTime) { - if (expirationTime == null) { - this.expirationTime = null; - } else { - this.expirationTime = new DateTimeRfc1123(expirationTime); - } - return this; - } - /** * Get the dequeueCount property: The number of times the message has been dequeued. - * + * * @return the dequeueCount value. */ @Generated @@ -149,20 +125,8 @@ public long getDequeueCount() { } /** - * Set the dequeueCount property: The number of times the message has been dequeued. - * - * @param dequeueCount the dequeueCount value to set. - * @return the PeekedMessageItemInternal object itself. - */ - @Generated - public PeekedMessageItemInternal setDequeueCount(long dequeueCount) { - this.dequeueCount = dequeueCount; - return this; - } - - /** - * Get the messageText property: The content of the Message. - * + * Get the messageText property: The content of the message. + * * @return the messageText value. */ @Generated @@ -170,18 +134,6 @@ public String getMessageText() { return this.messageText; } - /** - * Set the messageText property: The content of the Message. - * - * @param messageText the messageText value to set. - * @return the PeekedMessageItemInternal object itself. - */ - @Generated - public PeekedMessageItemInternal setMessageText(String messageText) { - this.messageText = messageText; - return this; - } - @Generated @Override public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @@ -203,10 +155,11 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of PeekedMessageItemInternal from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of PeekedMessageItemInternal if the XmlReader was pointing to an instance of it, or null if * it was pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the PeekedMessageItemInternal. */ @Generated @@ -216,12 +169,13 @@ public static PeekedMessageItemInternal fromXml(XmlReader xmlReader) throws XMLS /** * Reads an instance of PeekedMessageItemInternal from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. * @return An instance of PeekedMessageItemInternal if the XmlReader was pointing to an instance of it, or null if * it was pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the PeekedMessageItemInternal. */ @Generated @@ -230,28 +184,34 @@ public static PeekedMessageItemInternal fromXml(XmlReader xmlReader, String root String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "QueueMessage" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { - PeekedMessageItemInternal deserializedPeekedMessageItemInternal = new PeekedMessageItemInternal(); + String messageId = null; + OffsetDateTime insertionTime = null; + OffsetDateTime expirationTime = null; + long dequeueCount = 0L; + String messageText = null; while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("MessageId".equals(elementName.getLocalPart())) { - deserializedPeekedMessageItemInternal.messageId = reader.getStringElement(); + messageId = reader.getStringElement(); } else if ("InsertionTime".equals(elementName.getLocalPart())) { - deserializedPeekedMessageItemInternal.insertionTime - = reader.getNullableElement(DateTimeRfc1123::new); + DateTimeRfc1123 insertionTimeHolder = reader.getNullableElement(DateTimeRfc1123::new); + if (insertionTimeHolder != null) { + insertionTime = insertionTimeHolder.getDateTime(); + } } else if ("ExpirationTime".equals(elementName.getLocalPart())) { - deserializedPeekedMessageItemInternal.expirationTime - = reader.getNullableElement(DateTimeRfc1123::new); + DateTimeRfc1123 expirationTimeHolder = reader.getNullableElement(DateTimeRfc1123::new); + if (expirationTimeHolder != null) { + expirationTime = expirationTimeHolder.getDateTime(); + } } else if ("DequeueCount".equals(elementName.getLocalPart())) { - deserializedPeekedMessageItemInternal.dequeueCount = reader.getLongElement(); + dequeueCount = reader.getLongElement(); } else if ("MessageText".equals(elementName.getLocalPart())) { - deserializedPeekedMessageItemInternal.messageText = reader.getStringElement(); + messageText = reader.getStringElement(); } else { reader.skipElement(); } } - - return deserializedPeekedMessageItemInternal; + return new PeekedMessageItemInternal(messageId, insertionTime, expirationTime, dequeueCount, messageText); }); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/PeekedMessages.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/PeekedMessages.java new file mode 100644 index 000000000000..c56803f6fb7f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/PeekedMessages.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.storage.queue.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.xml.XmlReader; +import com.azure.xml.XmlSerializable; +import com.azure.xml.XmlToken; +import com.azure.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The response of peek messages. + */ +@Immutable +public final class PeekedMessages implements XmlSerializable { + + /* + * The list of peeked messages. + */ + @Generated + private final List items; + + /** + * Creates an instance of PeekedMessages class. + * + * @param items the items value to set. + */ + @Generated + private PeekedMessages(List items) { + this.items = items; + } + + /** + * Get the items property: The list of peeked messages. + * + * @return the items value. + */ + @Generated + public List getItems() { + return this.items; + } + + @Generated + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Generated + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "QueueMessagesList" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + if (this.items != null) { + for (PeekedMessageItemInternal element : this.items) { + xmlWriter.writeXml(element, "QueueMessage"); + } + } + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of PeekedMessages from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of PeekedMessages if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. + * @throws XMLStreamException If an error occurs while reading the PeekedMessages. + */ + @Generated + public static PeekedMessages fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of PeekedMessages from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of PeekedMessages if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. + * @throws XMLStreamException If an error occurs while reading the PeekedMessages. + */ + @Generated + public static PeekedMessages fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "QueueMessagesList" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + List items = null; + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + if ("QueueMessage".equals(elementName.getLocalPart())) { + if (items == null) { + items = new ArrayList<>(); + } + items.add(PeekedMessageItemInternal.fromXml(reader, "QueueMessage")); + } else { + reader.skipElement(); + } + } + return new PeekedMessages(items); + }); + } +} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueueMessage.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueueMessage.java index 8dd364c11d54..cb89de0f4f4f 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueueMessage.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueueMessage.java @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.implementation.models; -import com.azure.core.annotation.Fluent; import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; import com.azure.xml.XmlReader; import com.azure.xml.XmlSerializable; import com.azure.xml.XmlToken; @@ -14,26 +13,30 @@ import javax.xml.stream.XMLStreamException; /** - * A Message object which can be stored in a Queue. + * The queue message. */ -@Fluent +@Immutable public final class QueueMessage implements XmlSerializable { + /* - * The content of the message + * The content of the message. */ @Generated - private String messageText; + private final String messageText; /** * Creates an instance of QueueMessage class. + * + * @param messageText the messageText value to set. */ @Generated - public QueueMessage() { + public QueueMessage(String messageText) { + this.messageText = messageText; } /** * Get the messageText property: The content of the message. - * + * * @return the messageText value. */ @Generated @@ -41,18 +44,6 @@ public String getMessageText() { return this.messageText; } - /** - * Set the messageText property: The content of the message. - * - * @param messageText the messageText value to set. - * @return the QueueMessage object itself. - */ - @Generated - public QueueMessage setMessageText(String messageText) { - this.messageText = messageText; - return this; - } - @Generated @Override public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @@ -70,10 +61,11 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of QueueMessage from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of QueueMessage if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueMessage. */ @Generated @@ -83,12 +75,13 @@ public static QueueMessage fromXml(XmlReader xmlReader) throws XMLStreamExceptio /** * Reads an instance of QueueMessage from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. * @return An instance of QueueMessage if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueMessage. */ @Generated @@ -96,18 +89,16 @@ public static QueueMessage fromXml(XmlReader xmlReader, String rootElementName) String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "QueueMessage" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { - QueueMessage deserializedQueueMessage = new QueueMessage(); + String messageText = null; while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("MessageText".equals(elementName.getLocalPart())) { - deserializedQueueMessage.messageText = reader.getStringElement(); + messageText = reader.getStringElement(); } else { reader.skipElement(); } } - - return deserializedQueueMessage; + return new QueueMessage(messageText); }); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueueMessageItemInternal.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueueMessageItemInternal.java index acd34c0e8e2b..57d6feb08634 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueueMessageItemInternal.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueueMessageItemInternal.java @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.implementation.models; -import com.azure.core.annotation.Fluent; import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; import com.azure.core.util.DateTimeRfc1123; import com.azure.xml.XmlReader; import com.azure.xml.XmlSerializable; @@ -17,63 +16,92 @@ import javax.xml.stream.XMLStreamException; /** - * The object returned in the QueueMessageList array when calling Get Messages on a Queue. + * The received queue message. */ -@Fluent +@Immutable public final class QueueMessageItemInternal implements XmlSerializable { + /* - * The Id of the Message. + * The ID of the message. */ @Generated - private String messageId; + private final String messageId; /* - * The time the Message was inserted into the Queue. + * The time the message was inserted into the queue. */ @Generated - private DateTimeRfc1123 insertionTime; + private final DateTimeRfc1123 insertionTime; /* - * The time that the Message will expire and be automatically deleted. + * The time that the message will expire and be automatically deleted. */ @Generated - private DateTimeRfc1123 expirationTime; + private final DateTimeRfc1123 expirationTime; /* - * This value is required to delete the Message. If deletion fails using this popreceipt then the message has been - * dequeued by another client. + * An opaque value required to delete the message. If deletion fails using this + * PopReceipt then the message has been dequeued by another client. */ @Generated - private String popReceipt; + private final String popReceipt; /* - * The time that the message will again become visible in the Queue. + * The time that the message will again become visible in the queue. */ @Generated - private DateTimeRfc1123 timeNextVisible; + private final DateTimeRfc1123 timeNextVisible; /* * The number of times the message has been dequeued. */ @Generated - private long dequeueCount; + private final long dequeueCount; /* - * The content of the Message. + * The content of the message. */ @Generated - private String messageText; + private final String messageText; /** * Creates an instance of QueueMessageItemInternal class. + * + * @param messageId the messageId value to set. + * @param insertionTime the insertionTime value to set. + * @param expirationTime the expirationTime value to set. + * @param popReceipt the popReceipt value to set. + * @param timeNextVisible the timeNextVisible value to set. + * @param dequeueCount the dequeueCount value to set. + * @param messageText the messageText value to set. */ @Generated - public QueueMessageItemInternal() { + private QueueMessageItemInternal(String messageId, OffsetDateTime insertionTime, OffsetDateTime expirationTime, + String popReceipt, OffsetDateTime timeNextVisible, long dequeueCount, String messageText) { + this.messageId = messageId; + if (insertionTime == null) { + this.insertionTime = null; + } else { + this.insertionTime = new DateTimeRfc1123(insertionTime); + } + if (expirationTime == null) { + this.expirationTime = null; + } else { + this.expirationTime = new DateTimeRfc1123(expirationTime); + } + this.popReceipt = popReceipt; + if (timeNextVisible == null) { + this.timeNextVisible = null; + } else { + this.timeNextVisible = new DateTimeRfc1123(timeNextVisible); + } + this.dequeueCount = dequeueCount; + this.messageText = messageText; } /** - * Get the messageId property: The Id of the Message. - * + * Get the messageId property: The ID of the message. + * * @return the messageId value. */ @Generated @@ -82,20 +110,8 @@ public String getMessageId() { } /** - * Set the messageId property: The Id of the Message. - * - * @param messageId the messageId value to set. - * @return the QueueMessageItemInternal object itself. - */ - @Generated - public QueueMessageItemInternal setMessageId(String messageId) { - this.messageId = messageId; - return this; - } - - /** - * Get the insertionTime property: The time the Message was inserted into the Queue. - * + * Get the insertionTime property: The time the message was inserted into the queue. + * * @return the insertionTime value. */ @Generated @@ -107,24 +123,8 @@ public OffsetDateTime getInsertionTime() { } /** - * Set the insertionTime property: The time the Message was inserted into the Queue. - * - * @param insertionTime the insertionTime value to set. - * @return the QueueMessageItemInternal object itself. - */ - @Generated - public QueueMessageItemInternal setInsertionTime(OffsetDateTime insertionTime) { - if (insertionTime == null) { - this.insertionTime = null; - } else { - this.insertionTime = new DateTimeRfc1123(insertionTime); - } - return this; - } - - /** - * Get the expirationTime property: The time that the Message will expire and be automatically deleted. - * + * Get the expirationTime property: The time that the message will expire and be automatically deleted. + * * @return the expirationTime value. */ @Generated @@ -136,25 +136,9 @@ public OffsetDateTime getExpirationTime() { } /** - * Set the expirationTime property: The time that the Message will expire and be automatically deleted. - * - * @param expirationTime the expirationTime value to set. - * @return the QueueMessageItemInternal object itself. - */ - @Generated - public QueueMessageItemInternal setExpirationTime(OffsetDateTime expirationTime) { - if (expirationTime == null) { - this.expirationTime = null; - } else { - this.expirationTime = new DateTimeRfc1123(expirationTime); - } - return this; - } - - /** - * Get the popReceipt property: This value is required to delete the Message. If deletion fails using this - * popreceipt then the message has been dequeued by another client. - * + * Get the popReceipt property: An opaque value required to delete the message. If deletion fails using this + * PopReceipt then the message has been dequeued by another client. + * * @return the popReceipt value. */ @Generated @@ -163,21 +147,8 @@ public String getPopReceipt() { } /** - * Set the popReceipt property: This value is required to delete the Message. If deletion fails using this - * popreceipt then the message has been dequeued by another client. - * - * @param popReceipt the popReceipt value to set. - * @return the QueueMessageItemInternal object itself. - */ - @Generated - public QueueMessageItemInternal setPopReceipt(String popReceipt) { - this.popReceipt = popReceipt; - return this; - } - - /** - * Get the timeNextVisible property: The time that the message will again become visible in the Queue. - * + * Get the timeNextVisible property: The time that the message will again become visible in the queue. + * * @return the timeNextVisible value. */ @Generated @@ -188,25 +159,9 @@ public OffsetDateTime getTimeNextVisible() { return this.timeNextVisible.getDateTime(); } - /** - * Set the timeNextVisible property: The time that the message will again become visible in the Queue. - * - * @param timeNextVisible the timeNextVisible value to set. - * @return the QueueMessageItemInternal object itself. - */ - @Generated - public QueueMessageItemInternal setTimeNextVisible(OffsetDateTime timeNextVisible) { - if (timeNextVisible == null) { - this.timeNextVisible = null; - } else { - this.timeNextVisible = new DateTimeRfc1123(timeNextVisible); - } - return this; - } - /** * Get the dequeueCount property: The number of times the message has been dequeued. - * + * * @return the dequeueCount value. */ @Generated @@ -215,20 +170,8 @@ public long getDequeueCount() { } /** - * Set the dequeueCount property: The number of times the message has been dequeued. - * - * @param dequeueCount the dequeueCount value to set. - * @return the QueueMessageItemInternal object itself. - */ - @Generated - public QueueMessageItemInternal setDequeueCount(long dequeueCount) { - this.dequeueCount = dequeueCount; - return this; - } - - /** - * Get the messageText property: The content of the Message. - * + * Get the messageText property: The content of the message. + * * @return the messageText value. */ @Generated @@ -236,18 +179,6 @@ public String getMessageText() { return this.messageText; } - /** - * Set the messageText property: The content of the Message. - * - * @param messageText the messageText value to set. - * @return the QueueMessageItemInternal object itself. - */ - @Generated - public QueueMessageItemInternal setMessageText(String messageText) { - this.messageText = messageText; - return this; - } - @Generated @Override public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @@ -271,10 +202,11 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of QueueMessageItemInternal from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of QueueMessageItemInternal if the XmlReader was pointing to an instance of it, or null if it * was pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueMessageItemInternal. */ @Generated @@ -284,12 +216,13 @@ public static QueueMessageItemInternal fromXml(XmlReader xmlReader) throws XMLSt /** * Reads an instance of QueueMessageItemInternal from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. * @return An instance of QueueMessageItemInternal if the XmlReader was pointing to an instance of it, or null if it * was pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueMessageItemInternal. */ @Generated @@ -298,33 +231,44 @@ public static QueueMessageItemInternal fromXml(XmlReader xmlReader, String rootE String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "QueueMessage" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { - QueueMessageItemInternal deserializedQueueMessageItemInternal = new QueueMessageItemInternal(); + String messageId = null; + OffsetDateTime insertionTime = null; + OffsetDateTime expirationTime = null; + String popReceipt = null; + OffsetDateTime timeNextVisible = null; + long dequeueCount = 0L; + String messageText = null; while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("MessageId".equals(elementName.getLocalPart())) { - deserializedQueueMessageItemInternal.messageId = reader.getStringElement(); + messageId = reader.getStringElement(); } else if ("InsertionTime".equals(elementName.getLocalPart())) { - deserializedQueueMessageItemInternal.insertionTime - = reader.getNullableElement(DateTimeRfc1123::new); + DateTimeRfc1123 insertionTimeHolder = reader.getNullableElement(DateTimeRfc1123::new); + if (insertionTimeHolder != null) { + insertionTime = insertionTimeHolder.getDateTime(); + } } else if ("ExpirationTime".equals(elementName.getLocalPart())) { - deserializedQueueMessageItemInternal.expirationTime - = reader.getNullableElement(DateTimeRfc1123::new); + DateTimeRfc1123 expirationTimeHolder = reader.getNullableElement(DateTimeRfc1123::new); + if (expirationTimeHolder != null) { + expirationTime = expirationTimeHolder.getDateTime(); + } } else if ("PopReceipt".equals(elementName.getLocalPart())) { - deserializedQueueMessageItemInternal.popReceipt = reader.getStringElement(); + popReceipt = reader.getStringElement(); } else if ("TimeNextVisible".equals(elementName.getLocalPart())) { - deserializedQueueMessageItemInternal.timeNextVisible - = reader.getNullableElement(DateTimeRfc1123::new); + DateTimeRfc1123 timeNextVisibleHolder = reader.getNullableElement(DateTimeRfc1123::new); + if (timeNextVisibleHolder != null) { + timeNextVisible = timeNextVisibleHolder.getDateTime(); + } } else if ("DequeueCount".equals(elementName.getLocalPart())) { - deserializedQueueMessageItemInternal.dequeueCount = reader.getLongElement(); + dequeueCount = reader.getLongElement(); } else if ("MessageText".equals(elementName.getLocalPart())) { - deserializedQueueMessageItemInternal.messageText = reader.getStringElement(); + messageText = reader.getStringElement(); } else { reader.skipElement(); } } - - return deserializedQueueMessageItemInternal; + return new QueueMessageItemInternal(messageId, insertionTime, expirationTime, popReceipt, timeNextVisible, + dequeueCount, messageText); }); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ReceivedMessages.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ReceivedMessages.java new file mode 100644 index 000000000000..6b03fc98c969 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ReceivedMessages.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.storage.queue.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.xml.XmlReader; +import com.azure.xml.XmlSerializable; +import com.azure.xml.XmlToken; +import com.azure.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * The response of receive messages. + */ +@Immutable +public final class ReceivedMessages implements XmlSerializable { + + /* + * The list of received messages. + */ + @Generated + private final List items; + + /** + * Creates an instance of ReceivedMessages class. + * + * @param items the items value to set. + */ + @Generated + private ReceivedMessages(List items) { + this.items = items; + } + + /** + * Get the items property: The list of received messages. + * + * @return the items value. + */ + @Generated + public List getItems() { + return this.items; + } + + @Generated + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Generated + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "QueueMessagesList" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + if (this.items != null) { + for (QueueMessageItemInternal element : this.items) { + xmlWriter.writeXml(element, "QueueMessage"); + } + } + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of ReceivedMessages from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of ReceivedMessages if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. + * @throws XMLStreamException If an error occurs while reading the ReceivedMessages. + */ + @Generated + public static ReceivedMessages fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of ReceivedMessages from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of ReceivedMessages if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. + * @throws XMLStreamException If an error occurs while reading the ReceivedMessages. + */ + @Generated + public static ReceivedMessages fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "QueueMessagesList" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + List items = null; + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + if ("QueueMessage".equals(elementName.getLocalPart())) { + if (items == null) { + items = new ArrayList<>(); + } + items.add(QueueMessageItemInternal.fromXml(reader, "QueueMessage")); + } else { + reader.skipElement(); + } + } + return new ReceivedMessages(items); + }); + } +} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/SignedIdentifiers.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/SignedIdentifiers.java new file mode 100644 index 000000000000..a1d584d78983 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/SignedIdentifiers.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package com.azure.storage.queue.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.storage.queue.models.QueueSignedIdentifier; +import com.azure.xml.XmlReader; +import com.azure.xml.XmlSerializable; +import com.azure.xml.XmlToken; +import com.azure.xml.XmlWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +/** + * An array of signed identifiers. + */ +@Immutable +public final class SignedIdentifiers implements XmlSerializable { + + /* + * The list of signed identifiers. + */ + @Generated + private final List items; + + /** + * Creates an instance of SignedIdentifiers class. + * + * @param items the items value to set. + */ + @Generated + public SignedIdentifiers(List items) { + this.items = items; + } + + /** + * Get the items property: The list of signed identifiers. + * + * @return the items value. + */ + @Generated + public List getItems() { + return this.items; + } + + @Generated + @Override + public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { + return toXml(xmlWriter, null); + } + + @Generated + @Override + public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "SignedIdentifiers" : rootElementName; + xmlWriter.writeStartElement(rootElementName); + if (this.items != null) { + for (QueueSignedIdentifier element : this.items) { + xmlWriter.writeXml(element, "SignedIdentifier"); + } + } + return xmlWriter.writeEndElement(); + } + + /** + * Reads an instance of SignedIdentifiers from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @return An instance of SignedIdentifiers if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. + * @throws XMLStreamException If an error occurs while reading the SignedIdentifiers. + */ + @Generated + public static SignedIdentifiers fromXml(XmlReader xmlReader) throws XMLStreamException { + return fromXml(xmlReader, null); + } + + /** + * Reads an instance of SignedIdentifiers from the XmlReader. + * + * @param xmlReader The XmlReader being read. + * @param rootElementName Optional root element name to override the default defined by the model. Used to support + * cases where the model can deserialize from different root element names. + * @return An instance of SignedIdentifiers if the XmlReader was pointing to an instance of it, or null if it was + * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. + * @throws XMLStreamException If an error occurs while reading the SignedIdentifiers. + */ + @Generated + public static SignedIdentifiers fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { + String finalRootElementName + = rootElementName == null || rootElementName.isEmpty() ? "SignedIdentifiers" : rootElementName; + return xmlReader.readObject(finalRootElementName, reader -> { + List items = null; + while (reader.nextElement() != XmlToken.END_ELEMENT) { + QName elementName = reader.getElementName(); + if ("SignedIdentifier".equals(elementName.getLocalPart())) { + if (items == null) { + items = new ArrayList<>(); + } + items.add(QueueSignedIdentifier.fromXml(reader, "SignedIdentifier")); + } else { + reader.skipElement(); + } + } + return new SignedIdentifiers(items); + }); + } +} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/package-info.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/package-info.java index afc0afd9d0b2..c58cac2f6f9c 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/package-info.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the data models for AzureQueueStorage. - * null. + * + * Package containing the data models for Queues. + * */ package com.azure.storage.queue.implementation.models; diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/package-info.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/package-info.java index 8be6c8e2dad7..b40fac6f4256 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/package-info.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/package-info.java @@ -1,9 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the implementations for AzureQueueStorage. - * null. + * Package containing the implementations for Queues. */ package com.azure.storage.queue.implementation; diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/ModelHelper.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/ModelHelper.java index cb37ecda1cbf..b5d79109cbfb 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/ModelHelper.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/ModelHelper.java @@ -3,20 +3,34 @@ package com.azure.storage.queue.implementation.util; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.implementation.StorageImplUtils; import com.azure.storage.queue.QueueMessageEncoding; +import com.azure.storage.queue.implementation.models.ListQueuesSegmentResponse; import com.azure.storage.queue.implementation.models.PeekedMessageItemInternal; import com.azure.storage.queue.implementation.models.QueueMessageItemInternal; import com.azure.storage.queue.implementation.models.QueueStorageExceptionInternal; import com.azure.storage.queue.implementation.models.QueuesGetPropertiesHeaders; import com.azure.storage.queue.models.PeekedMessageItem; +import com.azure.storage.queue.models.QueueItem; import com.azure.storage.queue.models.QueueMessageItem; import com.azure.storage.queue.models.QueueProperties; import com.azure.storage.queue.models.QueueStorageException; +import com.azure.xml.XmlReader; +import com.azure.xml.XmlSerializable; +import com.azure.xml.XmlWriter; +import javax.xml.stream.XMLStreamException; +import java.io.ByteArrayOutputStream; import java.util.Base64; +import java.util.Collections; +import java.util.List; import java.util.Objects; public class ModelHelper { @@ -107,4 +121,163 @@ public static QueueStorageException mapToQueueStorageException(QueueStorageExcep return new QueueStorageException(StorageImplUtils.convertStorageExceptionMessage(internal.getMessage(), internal.getResponse(), code, headerName), internal.getResponse(), internal.getValue()); } + + /** + * Creates a {@link RequestOptions} for a protocol call, threading the supplied {@link Context}. + *

+ * The generated implementation layer exposes protocol methods that accept a {@link RequestOptions}. The + * hand-written clients translate their typed parameters into query parameters, headers and a request body on the + * returned instance. Callers add operation-specific query parameters via + * {@link #addOptionalQueryParam(RequestOptions, String, Object)}. + * + * @param context The context to thread onto the request, may be {@code null}. + * @return A new {@link RequestOptions} carrying the context. + */ + public static RequestOptions requestOptions(Context context) { + RequestOptions requestOptions = new RequestOptions(); + if (context != null) { + requestOptions.setContext(context); + } + return requestOptions; + } + + /** + * Adds a query parameter to the {@link RequestOptions} only when {@code value} is non-null, mirroring the optional + * parameter semantics of the previous typed implementation methods. + * + * @param requestOptions The request options to mutate. + * @param name The wire query parameter name (as documented on the generated protocol method). + * @param value The value, or {@code null} to omit the parameter. + */ + public static void addOptionalQueryParam(RequestOptions requestOptions, String name, Object value) { + if (value != null) { + requestOptions.addQueryParam(name, String.valueOf(value)); + } + } + + /** + * Wire prefix for user-defined queue metadata headers. The generated protocol methods document a single + * {@code x-ms-meta} header collection; on the wire each entry is emitted as {@code x-ms-meta-}. + */ + private static final String METADATA_HEADER_PREFIX = "x-ms-meta-"; + + /** + * Translates a queue metadata map into {@code x-ms-meta-} request headers on the supplied + * {@link RequestOptions}. Replaces the {@code @HeaderCollection("x-ms-meta-")} binding the previous typed + * implementation methods carried; {@code create} and {@code setMetadata} both delegate here. + * + * @param requestOptions The request options to mutate. + * @param metadata The metadata to serialize, may be {@code null} or empty. + */ + public static void addMetadataHeaders(RequestOptions requestOptions, java.util.Map metadata) { + if (metadata != null) { + for (java.util.Map.Entry entry : metadata.entrySet()) { + requestOptions.addHeader(METADATA_HEADER_PREFIX + entry.getKey(), entry.getValue()); + } + } + } + + /** + * Serializes an {@link XmlSerializable} request body into XML {@link BinaryData} for the protocol layer. + * + * @param value The value to serialize, may be {@code null}. + * @return The XML-encoded {@link BinaryData}, or {@code null} if {@code value} is {@code null}. + */ + public static BinaryData serializeXmlBody(XmlSerializable value) { + if (value == null) { + return null; + } + try { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + try (XmlWriter xmlWriter = XmlWriter.toStream(stream)) { + value.toXml(xmlWriter); + xmlWriter.flush(); + } + return BinaryData.fromBytes(stream.toByteArray()); + } catch (XMLStreamException e) { + throw LOGGER.logExceptionAsError(new RuntimeException(e)); + } + } + + /** + * Deserializes an XML {@link BinaryData} protocol response using the provided reader function. + * + * @param data The XML response body, may be {@code null}. + * @param deserializer The {@code fromXml} function of the target type. + * @param The deserialized type. + * @return The deserialized value, or {@code null} if {@code data} is {@code null}. + */ + public static T deserializeXmlBody(BinaryData data, XmlDeserializer deserializer) { + if (data == null) { + return null; + } + try (XmlReader xmlReader = XmlReader.fromBytes(data.toBytes())) { + return deserializer.deserialize(xmlReader); + } catch (XMLStreamException e) { + throw LOGGER.logExceptionAsError(new RuntimeException(e)); + } + } + + /** + * Builds the {@link RequestOptions} for a {@code List Queues} protocol call, translating the typed listing + * parameters into the wire query parameters documented on the generated {@code getQueuesWithResponse} accessor + * ({@code prefix}, {@code marker}, {@code maxresults}, {@code include}). The {@code include} values are sent as a + * single comma-separated query parameter, matching the previous typed implementation method. + * + * @param context The context to thread onto the request, may be {@code null}. + * @param prefix The queue name prefix filter, may be {@code null}. + * @param marker The continuation marker for the page to fetch, may be {@code null}. + * @param maxResults The maximum number of queues per page, may be {@code null}. + * @param include The optional listing details (e.g. {@code metadata}), may be {@code null} or empty. + * @return The configured {@link RequestOptions}. + */ + public static RequestOptions listQueuesRequestOptions(Context context, String prefix, String marker, + Integer maxResults, List include) { + RequestOptions requestOptions = requestOptions(context); + addOptionalQueryParam(requestOptions, "prefix", prefix); + addOptionalQueryParam(requestOptions, "marker", marker); + addOptionalQueryParam(requestOptions, "maxresults", maxResults); + requestOptions.addQueryParam("include", + (include == null || include.isEmpty()) ? "" : String.join(",", include)); + return requestOptions; + } + + /** + * Converts a raw {@code List Queues} protocol response into a {@link PagedResponse} of {@link QueueItem}, preserving + * the {@code NextMarker}-based continuation the hand-written paging depends on. + *

+ * The service returns an empty {@code NextMarker} element on the final page. {@link com.azure.core.http.rest.PagedFlux} + * / {@link com.azure.core.http.rest.PagedIterable} treat any non-null continuation token as "more pages available", + * so an empty marker is normalized to {@code null} to terminate paging (mirroring the {@code len(NextMarker) > 0} + * check the other language SDKs use). + * + * @param response The raw XML list response from {@code getQueuesWithResponse[Async]}. + * @return The page of queue items with the continuation token populated from {@code NextMarker}. + */ + public static PagedResponse toQueueItemPage(Response response) { + ListQueuesSegmentResponse body = deserializeXmlBody(response.getValue(), ListQueuesSegmentResponse::fromXml); + List items = (body == null) ? Collections.emptyList() : body.getQueueItems(); + String nextMarker = (body == null) ? null : body.getNextMarker(); + String continuationToken = (nextMarker == null || nextMarker.isEmpty()) ? null : nextMarker; + return new PagedResponseBase(response.getRequest(), response.getStatusCode(), + response.getHeaders(), items, continuationToken, null); + } + + /** + * Functional interface matching the generated {@code fromXml(XmlReader)} factory methods so protocol responses can + * be deserialized generically. + * + * @param The deserialized type. + */ + @FunctionalInterface + public interface XmlDeserializer { + /** + * Reads an instance of {@code T} from the supplied {@link XmlReader}. + * + * @param reader The XML reader positioned at the response body. + * @return The deserialized value. + * @throws XMLStreamException If the XML is malformed. + */ + T deserialize(XmlReader reader) throws XMLStreamException; + } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java index 467560aa819f..870acfe1dad1 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.models; import com.azure.core.annotation.Fluent; @@ -17,33 +16,32 @@ import javax.xml.stream.XMLStreamException; /** - * The GeoReplication model. + * Geo replication information for the secondary storage location. */ @Fluent public final class GeoReplication implements XmlSerializable { + /* - * The status of the secondary location + * The status of the secondary location. */ @Generated private GeoReplicationStatus status; /* - * A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for - * read operations at the secondary. Primary writes after this point in time may or may not be available for reads. + * A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available + * for read operations at the secondary. Primary writes after this point in time may or may not be available + * for reads. */ @Generated private DateTimeRfc1123 lastSyncTime; - /** - * Creates an instance of GeoReplication class. - */ @Generated public GeoReplication() { } /** * Get the status property: The status of the secondary location. - * + * * @return the status value. */ @Generated @@ -51,12 +49,6 @@ public GeoReplicationStatus getStatus() { return this.status; } - /** - * Set the status property: The status of the secondary location. - * - * @param status the status value to set. - * @return the GeoReplication object itself. - */ @Generated public GeoReplication setStatus(GeoReplicationStatus status) { this.status = status; @@ -65,9 +57,10 @@ public GeoReplication setStatus(GeoReplicationStatus status) { /** * Get the lastSyncTime property: A GMT date/time value, to the second. All primary writes preceding this value are - * guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or - * may not be available for reads. - * + * guaranteed to be available + * for read operations at the secondary. Primary writes after this point in time may or may not be available + * for reads. + * * @return the lastSyncTime value. */ @Generated @@ -78,14 +71,6 @@ public OffsetDateTime getLastSyncTime() { return this.lastSyncTime.getDateTime(); } - /** - * Set the lastSyncTime property: A GMT date/time value, to the second. All primary writes preceding this value are - * guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or - * may not be available for reads. - * - * @param lastSyncTime the lastSyncTime value to set. - * @return the GeoReplication object itself. - */ @Generated public GeoReplication setLastSyncTime(OffsetDateTime lastSyncTime) { if (lastSyncTime == null) { @@ -114,10 +99,11 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of GeoReplication from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of GeoReplication if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the GeoReplication. */ @Generated @@ -127,12 +113,13 @@ public static GeoReplication fromXml(XmlReader xmlReader) throws XMLStreamExcept /** * Reads an instance of GeoReplication from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. * @return An instance of GeoReplication if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the GeoReplication. */ @Generated @@ -140,20 +127,28 @@ public static GeoReplication fromXml(XmlReader xmlReader, String rootElementName String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "GeoReplication" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { - GeoReplication deserializedGeoReplication = new GeoReplication(); + GeoReplicationStatus status = null; + OffsetDateTime lastSyncTime = null; while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("Status".equals(elementName.getLocalPart())) { - deserializedGeoReplication.status = GeoReplicationStatus.fromString(reader.getStringElement()); + status = GeoReplicationStatus.fromString(reader.getStringElement()); } else if ("LastSyncTime".equals(elementName.getLocalPart())) { - deserializedGeoReplication.lastSyncTime = reader.getNullableElement(DateTimeRfc1123::new); + DateTimeRfc1123 lastSyncTimeHolder = reader.getNullableElement(DateTimeRfc1123::new); + if (lastSyncTimeHolder != null) { + lastSyncTime = lastSyncTimeHolder.getDateTime(); + } } else { reader.skipElement(); } } - - return deserializedGeoReplication; + { + GeoReplication deserializedGeoReplication = new GeoReplication(); + deserializedGeoReplication.status = status; + deserializedGeoReplication.lastSyncTime + = lastSyncTime == null ? null : new DateTimeRfc1123(lastSyncTime); + return deserializedGeoReplication; + } }); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplicationStatus.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplicationStatus.java index 19b3566a8434..d763d599c1ac 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplicationStatus.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplicationStatus.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.models; import com.azure.core.annotation.Generated; @@ -9,30 +8,31 @@ import java.util.Collection; /** - * The status of the secondary location. + * The geo replication status. */ public final class GeoReplicationStatus extends ExpandableStringEnum { + /** - * Static value live for GeoReplicationStatus. + * The geo replication is live. */ @Generated public static final GeoReplicationStatus LIVE = fromString("live"); /** - * Static value bootstrap for GeoReplicationStatus. + * The geo replication is bootstrap. */ @Generated public static final GeoReplicationStatus BOOTSTRAP = fromString("bootstrap"); /** - * Static value unavailable for GeoReplicationStatus. + * The geo replication is unavailable. */ @Generated public static final GeoReplicationStatus UNAVAILABLE = fromString("unavailable"); /** * Creates a new instance of GeoReplicationStatus value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Generated @@ -42,7 +42,7 @@ public GeoReplicationStatus() { /** * Creates or finds a GeoReplicationStatus from its string representation. - * + * * @param name a name to look for. * @return the corresponding GeoReplicationStatus. */ @@ -53,7 +53,7 @@ public static GeoReplicationStatus fromString(String name) { /** * Gets known GeoReplicationStatus values. - * + * * @return known GeoReplicationStatus values. */ @Generated diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueAccessPolicy.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueAccessPolicy.java index 21815734cacd..3973a62ef8c3 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueAccessPolicy.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueAccessPolicy.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.models; import com.azure.core.annotation.Fluent; @@ -17,24 +16,25 @@ import javax.xml.stream.XMLStreamException; /** - * An Access policy. + * The access policy. */ @Fluent public final class QueueAccessPolicy implements XmlSerializable { + /* - * the date-time the policy is active + * The date-time the policy is active. */ @Generated private OffsetDateTime startsOn; /* - * the date-time the policy expires + * The date-time the policy expires. */ @Generated private OffsetDateTime expiresOn; /* - * the permissions for the acl policy + * The permissions for the policy. */ @Generated private String permissions; @@ -47,8 +47,8 @@ public QueueAccessPolicy() { } /** - * Get the startsOn property: the date-time the policy is active. - * + * Get the startsOn property: The date-time the policy is active. + * * @return the startsOn value. */ @Generated @@ -57,8 +57,8 @@ public OffsetDateTime getStartsOn() { } /** - * Set the startsOn property: the date-time the policy is active. - * + * Set the startsOn property: The date-time the policy is active. + * * @param startsOn the startsOn value to set. * @return the QueueAccessPolicy object itself. */ @@ -69,8 +69,8 @@ public QueueAccessPolicy setStartsOn(OffsetDateTime startsOn) { } /** - * Get the expiresOn property: the date-time the policy expires. - * + * Get the expiresOn property: The date-time the policy expires. + * * @return the expiresOn value. */ @Generated @@ -79,8 +79,8 @@ public OffsetDateTime getExpiresOn() { } /** - * Set the expiresOn property: the date-time the policy expires. - * + * Set the expiresOn property: The date-time the policy expires. + * * @param expiresOn the expiresOn value to set. * @return the QueueAccessPolicy object itself. */ @@ -91,8 +91,8 @@ public QueueAccessPolicy setExpiresOn(OffsetDateTime expiresOn) { } /** - * Get the permissions property: the permissions for the acl policy. - * + * Get the permissions property: The permissions for the policy. + * * @return the permissions value. */ @Generated @@ -101,8 +101,8 @@ public String getPermissions() { } /** - * Set the permissions property: the permissions for the acl policy. - * + * Set the permissions property: The permissions for the policy. + * * @param permissions the permissions value to set. * @return the QueueAccessPolicy object itself. */ @@ -121,7 +121,7 @@ public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @Generated @Override public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { - rootElementName = rootElementName == null || rootElementName.isEmpty() ? "QueueAccessPolicy" : rootElementName; + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "AccessPolicy" : rootElementName; xmlWriter.writeStartElement(rootElementName); xmlWriter.writeStringElement("Start", this.startsOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startsOn)); @@ -133,7 +133,7 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of QueueAccessPolicy from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of QueueAccessPolicy if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. @@ -146,7 +146,7 @@ public static QueueAccessPolicy fromXml(XmlReader xmlReader) throws XMLStreamExc /** * Reads an instance of QueueAccessPolicy from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. @@ -157,12 +157,11 @@ public static QueueAccessPolicy fromXml(XmlReader xmlReader) throws XMLStreamExc @Generated public static QueueAccessPolicy fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { String finalRootElementName - = rootElementName == null || rootElementName.isEmpty() ? "QueueAccessPolicy" : rootElementName; + = rootElementName == null || rootElementName.isEmpty() ? "AccessPolicy" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { QueueAccessPolicy deserializedQueueAccessPolicy = new QueueAccessPolicy(); while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("Start".equals(elementName.getLocalPart())) { deserializedQueueAccessPolicy.startsOn = reader.getNullableElement(dateString -> CoreUtils.parseBestOffsetDateTime(dateString)); @@ -175,7 +174,6 @@ public static QueueAccessPolicy fromXml(XmlReader xmlReader, String rootElementN reader.skipElement(); } } - return deserializedQueueAccessPolicy; }); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueAnalyticsLogging.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueAnalyticsLogging.java index b7a71fb2f70e..0acd385d90af 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueAnalyticsLogging.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueAnalyticsLogging.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.models; import com.azure.core.annotation.Fluent; @@ -18,46 +17,44 @@ */ @Fluent public final class QueueAnalyticsLogging implements XmlSerializable { + /* - * The version of Storage Analytics to configure. + * The version of the logging properties. */ @Generated private String version; /* - * Indicates whether all delete requests should be logged. + * Whether delete operation is logged. */ @Generated private boolean delete; /* - * Indicates whether all read requests should be logged. + * Whether read operation is logged. */ @Generated private boolean read; /* - * Indicates whether all write requests should be logged. + * Whether write operation is logged. */ @Generated private boolean write; /* - * the retention policy + * The retention policy of the logs. */ @Generated private QueueRetentionPolicy retentionPolicy; - /** - * Creates an instance of QueueAnalyticsLogging class. - */ @Generated public QueueAnalyticsLogging() { } /** - * Get the version property: The version of Storage Analytics to configure. - * + * Get the version property: The version of the logging properties. + * * @return the version value. */ @Generated @@ -65,12 +62,6 @@ public String getVersion() { return this.version; } - /** - * Set the version property: The version of Storage Analytics to configure. - * - * @param version the version value to set. - * @return the QueueAnalyticsLogging object itself. - */ @Generated public QueueAnalyticsLogging setVersion(String version) { this.version = version; @@ -78,8 +69,8 @@ public QueueAnalyticsLogging setVersion(String version) { } /** - * Get the delete property: Indicates whether all delete requests should be logged. - * + * Get the delete property: Whether delete operation is logged. + * * @return the delete value. */ @Generated @@ -87,12 +78,6 @@ public boolean isDelete() { return this.delete; } - /** - * Set the delete property: Indicates whether all delete requests should be logged. - * - * @param delete the delete value to set. - * @return the QueueAnalyticsLogging object itself. - */ @Generated public QueueAnalyticsLogging setDelete(boolean delete) { this.delete = delete; @@ -100,8 +85,8 @@ public QueueAnalyticsLogging setDelete(boolean delete) { } /** - * Get the read property: Indicates whether all read requests should be logged. - * + * Get the read property: Whether read operation is logged. + * * @return the read value. */ @Generated @@ -109,12 +94,6 @@ public boolean isRead() { return this.read; } - /** - * Set the read property: Indicates whether all read requests should be logged. - * - * @param read the read value to set. - * @return the QueueAnalyticsLogging object itself. - */ @Generated public QueueAnalyticsLogging setRead(boolean read) { this.read = read; @@ -122,8 +101,8 @@ public QueueAnalyticsLogging setRead(boolean read) { } /** - * Get the write property: Indicates whether all write requests should be logged. - * + * Get the write property: Whether write operation is logged. + * * @return the write value. */ @Generated @@ -131,12 +110,6 @@ public boolean isWrite() { return this.write; } - /** - * Set the write property: Indicates whether all write requests should be logged. - * - * @param write the write value to set. - * @return the QueueAnalyticsLogging object itself. - */ @Generated public QueueAnalyticsLogging setWrite(boolean write) { this.write = write; @@ -144,8 +117,8 @@ public QueueAnalyticsLogging setWrite(boolean write) { } /** - * Get the retentionPolicy property: the retention policy. - * + * Get the retentionPolicy property: The retention policy of the logs. + * * @return the retentionPolicy value. */ @Generated @@ -153,12 +126,6 @@ public QueueRetentionPolicy getRetentionPolicy() { return this.retentionPolicy; } - /** - * Set the retentionPolicy property: the retention policy. - * - * @param retentionPolicy the retentionPolicy value to set. - * @return the QueueAnalyticsLogging object itself. - */ @Generated public QueueAnalyticsLogging setRetentionPolicy(QueueRetentionPolicy retentionPolicy) { this.retentionPolicy = retentionPolicy; @@ -174,8 +141,7 @@ public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @Generated @Override public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { - rootElementName - = rootElementName == null || rootElementName.isEmpty() ? "QueueAnalyticsLogging" : rootElementName; + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "Logging" : rootElementName; xmlWriter.writeStartElement(rootElementName); xmlWriter.writeStringElement("Version", this.version); xmlWriter.writeBooleanElement("Delete", this.delete); @@ -187,10 +153,11 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of QueueAnalyticsLogging from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of QueueAnalyticsLogging if the XmlReader was pointing to an instance of it, or null if it * was pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueAnalyticsLogging. */ @Generated @@ -200,40 +167,50 @@ public static QueueAnalyticsLogging fromXml(XmlReader xmlReader) throws XMLStrea /** * Reads an instance of QueueAnalyticsLogging from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. * @return An instance of QueueAnalyticsLogging if the XmlReader was pointing to an instance of it, or null if it * was pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueAnalyticsLogging. */ @Generated public static QueueAnalyticsLogging fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { String finalRootElementName - = rootElementName == null || rootElementName.isEmpty() ? "QueueAnalyticsLogging" : rootElementName; + = rootElementName == null || rootElementName.isEmpty() ? "Logging" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { - QueueAnalyticsLogging deserializedQueueAnalyticsLogging = new QueueAnalyticsLogging(); + String version = null; + boolean delete = false; + boolean read = false; + boolean write = false; + QueueRetentionPolicy retentionPolicy = null; while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("Version".equals(elementName.getLocalPart())) { - deserializedQueueAnalyticsLogging.version = reader.getStringElement(); + version = reader.getStringElement(); } else if ("Delete".equals(elementName.getLocalPart())) { - deserializedQueueAnalyticsLogging.delete = reader.getBooleanElement(); + delete = reader.getBooleanElement(); } else if ("Read".equals(elementName.getLocalPart())) { - deserializedQueueAnalyticsLogging.read = reader.getBooleanElement(); + read = reader.getBooleanElement(); } else if ("Write".equals(elementName.getLocalPart())) { - deserializedQueueAnalyticsLogging.write = reader.getBooleanElement(); + write = reader.getBooleanElement(); } else if ("RetentionPolicy".equals(elementName.getLocalPart())) { - deserializedQueueAnalyticsLogging.retentionPolicy - = QueueRetentionPolicy.fromXml(reader, "RetentionPolicy"); + retentionPolicy = QueueRetentionPolicy.fromXml(reader, "RetentionPolicy"); } else { reader.skipElement(); } } - - return deserializedQueueAnalyticsLogging; + { + QueueAnalyticsLogging deserializedQueueAnalyticsLogging = new QueueAnalyticsLogging(); + deserializedQueueAnalyticsLogging.version = version; + deserializedQueueAnalyticsLogging.delete = delete; + deserializedQueueAnalyticsLogging.read = read; + deserializedQueueAnalyticsLogging.write = write; + deserializedQueueAnalyticsLogging.retentionPolicy = retentionPolicy; + return deserializedQueueAnalyticsLogging; + } }); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueCorsRule.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueCorsRule.java index 0b719ffe0efe..14caab32973b 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueCorsRule.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueCorsRule.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.models; import com.azure.core.annotation.Fluent; @@ -14,60 +13,48 @@ import javax.xml.stream.XMLStreamException; /** - * CORS is an HTTP feature that enables a web application running under one domain to access resources in another - * domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from - * calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs - * in another domain. + * The CORS rules. */ @Fluent public final class QueueCorsRule implements XmlSerializable { + /* - * The origin domains that are permitted to make a request against the storage service via CORS. The origin domain - * is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with - * the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all - * origin domains to make requests via CORS. + * The allowed origins. */ @Generated private String allowedOrigins; /* - * The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated) + * The allowed methods. */ @Generated private String allowedMethods; /* - * the request headers that the origin domain may specify on the CORS request. + * The allowed headers. */ @Generated private String allowedHeaders; /* - * The response headers that may be sent in the response to the CORS request and exposed by the browser to the - * request issuer + * The exposed headers. */ @Generated private String exposedHeaders; /* - * The maximum amount time that a browser should cache the preflight OPTIONS request. + * The maximum age in seconds. */ @Generated private int maxAgeInSeconds; - /** - * Creates an instance of QueueCorsRule class. - */ @Generated public QueueCorsRule() { } /** - * Get the allowedOrigins property: The origin domains that are permitted to make a request against the storage - * service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be - * an exact case-sensitive match with the origin that the user age sends to the service. You can also use the - * wildcard character '*' to allow all origin domains to make requests via CORS. - * + * Get the allowedOrigins property: The allowed origins. + * * @return the allowedOrigins value. */ @Generated @@ -75,15 +62,6 @@ public String getAllowedOrigins() { return this.allowedOrigins; } - /** - * Set the allowedOrigins property: The origin domains that are permitted to make a request against the storage - * service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be - * an exact case-sensitive match with the origin that the user age sends to the service. You can also use the - * wildcard character '*' to allow all origin domains to make requests via CORS. - * - * @param allowedOrigins the allowedOrigins value to set. - * @return the QueueCorsRule object itself. - */ @Generated public QueueCorsRule setAllowedOrigins(String allowedOrigins) { this.allowedOrigins = allowedOrigins; @@ -91,9 +69,8 @@ public QueueCorsRule setAllowedOrigins(String allowedOrigins) { } /** - * Get the allowedMethods property: The methods (HTTP request verbs) that the origin domain may use for a CORS - * request. (comma separated). - * + * Get the allowedMethods property: The allowed methods. + * * @return the allowedMethods value. */ @Generated @@ -101,13 +78,6 @@ public String getAllowedMethods() { return this.allowedMethods; } - /** - * Set the allowedMethods property: The methods (HTTP request verbs) that the origin domain may use for a CORS - * request. (comma separated). - * - * @param allowedMethods the allowedMethods value to set. - * @return the QueueCorsRule object itself. - */ @Generated public QueueCorsRule setAllowedMethods(String allowedMethods) { this.allowedMethods = allowedMethods; @@ -115,8 +85,8 @@ public QueueCorsRule setAllowedMethods(String allowedMethods) { } /** - * Get the allowedHeaders property: the request headers that the origin domain may specify on the CORS request. - * + * Get the allowedHeaders property: The allowed headers. + * * @return the allowedHeaders value. */ @Generated @@ -124,12 +94,6 @@ public String getAllowedHeaders() { return this.allowedHeaders; } - /** - * Set the allowedHeaders property: the request headers that the origin domain may specify on the CORS request. - * - * @param allowedHeaders the allowedHeaders value to set. - * @return the QueueCorsRule object itself. - */ @Generated public QueueCorsRule setAllowedHeaders(String allowedHeaders) { this.allowedHeaders = allowedHeaders; @@ -137,9 +101,8 @@ public QueueCorsRule setAllowedHeaders(String allowedHeaders) { } /** - * Get the exposedHeaders property: The response headers that may be sent in the response to the CORS request and - * exposed by the browser to the request issuer. - * + * Get the exposedHeaders property: The exposed headers. + * * @return the exposedHeaders value. */ @Generated @@ -147,13 +110,6 @@ public String getExposedHeaders() { return this.exposedHeaders; } - /** - * Set the exposedHeaders property: The response headers that may be sent in the response to the CORS request and - * exposed by the browser to the request issuer. - * - * @param exposedHeaders the exposedHeaders value to set. - * @return the QueueCorsRule object itself. - */ @Generated public QueueCorsRule setExposedHeaders(String exposedHeaders) { this.exposedHeaders = exposedHeaders; @@ -161,9 +117,8 @@ public QueueCorsRule setExposedHeaders(String exposedHeaders) { } /** - * Get the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS - * request. - * + * Get the maxAgeInSeconds property: The maximum age in seconds. + * * @return the maxAgeInSeconds value. */ @Generated @@ -171,13 +126,6 @@ public int getMaxAgeInSeconds() { return this.maxAgeInSeconds; } - /** - * Set the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS - * request. - * - * @param maxAgeInSeconds the maxAgeInSeconds value to set. - * @return the QueueCorsRule object itself. - */ @Generated public QueueCorsRule setMaxAgeInSeconds(int maxAgeInSeconds) { this.maxAgeInSeconds = maxAgeInSeconds; @@ -205,10 +153,11 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of QueueCorsRule from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of QueueCorsRule if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueCorsRule. */ @Generated @@ -218,12 +167,13 @@ public static QueueCorsRule fromXml(XmlReader xmlReader) throws XMLStreamExcepti /** * Reads an instance of QueueCorsRule from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. * @return An instance of QueueCorsRule if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueCorsRule. */ @Generated @@ -231,26 +181,36 @@ public static QueueCorsRule fromXml(XmlReader xmlReader, String rootElementName) String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "CorsRule" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { - QueueCorsRule deserializedQueueCorsRule = new QueueCorsRule(); + String allowedOrigins = null; + String allowedMethods = null; + String allowedHeaders = null; + String exposedHeaders = null; + int maxAgeInSeconds = 0; while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("AllowedOrigins".equals(elementName.getLocalPart())) { - deserializedQueueCorsRule.allowedOrigins = reader.getStringElement(); + allowedOrigins = reader.getStringElement(); } else if ("AllowedMethods".equals(elementName.getLocalPart())) { - deserializedQueueCorsRule.allowedMethods = reader.getStringElement(); + allowedMethods = reader.getStringElement(); } else if ("AllowedHeaders".equals(elementName.getLocalPart())) { - deserializedQueueCorsRule.allowedHeaders = reader.getStringElement(); + allowedHeaders = reader.getStringElement(); } else if ("ExposedHeaders".equals(elementName.getLocalPart())) { - deserializedQueueCorsRule.exposedHeaders = reader.getStringElement(); + exposedHeaders = reader.getStringElement(); } else if ("MaxAgeInSeconds".equals(elementName.getLocalPart())) { - deserializedQueueCorsRule.maxAgeInSeconds = reader.getIntElement(); + maxAgeInSeconds = reader.getIntElement(); } else { reader.skipElement(); } } - - return deserializedQueueCorsRule; + { + QueueCorsRule deserializedQueueCorsRule = new QueueCorsRule(); + deserializedQueueCorsRule.allowedOrigins = allowedOrigins; + deserializedQueueCorsRule.allowedMethods = allowedMethods; + deserializedQueueCorsRule.allowedHeaders = allowedHeaders; + deserializedQueueCorsRule.exposedHeaders = exposedHeaders; + deserializedQueueCorsRule.maxAgeInSeconds = maxAgeInSeconds; + return deserializedQueueCorsRule; + } }); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueItem.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueItem.java index 1370bd78acf3..76b6b7f20af1 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueItem.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueItem.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.models; import com.azure.core.annotation.Fluent; @@ -20,28 +19,26 @@ */ @Fluent public final class QueueItem implements XmlSerializable { + /* - * The name of the Queue. + * The name of the queue. */ @Generated private String name; /* - * Dictionary of + * The metadata of the queue. */ @Generated private Map metadata; - /** - * Creates an instance of QueueItem class. - */ @Generated public QueueItem() { } /** - * Get the name property: The name of the Queue. - * + * Get the name property: The name of the queue. + * * @return the name value. */ @Generated @@ -49,12 +46,6 @@ public String getName() { return this.name; } - /** - * Set the name property: The name of the Queue. - * - * @param name the name value to set. - * @return the QueueItem object itself. - */ @Generated public QueueItem setName(String name) { this.name = name; @@ -62,8 +53,8 @@ public QueueItem setName(String name) { } /** - * Get the metadata property: Dictionary of <string>. - * + * Get the metadata property: The metadata of the queue. + * * @return the metadata value. */ @Generated @@ -71,12 +62,6 @@ public Map getMetadata() { return this.metadata; } - /** - * Set the metadata property: Dictionary of <string>. - * - * @param metadata the metadata value to set. - * @return the QueueItem object itself. - */ @Generated public QueueItem setMetadata(Map metadata) { this.metadata = metadata; @@ -107,10 +92,11 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of QueueItem from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of QueueItem if the XmlReader was pointing to an instance of it, or null if it was pointing * to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueItem. */ @Generated @@ -120,37 +106,39 @@ public static QueueItem fromXml(XmlReader xmlReader) throws XMLStreamException { /** * Reads an instance of QueueItem from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. * @return An instance of QueueItem if the XmlReader was pointing to an instance of it, or null if it was pointing * to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueItem. */ @Generated public static QueueItem fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "Queue" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { - QueueItem deserializedQueueItem = new QueueItem(); + String name = null; + Map metadata = null; while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("Name".equals(elementName.getLocalPart())) { - deserializedQueueItem.name = reader.getStringElement(); + name = reader.getStringElement(); } else if ("Metadata".equals(elementName.getLocalPart())) { while (reader.nextElement() != XmlToken.END_ELEMENT) { - if (deserializedQueueItem.metadata == null) { - deserializedQueueItem.metadata = new LinkedHashMap<>(); + if (metadata == null) { + metadata = new LinkedHashMap<>(); } - deserializedQueueItem.metadata.put(reader.getElementName().getLocalPart(), - reader.getStringElement()); + metadata.put(reader.getElementName().getLocalPart(), reader.getStringElement()); } } else { reader.skipElement(); } } - + QueueItem deserializedQueueItem = new QueueItem(); + deserializedQueueItem.name = name; + deserializedQueueItem.metadata = metadata; return deserializedQueueItem; }); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueMetrics.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueMetrics.java index 0d2fede2ffb2..f88633ca6b68 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueMetrics.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueMetrics.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.models; import com.azure.core.annotation.Fluent; @@ -14,44 +13,42 @@ import javax.xml.stream.XMLStreamException; /** - * a summary of request statistics grouped by API in hour or minute aggregates for queues. + * The metrics properties. */ @Fluent public final class QueueMetrics implements XmlSerializable { + /* - * The version of Storage Analytics to configure. + * The version of the metrics properties. */ @Generated private String version; /* - * Indicates whether metrics are enabled for the Queue service. + * Whether it is enabled. */ @Generated private boolean enabled; /* - * Indicates whether metrics should generate summary statistics for called API operations. + * Whether to include API in the metrics. */ @Generated private Boolean includeApis; /* - * the retention policy + * The retention policy of the metrics. */ @Generated private QueueRetentionPolicy retentionPolicy; - /** - * Creates an instance of QueueMetrics class. - */ @Generated public QueueMetrics() { } /** - * Get the version property: The version of Storage Analytics to configure. - * + * Get the version property: The version of the metrics properties. + * * @return the version value. */ @Generated @@ -60,8 +57,8 @@ public String getVersion() { } /** - * Set the version property: The version of Storage Analytics to configure. - * + * Set the version property: The version of the metrics properties. + * * @param version the version value to set. * @return the QueueMetrics object itself. */ @@ -72,8 +69,8 @@ public QueueMetrics setVersion(String version) { } /** - * Get the enabled property: Indicates whether metrics are enabled for the Queue service. - * + * Get the enabled property: Whether it is enabled. + * * @return the enabled value. */ @Generated @@ -81,12 +78,6 @@ public boolean isEnabled() { return this.enabled; } - /** - * Set the enabled property: Indicates whether metrics are enabled for the Queue service. - * - * @param enabled the enabled value to set. - * @return the QueueMetrics object itself. - */ @Generated public QueueMetrics setEnabled(boolean enabled) { this.enabled = enabled; @@ -94,9 +85,8 @@ public QueueMetrics setEnabled(boolean enabled) { } /** - * Get the includeApis property: Indicates whether metrics should generate summary statistics for called API - * operations. - * + * Get the includeApis property: Whether to include API in the metrics. + * * @return the includeApis value. */ @Generated @@ -105,9 +95,8 @@ public Boolean isIncludeApis() { } /** - * Set the includeApis property: Indicates whether metrics should generate summary statistics for called API - * operations. - * + * Set the includeApis property: Whether to include API in the metrics. + * * @param includeApis the includeApis value to set. * @return the QueueMetrics object itself. */ @@ -118,8 +107,8 @@ public QueueMetrics setIncludeApis(Boolean includeApis) { } /** - * Get the retentionPolicy property: the retention policy. - * + * Get the retentionPolicy property: The retention policy of the metrics. + * * @return the retentionPolicy value. */ @Generated @@ -128,8 +117,8 @@ public QueueRetentionPolicy getRetentionPolicy() { } /** - * Set the retentionPolicy property: the retention policy. - * + * Set the retentionPolicy property: The retention policy of the metrics. + * * @param retentionPolicy the retentionPolicy value to set. * @return the QueueMetrics object itself. */ @@ -148,7 +137,7 @@ public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @Generated @Override public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { - rootElementName = rootElementName == null || rootElementName.isEmpty() ? "QueueMetrics" : rootElementName; + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "Metrics" : rootElementName; xmlWriter.writeStartElement(rootElementName); xmlWriter.writeStringElement("Version", this.version); xmlWriter.writeBooleanElement("Enabled", this.enabled); @@ -159,10 +148,11 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of QueueMetrics from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of QueueMetrics if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueMetrics. */ @Generated @@ -172,36 +162,43 @@ public static QueueMetrics fromXml(XmlReader xmlReader) throws XMLStreamExceptio /** * Reads an instance of QueueMetrics from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. * @return An instance of QueueMetrics if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueMetrics. */ @Generated public static QueueMetrics fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { String finalRootElementName - = rootElementName == null || rootElementName.isEmpty() ? "QueueMetrics" : rootElementName; + = rootElementName == null || rootElementName.isEmpty() ? "Metrics" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { - QueueMetrics deserializedQueueMetrics = new QueueMetrics(); + String version = null; + boolean enabled = false; + Boolean includeApis = null; + QueueRetentionPolicy retentionPolicy = null; while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("Version".equals(elementName.getLocalPart())) { - deserializedQueueMetrics.version = reader.getStringElement(); + version = reader.getStringElement(); } else if ("Enabled".equals(elementName.getLocalPart())) { - deserializedQueueMetrics.enabled = reader.getBooleanElement(); + enabled = reader.getBooleanElement(); } else if ("IncludeAPIs".equals(elementName.getLocalPart())) { - deserializedQueueMetrics.includeApis = reader.getNullableElement(Boolean::parseBoolean); + includeApis = reader.getNullableElement(Boolean::parseBoolean); } else if ("RetentionPolicy".equals(elementName.getLocalPart())) { - deserializedQueueMetrics.retentionPolicy = QueueRetentionPolicy.fromXml(reader, "RetentionPolicy"); + retentionPolicy = QueueRetentionPolicy.fromXml(reader, "RetentionPolicy"); } else { reader.skipElement(); } } - + QueueMetrics deserializedQueueMetrics = new QueueMetrics(); + deserializedQueueMetrics.enabled = enabled; + deserializedQueueMetrics.version = version; + deserializedQueueMetrics.includeApis = includeApis; + deserializedQueueMetrics.retentionPolicy = retentionPolicy; return deserializedQueueMetrics; }); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueRetentionPolicy.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueRetentionPolicy.java index 8f307fa6fb6a..2f54272e1c87 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueRetentionPolicy.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueRetentionPolicy.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.models; import com.azure.core.annotation.Fluent; @@ -14,33 +13,30 @@ import javax.xml.stream.XMLStreamException; /** - * the retention policy. + * The retention policy. */ @Fluent public final class QueueRetentionPolicy implements XmlSerializable { + /* - * Indicates whether a retention policy is enabled for the storage service + * Whether to enable the retention policy. */ @Generated private boolean enabled; /* - * Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than - * this value will be deleted + * The number of days to retain the logs. */ @Generated private Integer days; - /** - * Creates an instance of QueueRetentionPolicy class. - */ @Generated public QueueRetentionPolicy() { } /** - * Get the enabled property: Indicates whether a retention policy is enabled for the storage service. - * + * Get the enabled property: Whether to enable the retention policy. + * * @return the enabled value. */ @Generated @@ -48,12 +44,6 @@ public boolean isEnabled() { return this.enabled; } - /** - * Set the enabled property: Indicates whether a retention policy is enabled for the storage service. - * - * @param enabled the enabled value to set. - * @return the QueueRetentionPolicy object itself. - */ @Generated public QueueRetentionPolicy setEnabled(boolean enabled) { this.enabled = enabled; @@ -61,9 +51,8 @@ public QueueRetentionPolicy setEnabled(boolean enabled) { } /** - * Get the days property: Indicates the number of days that metrics or logging or soft-deleted data should be - * retained. All data older than this value will be deleted. - * + * Get the days property: The number of days to retain the logs. + * * @return the days value. */ @Generated @@ -72,9 +61,8 @@ public Integer getDays() { } /** - * Set the days property: Indicates the number of days that metrics or logging or soft-deleted data should be - * retained. All data older than this value will be deleted. - * + * Set the days property: The number of days to retain the logs. + * * @param days the days value to set. * @return the QueueRetentionPolicy object itself. */ @@ -93,8 +81,7 @@ public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @Generated @Override public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { - rootElementName - = rootElementName == null || rootElementName.isEmpty() ? "QueueRetentionPolicy" : rootElementName; + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "RetentionPolicy" : rootElementName; xmlWriter.writeStartElement(rootElementName); xmlWriter.writeBooleanElement("Enabled", this.enabled); xmlWriter.writeNumberElement("Days", this.days); @@ -103,10 +90,11 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of QueueRetentionPolicy from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of QueueRetentionPolicy if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueRetentionPolicy. */ @Generated @@ -116,32 +104,35 @@ public static QueueRetentionPolicy fromXml(XmlReader xmlReader) throws XMLStream /** * Reads an instance of QueueRetentionPolicy from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. * @return An instance of QueueRetentionPolicy if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueRetentionPolicy. */ @Generated public static QueueRetentionPolicy fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { String finalRootElementName - = rootElementName == null || rootElementName.isEmpty() ? "QueueRetentionPolicy" : rootElementName; + = rootElementName == null || rootElementName.isEmpty() ? "RetentionPolicy" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { - QueueRetentionPolicy deserializedQueueRetentionPolicy = new QueueRetentionPolicy(); + boolean enabled = false; + Integer days = null; while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("Enabled".equals(elementName.getLocalPart())) { - deserializedQueueRetentionPolicy.enabled = reader.getBooleanElement(); + enabled = reader.getBooleanElement(); } else if ("Days".equals(elementName.getLocalPart())) { - deserializedQueueRetentionPolicy.days = reader.getNullableElement(Integer::parseInt); + days = reader.getNullableElement(Integer::parseInt); } else { reader.skipElement(); } } - + QueueRetentionPolicy deserializedQueueRetentionPolicy = new QueueRetentionPolicy(); + deserializedQueueRetentionPolicy.enabled = enabled; + deserializedQueueRetentionPolicy.days = days; return deserializedQueueRetentionPolicy; }); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueServiceProperties.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueServiceProperties.java index 23a24ecd9c1d..54ce1163313c 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueServiceProperties.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueServiceProperties.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.models; import com.azure.core.annotation.Fluent; @@ -16,30 +15,25 @@ import javax.xml.stream.XMLStreamException; /** - * Storage Service Properties. + * The service properties. */ @Fluent public final class QueueServiceProperties implements XmlSerializable { - /* - * Azure Analytics Logging settings - */ - @Generated - private QueueAnalyticsLogging analyticsLogging; /* - * A summary of request statistics grouped by API in hourly aggregates for queues + * The hour metrics properties. */ @Generated private QueueMetrics hourMetrics; /* - * a summary of request statistics grouped by API in minute aggregates for queues + * The minute metrics properties. */ @Generated private QueueMetrics minuteMetrics; /* - * The set of CORS rules. + * The CORS properties. */ @Generated private List cors; @@ -52,30 +46,8 @@ public QueueServiceProperties() { } /** - * Get the analyticsLogging property: Azure Analytics Logging settings. - * - * @return the analyticsLogging value. - */ - @Generated - public QueueAnalyticsLogging getAnalyticsLogging() { - return this.analyticsLogging; - } - - /** - * Set the analyticsLogging property: Azure Analytics Logging settings. - * - * @param analyticsLogging the analyticsLogging value to set. - * @return the QueueServiceProperties object itself. - */ - @Generated - public QueueServiceProperties setAnalyticsLogging(QueueAnalyticsLogging analyticsLogging) { - this.analyticsLogging = analyticsLogging; - return this; - } - - /** - * Get the hourMetrics property: A summary of request statistics grouped by API in hourly aggregates for queues. - * + * Get the hourMetrics property: The hour metrics properties. + * * @return the hourMetrics value. */ @Generated @@ -84,20 +56,8 @@ public QueueMetrics getHourMetrics() { } /** - * Set the hourMetrics property: A summary of request statistics grouped by API in hourly aggregates for queues. - * - * @param hourMetrics the hourMetrics value to set. - * @return the QueueServiceProperties object itself. - */ - @Generated - public QueueServiceProperties setHourMetrics(QueueMetrics hourMetrics) { - this.hourMetrics = hourMetrics; - return this; - } - - /** - * Get the minuteMetrics property: a summary of request statistics grouped by API in minute aggregates for queues. - * + * Get the minuteMetrics property: The minute metrics properties. + * * @return the minuteMetrics value. */ @Generated @@ -106,20 +66,8 @@ public QueueMetrics getMinuteMetrics() { } /** - * Set the minuteMetrics property: a summary of request statistics grouped by API in minute aggregates for queues. - * - * @param minuteMetrics the minuteMetrics value to set. - * @return the QueueServiceProperties object itself. - */ - @Generated - public QueueServiceProperties setMinuteMetrics(QueueMetrics minuteMetrics) { - this.minuteMetrics = minuteMetrics; - return this; - } - - /** - * Get the cors property: The set of CORS rules. - * + * Get the cors property: The CORS properties. + * * @return the cors value. */ @Generated @@ -131,8 +79,8 @@ public List getCors() { } /** - * Set the cors property: The set of CORS rules. - * + * Set the cors property: The CORS properties. + * * @param cors the cors value to set. * @return the QueueServiceProperties object itself. */ @@ -169,7 +117,7 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of QueueServiceProperties from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of QueueServiceProperties if the XmlReader was pointing to an instance of it, or null if it * was pointing to XML null. @@ -182,7 +130,7 @@ public static QueueServiceProperties fromXml(XmlReader xmlReader) throws XMLStre /** * Reads an instance of QueueServiceProperties from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. @@ -199,7 +147,6 @@ public static QueueServiceProperties fromXml(XmlReader xmlReader, String rootEle QueueServiceProperties deserializedQueueServiceProperties = new QueueServiceProperties(); while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("Logging".equals(elementName.getLocalPart())) { deserializedQueueServiceProperties.analyticsLogging = QueueAnalyticsLogging.fromXml(reader, "Logging"); @@ -223,8 +170,59 @@ public static QueueServiceProperties fromXml(XmlReader xmlReader, String rootEle reader.skipElement(); } } - return deserializedQueueServiceProperties; }); } + + /* + * The logging properties. + */ + @Generated + private QueueAnalyticsLogging analyticsLogging; + + /** + * Get the analyticsLogging property: The logging properties. + * + * @return the analyticsLogging value. + */ + @Generated + public QueueAnalyticsLogging getAnalyticsLogging() { + return this.analyticsLogging; + } + + /** + * Set the analyticsLogging property: The logging properties. + * + * @param analyticsLogging the analyticsLogging value to set. + * @return the QueueServiceProperties object itself. + */ + @Generated + public QueueServiceProperties setAnalyticsLogging(QueueAnalyticsLogging analyticsLogging) { + this.analyticsLogging = analyticsLogging; + return this; + } + + /** + * Set the hourMetrics property: The hour metrics properties. + * + * @param hourMetrics the hourMetrics value to set. + * @return the QueueServiceProperties object itself. + */ + @Generated + public QueueServiceProperties setHourMetrics(QueueMetrics hourMetrics) { + this.hourMetrics = hourMetrics; + return this; + } + + /** + * Set the minuteMetrics property: The minute metrics properties. + * + * @param minuteMetrics the minuteMetrics value to set. + * @return the QueueServiceProperties object itself. + */ + @Generated + public QueueServiceProperties setMinuteMetrics(QueueMetrics minuteMetrics) { + this.minuteMetrics = minuteMetrics; + return this; + } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueServiceStatistics.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueServiceStatistics.java index bddc1df10804..62921faa7ba6 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueServiceStatistics.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueServiceStatistics.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.models; import com.azure.core.annotation.Fluent; @@ -14,26 +13,24 @@ import javax.xml.stream.XMLStreamException; /** - * Stats for the storage service. + * Statistics for the storage queue service. */ @Fluent public final class QueueServiceStatistics implements XmlSerializable { + /* - * Geo-Replication information for the Secondary Storage Service + * The geo replication stats. */ @Generated private GeoReplication geoReplication; - /** - * Creates an instance of QueueServiceStatistics class. - */ @Generated public QueueServiceStatistics() { } /** - * Get the geoReplication property: Geo-Replication information for the Secondary Storage Service. - * + * Get the geoReplication property: The geo replication stats. + * * @return the geoReplication value. */ @Generated @@ -41,12 +38,6 @@ public GeoReplication getGeoReplication() { return this.geoReplication; } - /** - * Set the geoReplication property: Geo-Replication information for the Secondary Storage Service. - * - * @param geoReplication the geoReplication value to set. - * @return the QueueServiceStatistics object itself. - */ @Generated public QueueServiceStatistics setGeoReplication(GeoReplication geoReplication) { this.geoReplication = geoReplication; @@ -62,8 +53,7 @@ public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @Generated @Override public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { - rootElementName - = rootElementName == null || rootElementName.isEmpty() ? "QueueServiceStatistics" : rootElementName; + rootElementName = rootElementName == null || rootElementName.isEmpty() ? "QueueServiceStats" : rootElementName; xmlWriter.writeStartElement(rootElementName); xmlWriter.writeXml(this.geoReplication, "GeoReplication"); return xmlWriter.writeEndElement(); @@ -71,7 +61,7 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of QueueServiceStatistics from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of QueueServiceStatistics if the XmlReader was pointing to an instance of it, or null if it * was pointing to XML null. @@ -84,7 +74,7 @@ public static QueueServiceStatistics fromXml(XmlReader xmlReader) throws XMLStre /** * Reads an instance of QueueServiceStatistics from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. @@ -96,12 +86,11 @@ public static QueueServiceStatistics fromXml(XmlReader xmlReader) throws XMLStre public static QueueServiceStatistics fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { String finalRootElementName - = rootElementName == null || rootElementName.isEmpty() ? "QueueServiceStatistics" : rootElementName; + = rootElementName == null || rootElementName.isEmpty() ? "QueueServiceStats" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { QueueServiceStatistics deserializedQueueServiceStatistics = new QueueServiceStatistics(); while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("GeoReplication".equals(elementName.getLocalPart())) { deserializedQueueServiceStatistics.geoReplication = GeoReplication.fromXml(reader, "GeoReplication"); @@ -109,7 +98,6 @@ public static QueueServiceStatistics fromXml(XmlReader xmlReader, String rootEle reader.skipElement(); } } - return deserializedQueueServiceStatistics; }); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSignedIdentifier.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSignedIdentifier.java index c96d2a6e36f5..111b7859981f 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSignedIdentifier.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSignedIdentifier.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.models; import com.azure.core.annotation.Fluent; @@ -14,32 +13,30 @@ import javax.xml.stream.XMLStreamException; /** - * signed identifier. + * The signed identifier. */ @Fluent public final class QueueSignedIdentifier implements XmlSerializable { + /* - * a unique id + * The unique ID for the signed identifier. */ @Generated private String id; /* - * The access policy + * The access policy for the signed identifier. */ @Generated private QueueAccessPolicy accessPolicy; - /** - * Creates an instance of QueueSignedIdentifier class. - */ @Generated public QueueSignedIdentifier() { } /** - * Get the id property: a unique id. - * + * Get the id property: The unique ID for the signed identifier. + * * @return the id value. */ @Generated @@ -47,12 +44,6 @@ public String getId() { return this.id; } - /** - * Set the id property: a unique id. - * - * @param id the id value to set. - * @return the QueueSignedIdentifier object itself. - */ @Generated public QueueSignedIdentifier setId(String id) { this.id = id; @@ -60,8 +51,8 @@ public QueueSignedIdentifier setId(String id) { } /** - * Get the accessPolicy property: The access policy. - * + * Get the accessPolicy property: The access policy for the signed identifier. + * * @return the accessPolicy value. */ @Generated @@ -69,12 +60,6 @@ public QueueAccessPolicy getAccessPolicy() { return this.accessPolicy; } - /** - * Set the accessPolicy property: The access policy. - * - * @param accessPolicy the accessPolicy value to set. - * @return the QueueSignedIdentifier object itself. - */ @Generated public QueueSignedIdentifier setAccessPolicy(QueueAccessPolicy accessPolicy) { this.accessPolicy = accessPolicy; @@ -99,10 +84,11 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of QueueSignedIdentifier from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of QueueSignedIdentifier if the XmlReader was pointing to an instance of it, or null if it * was pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueSignedIdentifier. */ @Generated @@ -112,12 +98,13 @@ public static QueueSignedIdentifier fromXml(XmlReader xmlReader) throws XMLStrea /** * Reads an instance of QueueSignedIdentifier from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. * @return An instance of QueueSignedIdentifier if the XmlReader was pointing to an instance of it, or null if it * was pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the QueueSignedIdentifier. */ @Generated @@ -125,20 +112,24 @@ public static QueueSignedIdentifier fromXml(XmlReader xmlReader, String rootElem String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "SignedIdentifier" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { - QueueSignedIdentifier deserializedQueueSignedIdentifier = new QueueSignedIdentifier(); + String id = null; + QueueAccessPolicy accessPolicy = null; while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("Id".equals(elementName.getLocalPart())) { - deserializedQueueSignedIdentifier.id = reader.getStringElement(); + id = reader.getStringElement(); } else if ("AccessPolicy".equals(elementName.getLocalPart())) { - deserializedQueueSignedIdentifier.accessPolicy = QueueAccessPolicy.fromXml(reader, "AccessPolicy"); + accessPolicy = QueueAccessPolicy.fromXml(reader, "AccessPolicy"); } else { reader.skipElement(); } } - - return deserializedQueueSignedIdentifier; + { + QueueSignedIdentifier deserializedQueueSignedIdentifier = new QueueSignedIdentifier(); + deserializedQueueSignedIdentifier.id = id; + deserializedQueueSignedIdentifier.accessPolicy = accessPolicy; + return deserializedQueueSignedIdentifier; + } }); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/SendMessageResult.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/SendMessageResult.java index 954e7d01ee97..e55244afb301 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/SendMessageResult.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/SendMessageResult.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.models; import com.azure.core.annotation.Fluent; @@ -17,51 +16,49 @@ import javax.xml.stream.XMLStreamException; /** - * The object returned in the QueueMessageList array when calling Put Message on a Queue. + * The sent queue message. */ @Fluent public final class SendMessageResult implements XmlSerializable { + /* - * The Id of the Message. + * The ID of the message. */ @Generated private String messageId; /* - * The time the Message was inserted into the Queue. + * The time the message was inserted into the queue. */ @Generated private DateTimeRfc1123 insertionTime; /* - * The time that the Message will expire and be automatically deleted. + * The time that the message will expire and be automatically deleted. */ @Generated private DateTimeRfc1123 expirationTime; /* - * This value is required to delete the Message. If deletion fails using this popreceipt then the message has been - * dequeued by another client. + * An opaque value required to delete the message. If deletion fails using this + * PopReceipt then the message has been dequeued by another client. */ @Generated private String popReceipt; /* - * The time that the message will again become visible in the Queue. + * The time that the message will again become visible in the queue. */ @Generated private DateTimeRfc1123 timeNextVisible; - /** - * Creates an instance of SendMessageResult class. - */ @Generated public SendMessageResult() { } /** - * Get the messageId property: The Id of the Message. - * + * Get the messageId property: The ID of the message. + * * @return the messageId value. */ @Generated @@ -69,12 +66,6 @@ public String getMessageId() { return this.messageId; } - /** - * Set the messageId property: The Id of the Message. - * - * @param messageId the messageId value to set. - * @return the SendMessageResult object itself. - */ @Generated public SendMessageResult setMessageId(String messageId) { this.messageId = messageId; @@ -82,8 +73,8 @@ public SendMessageResult setMessageId(String messageId) { } /** - * Get the insertionTime property: The time the Message was inserted into the Queue. - * + * Get the insertionTime property: The time the message was inserted into the queue. + * * @return the insertionTime value. */ @Generated @@ -94,12 +85,6 @@ public OffsetDateTime getInsertionTime() { return this.insertionTime.getDateTime(); } - /** - * Set the insertionTime property: The time the Message was inserted into the Queue. - * - * @param insertionTime the insertionTime value to set. - * @return the SendMessageResult object itself. - */ @Generated public SendMessageResult setInsertionTime(OffsetDateTime insertionTime) { if (insertionTime == null) { @@ -111,8 +96,8 @@ public SendMessageResult setInsertionTime(OffsetDateTime insertionTime) { } /** - * Get the expirationTime property: The time that the Message will expire and be automatically deleted. - * + * Get the expirationTime property: The time that the message will expire and be automatically deleted. + * * @return the expirationTime value. */ @Generated @@ -123,12 +108,6 @@ public OffsetDateTime getExpirationTime() { return this.expirationTime.getDateTime(); } - /** - * Set the expirationTime property: The time that the Message will expire and be automatically deleted. - * - * @param expirationTime the expirationTime value to set. - * @return the SendMessageResult object itself. - */ @Generated public SendMessageResult setExpirationTime(OffsetDateTime expirationTime) { if (expirationTime == null) { @@ -140,9 +119,9 @@ public SendMessageResult setExpirationTime(OffsetDateTime expirationTime) { } /** - * Get the popReceipt property: This value is required to delete the Message. If deletion fails using this - * popreceipt then the message has been dequeued by another client. - * + * Get the popReceipt property: An opaque value required to delete the message. If deletion fails using this + * PopReceipt then the message has been dequeued by another client. + * * @return the popReceipt value. */ @Generated @@ -150,13 +129,6 @@ public String getPopReceipt() { return this.popReceipt; } - /** - * Set the popReceipt property: This value is required to delete the Message. If deletion fails using this - * popreceipt then the message has been dequeued by another client. - * - * @param popReceipt the popReceipt value to set. - * @return the SendMessageResult object itself. - */ @Generated public SendMessageResult setPopReceipt(String popReceipt) { this.popReceipt = popReceipt; @@ -164,8 +136,8 @@ public SendMessageResult setPopReceipt(String popReceipt) { } /** - * Get the timeNextVisible property: The time that the message will again become visible in the Queue. - * + * Get the timeNextVisible property: The time that the message will again become visible in the queue. + * * @return the timeNextVisible value. */ @Generated @@ -176,12 +148,6 @@ public OffsetDateTime getTimeNextVisible() { return this.timeNextVisible.getDateTime(); } - /** - * Set the timeNextVisible property: The time that the message will again become visible in the Queue. - * - * @param timeNextVisible the timeNextVisible value to set. - * @return the SendMessageResult object itself. - */ @Generated public SendMessageResult setTimeNextVisible(OffsetDateTime timeNextVisible) { if (timeNextVisible == null) { @@ -213,10 +179,11 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of SendMessageResult from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of SendMessageResult if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the SendMessageResult. */ @Generated @@ -226,12 +193,13 @@ public static SendMessageResult fromXml(XmlReader xmlReader) throws XMLStreamExc /** * Reads an instance of SendMessageResult from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. * @return An instance of SendMessageResult if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the SendMessageResult. */ @Generated @@ -239,26 +207,48 @@ public static SendMessageResult fromXml(XmlReader xmlReader, String rootElementN String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "QueueMessage" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { - SendMessageResult deserializedSendMessageResult = new SendMessageResult(); + String messageId = null; + OffsetDateTime insertionTime = null; + OffsetDateTime expirationTime = null; + String popReceipt = null; + OffsetDateTime timeNextVisible = null; while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("MessageId".equals(elementName.getLocalPart())) { - deserializedSendMessageResult.messageId = reader.getStringElement(); + messageId = reader.getStringElement(); } else if ("InsertionTime".equals(elementName.getLocalPart())) { - deserializedSendMessageResult.insertionTime = reader.getNullableElement(DateTimeRfc1123::new); + DateTimeRfc1123 insertionTimeHolder = reader.getNullableElement(DateTimeRfc1123::new); + if (insertionTimeHolder != null) { + insertionTime = insertionTimeHolder.getDateTime(); + } } else if ("ExpirationTime".equals(elementName.getLocalPart())) { - deserializedSendMessageResult.expirationTime = reader.getNullableElement(DateTimeRfc1123::new); + DateTimeRfc1123 expirationTimeHolder = reader.getNullableElement(DateTimeRfc1123::new); + if (expirationTimeHolder != null) { + expirationTime = expirationTimeHolder.getDateTime(); + } } else if ("PopReceipt".equals(elementName.getLocalPart())) { - deserializedSendMessageResult.popReceipt = reader.getStringElement(); + popReceipt = reader.getStringElement(); } else if ("TimeNextVisible".equals(elementName.getLocalPart())) { - deserializedSendMessageResult.timeNextVisible = reader.getNullableElement(DateTimeRfc1123::new); + DateTimeRfc1123 timeNextVisibleHolder = reader.getNullableElement(DateTimeRfc1123::new); + if (timeNextVisibleHolder != null) { + timeNextVisible = timeNextVisibleHolder.getDateTime(); + } } else { reader.skipElement(); } } - - return deserializedSendMessageResult; + { + SendMessageResult deserializedSendMessageResult = new SendMessageResult(); + deserializedSendMessageResult.messageId = messageId; + deserializedSendMessageResult.insertionTime + = insertionTime == null ? null : new DateTimeRfc1123(insertionTime); + deserializedSendMessageResult.expirationTime + = expirationTime == null ? null : new DateTimeRfc1123(expirationTime); + deserializedSendMessageResult.popReceipt = popReceipt; + deserializedSendMessageResult.timeNextVisible + = timeNextVisible == null ? null : new DateTimeRfc1123(timeNextVisible); + return deserializedSendMessageResult; + } }); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/UserDelegationKey.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/UserDelegationKey.java index 2fcd3e82e525..af3fb6db03d4 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/UserDelegationKey.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/UserDelegationKey.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.storage.queue.models; import com.azure.core.annotation.Fluent; @@ -21,108 +20,44 @@ */ @Fluent public final class UserDelegationKey implements XmlSerializable { - /* - * The Azure Active Directory object ID in GUID format. - */ - @Generated - private String signedObjectId; - - /* - * The Azure Active Directory tenant ID in GUID format - */ - @Generated - private String signedTenantId; /* - * The date-time the key is active + * The date-time the key is active. */ @Generated private OffsetDateTime signedStart; /* - * The date-time the key expires + * The date-time the key expires. */ @Generated private OffsetDateTime signedExpiry; /* - * Abbreviation of the Azure Storage service that accepts the key + * The service that created the key. */ @Generated private String signedService; /* - * The service version that created the key + * The service version used when creating the key. */ @Generated private String signedVersion; /* - * The delegated user tenant id in Azure AD. Return if DelegatedUserTid is specified. - */ - @Generated - private String signedDelegatedUserTenantId; - - /* - * The key as a base64 string + * The key as a base64 string. */ @Generated private String value; - /** - * Creates an instance of UserDelegationKey class. - */ @Generated public UserDelegationKey() { } - /** - * Get the signedObjectId property: The Azure Active Directory object ID in GUID format. - * - * @return the signedObjectId value. - */ - @Generated - public String getSignedObjectId() { - return this.signedObjectId; - } - - /** - * Set the signedObjectId property: The Azure Active Directory object ID in GUID format. - * - * @param signedObjectId the signedObjectId value to set. - * @return the UserDelegationKey object itself. - */ - @Generated - public UserDelegationKey setSignedObjectId(String signedObjectId) { - this.signedObjectId = signedObjectId; - return this; - } - - /** - * Get the signedTenantId property: The Azure Active Directory tenant ID in GUID format. - * - * @return the signedTenantId value. - */ - @Generated - public String getSignedTenantId() { - return this.signedTenantId; - } - - /** - * Set the signedTenantId property: The Azure Active Directory tenant ID in GUID format. - * - * @param signedTenantId the signedTenantId value to set. - * @return the UserDelegationKey object itself. - */ - @Generated - public UserDelegationKey setSignedTenantId(String signedTenantId) { - this.signedTenantId = signedTenantId; - return this; - } - /** * Get the signedStart property: The date-time the key is active. - * + * * @return the signedStart value. */ @Generated @@ -130,12 +65,6 @@ public OffsetDateTime getSignedStart() { return this.signedStart; } - /** - * Set the signedStart property: The date-time the key is active. - * - * @param signedStart the signedStart value to set. - * @return the UserDelegationKey object itself. - */ @Generated public UserDelegationKey setSignedStart(OffsetDateTime signedStart) { this.signedStart = signedStart; @@ -144,7 +73,7 @@ public UserDelegationKey setSignedStart(OffsetDateTime signedStart) { /** * Get the signedExpiry property: The date-time the key expires. - * + * * @return the signedExpiry value. */ @Generated @@ -152,12 +81,6 @@ public OffsetDateTime getSignedExpiry() { return this.signedExpiry; } - /** - * Set the signedExpiry property: The date-time the key expires. - * - * @param signedExpiry the signedExpiry value to set. - * @return the UserDelegationKey object itself. - */ @Generated public UserDelegationKey setSignedExpiry(OffsetDateTime signedExpiry) { this.signedExpiry = signedExpiry; @@ -165,8 +88,8 @@ public UserDelegationKey setSignedExpiry(OffsetDateTime signedExpiry) { } /** - * Get the signedService property: Abbreviation of the Azure Storage service that accepts the key. - * + * Get the signedService property: The service that created the key. + * * @return the signedService value. */ @Generated @@ -174,12 +97,6 @@ public String getSignedService() { return this.signedService; } - /** - * Set the signedService property: Abbreviation of the Azure Storage service that accepts the key. - * - * @param signedService the signedService value to set. - * @return the UserDelegationKey object itself. - */ @Generated public UserDelegationKey setSignedService(String signedService) { this.signedService = signedService; @@ -187,8 +104,8 @@ public UserDelegationKey setSignedService(String signedService) { } /** - * Get the signedVersion property: The service version that created the key. - * + * Get the signedVersion property: The service version used when creating the key. + * * @return the signedVersion value. */ @Generated @@ -196,45 +113,15 @@ public String getSignedVersion() { return this.signedVersion; } - /** - * Set the signedVersion property: The service version that created the key. - * - * @param signedVersion the signedVersion value to set. - * @return the UserDelegationKey object itself. - */ @Generated public UserDelegationKey setSignedVersion(String signedVersion) { this.signedVersion = signedVersion; return this; } - /** - * Get the signedDelegatedUserTenantId property: The delegated user tenant id in Azure AD. Return if - * DelegatedUserTid is specified. - * - * @return the signedDelegatedUserTenantId value. - */ - @Generated - public String getSignedDelegatedUserTenantId() { - return this.signedDelegatedUserTenantId; - } - - /** - * Set the signedDelegatedUserTenantId property: The delegated user tenant id in Azure AD. Return if - * DelegatedUserTid is specified. - * - * @param signedDelegatedUserTenantId the signedDelegatedUserTenantId value to set. - * @return the UserDelegationKey object itself. - */ - @Generated - public UserDelegationKey setSignedDelegatedUserTenantId(String signedDelegatedUserTenantId) { - this.signedDelegatedUserTenantId = signedDelegatedUserTenantId; - return this; - } - /** * Get the value property: The key as a base64 string. - * + * * @return the value value. */ @Generated @@ -242,12 +129,6 @@ public String getValue() { return this.value; } - /** - * Set the value property: The key as a base64 string. - * - * @param value the value value to set. - * @return the UserDelegationKey object itself. - */ @Generated public UserDelegationKey setValue(String value) { this.value = value; @@ -280,10 +161,11 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of UserDelegationKey from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of UserDelegationKey if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the UserDelegationKey. */ @Generated @@ -293,12 +175,13 @@ public static UserDelegationKey fromXml(XmlReader xmlReader) throws XMLStreamExc /** * Reads an instance of UserDelegationKey from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. * @return An instance of UserDelegationKey if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. + * @throws IllegalStateException If the deserialized XML object was missing any required properties. * @throws XMLStreamException If an error occurs while reading the UserDelegationKey. */ @Generated @@ -306,34 +189,115 @@ public static UserDelegationKey fromXml(XmlReader xmlReader, String rootElementN String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "UserDelegationKey" : rootElementName; return xmlReader.readObject(finalRootElementName, reader -> { - UserDelegationKey deserializedUserDelegationKey = new UserDelegationKey(); + String signedObjectId = null; + String signedTenantId = null; + OffsetDateTime signedStart = null; + OffsetDateTime signedExpiry = null; + String signedService = null; + String signedVersion = null; + String signedDelegatedUserTenantId = null; + String value = null; while (reader.nextElement() != XmlToken.END_ELEMENT) { QName elementName = reader.getElementName(); - if ("SignedOid".equals(elementName.getLocalPart())) { - deserializedUserDelegationKey.signedObjectId = reader.getStringElement(); + signedObjectId = reader.getStringElement(); } else if ("SignedTid".equals(elementName.getLocalPart())) { - deserializedUserDelegationKey.signedTenantId = reader.getStringElement(); + signedTenantId = reader.getStringElement(); } else if ("SignedStart".equals(elementName.getLocalPart())) { - deserializedUserDelegationKey.signedStart + signedStart = reader.getNullableElement(dateString -> CoreUtils.parseBestOffsetDateTime(dateString)); } else if ("SignedExpiry".equals(elementName.getLocalPart())) { - deserializedUserDelegationKey.signedExpiry + signedExpiry = reader.getNullableElement(dateString -> CoreUtils.parseBestOffsetDateTime(dateString)); } else if ("SignedService".equals(elementName.getLocalPart())) { - deserializedUserDelegationKey.signedService = reader.getStringElement(); + signedService = reader.getStringElement(); } else if ("SignedVersion".equals(elementName.getLocalPart())) { - deserializedUserDelegationKey.signedVersion = reader.getStringElement(); + signedVersion = reader.getStringElement(); } else if ("SignedDelegatedUserTid".equals(elementName.getLocalPart())) { - deserializedUserDelegationKey.signedDelegatedUserTenantId = reader.getStringElement(); + signedDelegatedUserTenantId = reader.getStringElement(); } else if ("Value".equals(elementName.getLocalPart())) { - deserializedUserDelegationKey.value = reader.getStringElement(); + value = reader.getStringElement(); } else { reader.skipElement(); } } - + UserDelegationKey deserializedUserDelegationKey = new UserDelegationKey(); + deserializedUserDelegationKey.signedObjectId = signedObjectId; + deserializedUserDelegationKey.signedTenantId = signedTenantId; + deserializedUserDelegationKey.signedStart = signedStart; + deserializedUserDelegationKey.signedExpiry = signedExpiry; + deserializedUserDelegationKey.signedService = signedService; + deserializedUserDelegationKey.signedVersion = signedVersion; + deserializedUserDelegationKey.value = value; + deserializedUserDelegationKey.signedDelegatedUserTenantId = signedDelegatedUserTenantId; return deserializedUserDelegationKey; }); } + + /* + * The Entra ID object ID in GUID format. + */ + @Generated + private String signedObjectId; + + /* + * The Entra ID tenant ID in GUID format. + */ + @Generated + private String signedTenantId; + + /* + * The delegated user tenant ID in Entra ID. Return if DelegatedUserTid is specified. + */ + @Generated + private String signedDelegatedUserTenantId; + + /** + * Get the signedObjectId property: The Entra ID object ID in GUID format. + * + * @return the signedObjectId value. + */ + @Generated + public String getSignedObjectId() { + return this.signedObjectId; + } + + @Generated + public UserDelegationKey setSignedObjectId(String signedObjectId) { + this.signedObjectId = signedObjectId; + return this; + } + + /** + * Get the signedTenantId property: The Entra ID tenant ID in GUID format. + * + * @return the signedTenantId value. + */ + @Generated + public String getSignedTenantId() { + return this.signedTenantId; + } + + @Generated + public UserDelegationKey setSignedTenantId(String signedTenantId) { + this.signedTenantId = signedTenantId; + return this; + } + + /** + * Get the signedDelegatedUserTenantId property: The delegated user tenant ID in Entra ID. Return if + * DelegatedUserTid is specified. + * + * @return the signedDelegatedUserTenantId value. + */ + @Generated + public String getSignedDelegatedUserTenantId() { + return this.signedDelegatedUserTenantId; + } + + @Generated + public UserDelegationKey setSignedDelegatedUserTenantId(String signedDelegatedUserTenantId) { + this.signedDelegatedUserTenantId = signedDelegatedUserTenantId; + return this; + } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/package-info.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/package-info.java index 6854f7a763d5..a42450d65f59 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/package-info.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/package-info.java @@ -1,9 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the data models for AzureQueueStorage. - * null. + * Package containing the data models for Queues. */ package com.azure.storage.queue.models; diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/package-info.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/package-info.java index e6671d8292fa..0d1326c86989 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/package-info.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/package-info.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. - +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * This package contains the classes to perform actions on Azure Storage Queue. + * Package containing the classes for Queues. */ package com.azure.storage.queue; diff --git a/sdk/storage/azure-storage-queue/src/main/resources/META-INF/azure-storage-queue-tsp_metadata.json b/sdk/storage/azure-storage-queue/src/main/resources/META-INF/azure-storage-queue-tsp_metadata.json new file mode 100644 index 000000000000..67d132399f8c --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/resources/META-INF/azure-storage-queue-tsp_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Storage.Queues":"2026-04-06"},"crossLanguagePackageId":"Storage.Queues","crossLanguageVersion":"f03fcb38168c","crossLanguageDefinitions":{"com.azure.storage.queue.tsp.QueueAsyncClient":"Storage.Queues.Queue","com.azure.storage.queue.tsp.QueueAsyncClient.clear":"Storage.Queues.Queue.clear","com.azure.storage.queue.tsp.QueueAsyncClient.clearWithResponse":"Storage.Queues.Queue.clear","com.azure.storage.queue.tsp.QueueAsyncClient.create":"Storage.Queues.Queue.create","com.azure.storage.queue.tsp.QueueAsyncClient.createWithResponse":"Storage.Queues.Queue.create","com.azure.storage.queue.tsp.QueueAsyncClient.delete":"Storage.Queues.Queue.delete","com.azure.storage.queue.tsp.QueueAsyncClient.deleteMessage":"Storage.Queues.Queue.deleteMessage","com.azure.storage.queue.tsp.QueueAsyncClient.deleteMessageWithResponse":"Storage.Queues.Queue.deleteMessage","com.azure.storage.queue.tsp.QueueAsyncClient.deleteWithResponse":"Storage.Queues.Queue.delete","com.azure.storage.queue.tsp.QueueAsyncClient.getAccessPolicy":"Storage.Queues.Queue.getAccessPolicy","com.azure.storage.queue.tsp.QueueAsyncClient.getAccessPolicyWithResponse":"Storage.Queues.Queue.getAccessPolicy","com.azure.storage.queue.tsp.QueueAsyncClient.getProperties":"Storage.Queues.Queue.getProperties","com.azure.storage.queue.tsp.QueueAsyncClient.getPropertiesWithResponse":"Storage.Queues.Queue.getProperties","com.azure.storage.queue.tsp.QueueAsyncClient.peekMessages":"Storage.Queues.Queue.peekMessages","com.azure.storage.queue.tsp.QueueAsyncClient.peekMessagesWithResponse":"Storage.Queues.Queue.peekMessages","com.azure.storage.queue.tsp.QueueAsyncClient.receiveMessages":"Storage.Queues.Queue.receiveMessages","com.azure.storage.queue.tsp.QueueAsyncClient.receiveMessagesWithResponse":"Storage.Queues.Queue.receiveMessages","com.azure.storage.queue.tsp.QueueAsyncClient.sendMessage":"Storage.Queues.Queue.sendMessage","com.azure.storage.queue.tsp.QueueAsyncClient.sendMessageWithResponse":"Storage.Queues.Queue.sendMessage","com.azure.storage.queue.tsp.QueueAsyncClient.setAccessPolicy":"Storage.Queues.Queue.setAccessPolicy","com.azure.storage.queue.tsp.QueueAsyncClient.setAccessPolicyWithResponse":"Storage.Queues.Queue.setAccessPolicy","com.azure.storage.queue.tsp.QueueAsyncClient.setMetadata":"Storage.Queues.Queue.setMetadata","com.azure.storage.queue.tsp.QueueAsyncClient.setMetadataWithResponse":"Storage.Queues.Queue.setMetadata","com.azure.storage.queue.tsp.QueueAsyncClient.updateMessage":"Storage.Queues.Queue.updateMessage","com.azure.storage.queue.tsp.QueueAsyncClient.updateMessageWithResponse":"Storage.Queues.Queue.updateMessage","com.azure.storage.queue.tsp.QueueClient":"Storage.Queues.Queue","com.azure.storage.queue.tsp.QueueClient.clear":"Storage.Queues.Queue.clear","com.azure.storage.queue.tsp.QueueClient.clearWithResponse":"Storage.Queues.Queue.clear","com.azure.storage.queue.tsp.QueueClient.create":"Storage.Queues.Queue.create","com.azure.storage.queue.tsp.QueueClient.createWithResponse":"Storage.Queues.Queue.create","com.azure.storage.queue.tsp.QueueClient.delete":"Storage.Queues.Queue.delete","com.azure.storage.queue.tsp.QueueClient.deleteMessage":"Storage.Queues.Queue.deleteMessage","com.azure.storage.queue.tsp.QueueClient.deleteMessageWithResponse":"Storage.Queues.Queue.deleteMessage","com.azure.storage.queue.tsp.QueueClient.deleteWithResponse":"Storage.Queues.Queue.delete","com.azure.storage.queue.tsp.QueueClient.getAccessPolicy":"Storage.Queues.Queue.getAccessPolicy","com.azure.storage.queue.tsp.QueueClient.getAccessPolicyWithResponse":"Storage.Queues.Queue.getAccessPolicy","com.azure.storage.queue.tsp.QueueClient.getProperties":"Storage.Queues.Queue.getProperties","com.azure.storage.queue.tsp.QueueClient.getPropertiesWithResponse":"Storage.Queues.Queue.getProperties","com.azure.storage.queue.tsp.QueueClient.peekMessages":"Storage.Queues.Queue.peekMessages","com.azure.storage.queue.tsp.QueueClient.peekMessagesWithResponse":"Storage.Queues.Queue.peekMessages","com.azure.storage.queue.tsp.QueueClient.receiveMessages":"Storage.Queues.Queue.receiveMessages","com.azure.storage.queue.tsp.QueueClient.receiveMessagesWithResponse":"Storage.Queues.Queue.receiveMessages","com.azure.storage.queue.tsp.QueueClient.sendMessage":"Storage.Queues.Queue.sendMessage","com.azure.storage.queue.tsp.QueueClient.sendMessageWithResponse":"Storage.Queues.Queue.sendMessage","com.azure.storage.queue.tsp.QueueClient.setAccessPolicy":"Storage.Queues.Queue.setAccessPolicy","com.azure.storage.queue.tsp.QueueClient.setAccessPolicyWithResponse":"Storage.Queues.Queue.setAccessPolicy","com.azure.storage.queue.tsp.QueueClient.setMetadata":"Storage.Queues.Queue.setMetadata","com.azure.storage.queue.tsp.QueueClient.setMetadataWithResponse":"Storage.Queues.Queue.setMetadata","com.azure.storage.queue.tsp.QueueClient.updateMessage":"Storage.Queues.Queue.updateMessage","com.azure.storage.queue.tsp.QueueClient.updateMessageWithResponse":"Storage.Queues.Queue.updateMessage","com.azure.storage.queue.tsp.QueueServiceAsyncClient":"Storage.Queues.Service","com.azure.storage.queue.tsp.QueueServiceAsyncClient.getProperties":"Storage.Queues.Service.getProperties","com.azure.storage.queue.tsp.QueueServiceAsyncClient.getPropertiesWithResponse":"Storage.Queues.Service.getProperties","com.azure.storage.queue.tsp.QueueServiceAsyncClient.getQueues":"Storage.Queues.Service.getQueues","com.azure.storage.queue.tsp.QueueServiceAsyncClient.getStatistics":"Storage.Queues.Service.getStatistics","com.azure.storage.queue.tsp.QueueServiceAsyncClient.getStatisticsWithResponse":"Storage.Queues.Service.getStatistics","com.azure.storage.queue.tsp.QueueServiceAsyncClient.getUserDelegationKey":"Storage.Queues.Service.getUserDelegationKey","com.azure.storage.queue.tsp.QueueServiceAsyncClient.getUserDelegationKeyWithResponse":"Storage.Queues.Service.getUserDelegationKey","com.azure.storage.queue.tsp.QueueServiceAsyncClient.setProperties":"Storage.Queues.Service.setProperties","com.azure.storage.queue.tsp.QueueServiceAsyncClient.setPropertiesWithResponse":"Storage.Queues.Service.setProperties","com.azure.storage.queue.tsp.QueueServiceClient":"Storage.Queues.Service","com.azure.storage.queue.tsp.QueueServiceClient.getProperties":"Storage.Queues.Service.getProperties","com.azure.storage.queue.tsp.QueueServiceClient.getPropertiesWithResponse":"Storage.Queues.Service.getProperties","com.azure.storage.queue.tsp.QueueServiceClient.getQueues":"Storage.Queues.Service.getQueues","com.azure.storage.queue.tsp.QueueServiceClient.getStatistics":"Storage.Queues.Service.getStatistics","com.azure.storage.queue.tsp.QueueServiceClient.getStatisticsWithResponse":"Storage.Queues.Service.getStatistics","com.azure.storage.queue.tsp.QueueServiceClient.getUserDelegationKey":"Storage.Queues.Service.getUserDelegationKey","com.azure.storage.queue.tsp.QueueServiceClient.getUserDelegationKeyWithResponse":"Storage.Queues.Service.getUserDelegationKey","com.azure.storage.queue.tsp.QueueServiceClient.setProperties":"Storage.Queues.Service.setProperties","com.azure.storage.queue.tsp.QueueServiceClient.setPropertiesWithResponse":"Storage.Queues.Service.setProperties","com.azure.storage.queue.tsp.QueuesClientBuilder":"Storage.Queues","com.azure.storage.queue.tsp.models.AccessPolicy":"Storage.Queues.AccessPolicy","com.azure.storage.queue.tsp.models.CorsRule":"Storage.Queues.CorsRule","com.azure.storage.queue.tsp.models.GeoReplication":"Storage.Queues.GeoReplication","com.azure.storage.queue.tsp.models.GeoReplicationStatus":"Storage.Queues.GeoReplicationStatus","com.azure.storage.queue.tsp.models.KeyInfo":"Storage.Queues.KeyInfo","com.azure.storage.queue.tsp.models.ListOfSentMessage":"Storage.Queues.ListOfSentMessage","com.azure.storage.queue.tsp.models.ListQueuesIncludeType":"Storage.Queues.ListQueuesIncludeType","com.azure.storage.queue.tsp.models.Logging":"Storage.Queues.Logging","com.azure.storage.queue.tsp.models.Metrics":"Storage.Queues.Metrics","com.azure.storage.queue.tsp.models.PeekedMessage":"Storage.Queues.PeekedMessage","com.azure.storage.queue.tsp.models.PeekedMessages":"Storage.Queues.PeekedMessages","com.azure.storage.queue.tsp.models.QueueItem":"Storage.Queues.QueueItem","com.azure.storage.queue.tsp.models.QueueMessage":"Storage.Queues.QueueMessage","com.azure.storage.queue.tsp.models.QueueServiceProperties":"Storage.Queues.QueueServiceProperties","com.azure.storage.queue.tsp.models.QueueServiceStats":"Storage.Queues.QueueServiceStats","com.azure.storage.queue.tsp.models.ReceivedMessage":"Storage.Queues.ReceivedMessage","com.azure.storage.queue.tsp.models.ReceivedMessages":"Storage.Queues.ReceivedMessages","com.azure.storage.queue.tsp.models.RetentionPolicy":"Storage.Queues.RetentionPolicy","com.azure.storage.queue.tsp.models.SentMessage":"Storage.Queues.SentMessage","com.azure.storage.queue.tsp.models.SignedIdentifier":"Storage.Queues.SignedIdentifier","com.azure.storage.queue.tsp.models.SignedIdentifiers":"Storage.Queues.SignedIdentifiers","com.azure.storage.queue.tsp.models.UserDelegationKey":"Storage.Queues.UserDelegationKey"},"generatedFiles":["src/main/java/com/azure/storage/queue/tsp/QueueAsyncClient.java","src/main/java/com/azure/storage/queue/tsp/QueueClient.java","src/main/java/com/azure/storage/queue/tsp/QueueServiceAsyncClient.java","src/main/java/com/azure/storage/queue/tsp/QueueServiceClient.java","src/main/java/com/azure/storage/queue/tsp/QueuesClientBuilder.java","src/main/java/com/azure/storage/queue/tsp/QueuesServiceVersion.java","src/main/java/com/azure/storage/queue/tsp/implementation/QueueServiceClientsImpl.java","src/main/java/com/azure/storage/queue/tsp/implementation/QueuesClientImpl.java","src/main/java/com/azure/storage/queue/tsp/implementation/QueuesImpl.java","src/main/java/com/azure/storage/queue/tsp/implementation/package-info.java","src/main/java/com/azure/storage/queue/tsp/models/AccessPolicy.java","src/main/java/com/azure/storage/queue/tsp/models/CorsRule.java","src/main/java/com/azure/storage/queue/tsp/models/GeoReplication.java","src/main/java/com/azure/storage/queue/tsp/models/GeoReplicationStatus.java","src/main/java/com/azure/storage/queue/tsp/models/KeyInfo.java","src/main/java/com/azure/storage/queue/tsp/models/ListOfSentMessage.java","src/main/java/com/azure/storage/queue/tsp/models/ListQueuesIncludeType.java","src/main/java/com/azure/storage/queue/tsp/models/Logging.java","src/main/java/com/azure/storage/queue/tsp/models/Metrics.java","src/main/java/com/azure/storage/queue/tsp/models/PeekedMessage.java","src/main/java/com/azure/storage/queue/tsp/models/PeekedMessages.java","src/main/java/com/azure/storage/queue/tsp/models/QueueItem.java","src/main/java/com/azure/storage/queue/tsp/models/QueueMessage.java","src/main/java/com/azure/storage/queue/tsp/models/QueueServiceProperties.java","src/main/java/com/azure/storage/queue/tsp/models/QueueServiceStats.java","src/main/java/com/azure/storage/queue/tsp/models/ReceivedMessage.java","src/main/java/com/azure/storage/queue/tsp/models/ReceivedMessages.java","src/main/java/com/azure/storage/queue/tsp/models/RetentionPolicy.java","src/main/java/com/azure/storage/queue/tsp/models/SentMessage.java","src/main/java/com/azure/storage/queue/tsp/models/SignedIdentifier.java","src/main/java/com/azure/storage/queue/tsp/models/SignedIdentifiers.java","src/main/java/com/azure/storage/queue/tsp/models/UserDelegationKey.java","src/main/java/com/azure/storage/queue/tsp/models/package-info.java","src/main/java/com/azure/storage/queue/tsp/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/main/resources/META-INF/azure-storage-queue_metadata.json b/sdk/storage/azure-storage-queue/src/main/resources/META-INF/azure-storage-queue_metadata.json new file mode 100644 index 000000000000..b6f768c4b989 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/resources/META-INF/azure-storage-queue_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Storage.Queues":"2026-04-06"},"crossLanguagePackageId":"Storage.Queues","crossLanguageVersion":"7a46acf65985","crossLanguageDefinitions":{"com.azure.storage.queue.AzureQueueStorageBuilder":"Storage.Queues","com.azure.storage.queue.MessageIdsAsyncClient":"Storage.Queues","com.azure.storage.queue.MessageIdsAsyncClient.delete":"Storage.Queues.Queue.deleteMessage","com.azure.storage.queue.MessageIdsAsyncClient.deleteWithResponse":"Storage.Queues.Queue.deleteMessage","com.azure.storage.queue.MessageIdsAsyncClient.update":"Storage.Queues.Queue.updateMessage","com.azure.storage.queue.MessageIdsAsyncClient.updateWithResponse":"Storage.Queues.Queue.updateMessage","com.azure.storage.queue.MessageIdsClient":"Storage.Queues","com.azure.storage.queue.MessageIdsClient.delete":"Storage.Queues.Queue.deleteMessage","com.azure.storage.queue.MessageIdsClient.deleteWithResponse":"Storage.Queues.Queue.deleteMessage","com.azure.storage.queue.MessageIdsClient.update":"Storage.Queues.Queue.updateMessage","com.azure.storage.queue.MessageIdsClient.updateWithResponse":"Storage.Queues.Queue.updateMessage","com.azure.storage.queue.MessagesAsyncClient":"Storage.Queues","com.azure.storage.queue.MessagesAsyncClient.clear":"Storage.Queues.Queue.clear","com.azure.storage.queue.MessagesAsyncClient.clearWithResponse":"Storage.Queues.Queue.clear","com.azure.storage.queue.MessagesAsyncClient.dequeue":"Storage.Queues.Queue.receiveMessages","com.azure.storage.queue.MessagesAsyncClient.dequeueWithResponse":"Storage.Queues.Queue.receiveMessages","com.azure.storage.queue.MessagesAsyncClient.enqueue":"Storage.Queues.Queue.sendMessage","com.azure.storage.queue.MessagesAsyncClient.enqueueWithResponse":"Storage.Queues.Queue.sendMessage","com.azure.storage.queue.MessagesAsyncClient.peek":"Storage.Queues.Queue.peekMessages","com.azure.storage.queue.MessagesAsyncClient.peekWithResponse":"Storage.Queues.Queue.peekMessages","com.azure.storage.queue.MessagesClient":"Storage.Queues","com.azure.storage.queue.MessagesClient.clear":"Storage.Queues.Queue.clear","com.azure.storage.queue.MessagesClient.clearWithResponse":"Storage.Queues.Queue.clear","com.azure.storage.queue.MessagesClient.dequeue":"Storage.Queues.Queue.receiveMessages","com.azure.storage.queue.MessagesClient.dequeueWithResponse":"Storage.Queues.Queue.receiveMessages","com.azure.storage.queue.MessagesClient.enqueue":"Storage.Queues.Queue.sendMessage","com.azure.storage.queue.MessagesClient.enqueueWithResponse":"Storage.Queues.Queue.sendMessage","com.azure.storage.queue.MessagesClient.peek":"Storage.Queues.Queue.peekMessages","com.azure.storage.queue.MessagesClient.peekWithResponse":"Storage.Queues.Queue.peekMessages","com.azure.storage.queue.QueueAsyncClient":"Storage.Queues.Queue","com.azure.storage.queue.QueueAsyncClient.create":"Storage.Queues.Queue.create","com.azure.storage.queue.QueueAsyncClient.createWithResponse":"Storage.Queues.Queue.create","com.azure.storage.queue.QueueAsyncClient.delete":"Storage.Queues.Queue.delete","com.azure.storage.queue.QueueAsyncClient.deleteWithResponse":"Storage.Queues.Queue.delete","com.azure.storage.queue.QueueAsyncClient.getAccessPolicy":"Storage.Queues.Queue.getAccessPolicy","com.azure.storage.queue.QueueAsyncClient.getAccessPolicyWithResponse":"Storage.Queues.Queue.getAccessPolicy","com.azure.storage.queue.QueueAsyncClient.getProperties":"Storage.Queues.Queue.getProperties","com.azure.storage.queue.QueueAsyncClient.getPropertiesWithResponse":"Storage.Queues.Queue.getProperties","com.azure.storage.queue.QueueAsyncClient.setAccessPolicy":"Storage.Queues.Queue.setAccessPolicy","com.azure.storage.queue.QueueAsyncClient.setAccessPolicyWithResponse":"Storage.Queues.Queue.setAccessPolicy","com.azure.storage.queue.QueueAsyncClient.setMetadata":"Storage.Queues.Queue.setMetadata","com.azure.storage.queue.QueueAsyncClient.setMetadataWithResponse":"Storage.Queues.Queue.setMetadata","com.azure.storage.queue.QueueClient":"Storage.Queues.Queue","com.azure.storage.queue.QueueClient.create":"Storage.Queues.Queue.create","com.azure.storage.queue.QueueClient.createWithResponse":"Storage.Queues.Queue.create","com.azure.storage.queue.QueueClient.delete":"Storage.Queues.Queue.delete","com.azure.storage.queue.QueueClient.deleteWithResponse":"Storage.Queues.Queue.delete","com.azure.storage.queue.QueueClient.getAccessPolicy":"Storage.Queues.Queue.getAccessPolicy","com.azure.storage.queue.QueueClient.getAccessPolicyWithResponse":"Storage.Queues.Queue.getAccessPolicy","com.azure.storage.queue.QueueClient.getProperties":"Storage.Queues.Queue.getProperties","com.azure.storage.queue.QueueClient.getPropertiesWithResponse":"Storage.Queues.Queue.getProperties","com.azure.storage.queue.QueueClient.setAccessPolicy":"Storage.Queues.Queue.setAccessPolicy","com.azure.storage.queue.QueueClient.setAccessPolicyWithResponse":"Storage.Queues.Queue.setAccessPolicy","com.azure.storage.queue.QueueClient.setMetadata":"Storage.Queues.Queue.setMetadata","com.azure.storage.queue.QueueClient.setMetadataWithResponse":"Storage.Queues.Queue.setMetadata","com.azure.storage.queue.ServiceAsyncClient":"Storage.Queues.Service","com.azure.storage.queue.ServiceAsyncClient.getProperties":"Storage.Queues.Service.getProperties","com.azure.storage.queue.ServiceAsyncClient.getPropertiesWithResponse":"Storage.Queues.Service.getProperties","com.azure.storage.queue.ServiceAsyncClient.getQueues":"Storage.Queues.Service.getQueues","com.azure.storage.queue.ServiceAsyncClient.getStatistics":"Storage.Queues.Service.getStatistics","com.azure.storage.queue.ServiceAsyncClient.getStatisticsWithResponse":"Storage.Queues.Service.getStatistics","com.azure.storage.queue.ServiceAsyncClient.getUserDelegationKey":"Storage.Queues.Service.getUserDelegationKey","com.azure.storage.queue.ServiceAsyncClient.getUserDelegationKeyWithResponse":"Storage.Queues.Service.getUserDelegationKey","com.azure.storage.queue.ServiceAsyncClient.setProperties":"Storage.Queues.Service.setProperties","com.azure.storage.queue.ServiceAsyncClient.setPropertiesWithResponse":"Storage.Queues.Service.setProperties","com.azure.storage.queue.ServiceClient":"Storage.Queues.Service","com.azure.storage.queue.ServiceClient.getProperties":"Storage.Queues.Service.getProperties","com.azure.storage.queue.ServiceClient.getPropertiesWithResponse":"Storage.Queues.Service.getProperties","com.azure.storage.queue.ServiceClient.getQueues":"Storage.Queues.Service.getQueues","com.azure.storage.queue.ServiceClient.getStatistics":"Storage.Queues.Service.getStatistics","com.azure.storage.queue.ServiceClient.getStatisticsWithResponse":"Storage.Queues.Service.getStatistics","com.azure.storage.queue.ServiceClient.getUserDelegationKey":"Storage.Queues.Service.getUserDelegationKey","com.azure.storage.queue.ServiceClient.getUserDelegationKeyWithResponse":"Storage.Queues.Service.getUserDelegationKey","com.azure.storage.queue.ServiceClient.setProperties":"Storage.Queues.Service.setProperties","com.azure.storage.queue.ServiceClient.setPropertiesWithResponse":"Storage.Queues.Service.setProperties","com.azure.storage.queue.implementation.models.KeyInfo":"Storage.Queues.KeyInfo","com.azure.storage.queue.implementation.models.ListOfSentMessage":"Storage.Queues.ListOfSentMessage","com.azure.storage.queue.implementation.models.ListQueuesIncludeType":"Storage.Queues.ListQueuesIncludeType","com.azure.storage.queue.implementation.models.PeekedMessageItemInternal":"Storage.Queues.PeekedMessage","com.azure.storage.queue.implementation.models.PeekedMessages":"Storage.Queues.PeekedMessages","com.azure.storage.queue.implementation.models.QueueMessage":"Storage.Queues.QueueMessage","com.azure.storage.queue.implementation.models.QueueMessageItemInternal":"Storage.Queues.ReceivedMessage","com.azure.storage.queue.implementation.models.ReceivedMessages":"Storage.Queues.ReceivedMessages","com.azure.storage.queue.implementation.models.SignedIdentifiers":"Storage.Queues.SignedIdentifiers","com.azure.storage.queue.models.GeoReplication":"Storage.Queues.GeoReplication","com.azure.storage.queue.models.GeoReplicationStatus":"Storage.Queues.GeoReplicationStatus","com.azure.storage.queue.models.QueueAccessPolicy":"Storage.Queues.AccessPolicy","com.azure.storage.queue.models.QueueAnalyticsLogging":"Storage.Queues.Logging","com.azure.storage.queue.models.QueueCorsRule":"Storage.Queues.CorsRule","com.azure.storage.queue.models.QueueItem":"Storage.Queues.QueueItem","com.azure.storage.queue.models.QueueMetrics":"Storage.Queues.Metrics","com.azure.storage.queue.models.QueueRetentionPolicy":"Storage.Queues.RetentionPolicy","com.azure.storage.queue.models.QueueServiceProperties":"Storage.Queues.QueueServiceProperties","com.azure.storage.queue.models.QueueServiceStatistics":"Storage.Queues.QueueServiceStats","com.azure.storage.queue.models.QueueSignedIdentifier":"Storage.Queues.SignedIdentifier","com.azure.storage.queue.models.SendMessageResult":"Storage.Queues.SentMessage","com.azure.storage.queue.models.UserDelegationKey":"Storage.Queues.UserDelegationKey"},"generatedFiles":["src/main/java/com/azure/storage/queue/AzureQueueStorageBuilder.java","src/main/java/com/azure/storage/queue/MessageIdsAsyncClient.java","src/main/java/com/azure/storage/queue/MessageIdsClient.java","src/main/java/com/azure/storage/queue/MessagesAsyncClient.java","src/main/java/com/azure/storage/queue/MessagesClient.java","src/main/java/com/azure/storage/queue/QueueAsyncClient.java","src/main/java/com/azure/storage/queue/QueueClient.java","src/main/java/com/azure/storage/queue/QueuesServiceVersion.java","src/main/java/com/azure/storage/queue/ServiceAsyncClient.java","src/main/java/com/azure/storage/queue/ServiceClient.java","src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java","src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java","src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java","src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java","src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java","src/main/java/com/azure/storage/queue/implementation/models/KeyInfo.java","src/main/java/com/azure/storage/queue/implementation/models/ListOfSentMessage.java","src/main/java/com/azure/storage/queue/implementation/models/ListQueuesIncludeType.java","src/main/java/com/azure/storage/queue/implementation/models/PeekedMessageItemInternal.java","src/main/java/com/azure/storage/queue/implementation/models/PeekedMessages.java","src/main/java/com/azure/storage/queue/implementation/models/QueueMessage.java","src/main/java/com/azure/storage/queue/implementation/models/QueueMessageItemInternal.java","src/main/java/com/azure/storage/queue/implementation/models/ReceivedMessages.java","src/main/java/com/azure/storage/queue/implementation/models/SignedIdentifiers.java","src/main/java/com/azure/storage/queue/implementation/models/package-info.java","src/main/java/com/azure/storage/queue/implementation/package-info.java","src/main/java/com/azure/storage/queue/models/GeoReplication.java","src/main/java/com/azure/storage/queue/models/GeoReplicationStatus.java","src/main/java/com/azure/storage/queue/models/QueueAccessPolicy.java","src/main/java/com/azure/storage/queue/models/QueueAnalyticsLogging.java","src/main/java/com/azure/storage/queue/models/QueueCorsRule.java","src/main/java/com/azure/storage/queue/models/QueueItem.java","src/main/java/com/azure/storage/queue/models/QueueMetrics.java","src/main/java/com/azure/storage/queue/models/QueueRetentionPolicy.java","src/main/java/com/azure/storage/queue/models/QueueServiceProperties.java","src/main/java/com/azure/storage/queue/models/QueueServiceStatistics.java","src/main/java/com/azure/storage/queue/models/QueueSignedIdentifier.java","src/main/java/com/azure/storage/queue/models/SendMessageResult.java","src/main/java/com/azure/storage/queue/models/UserDelegationKey.java","src/main/java/com/azure/storage/queue/models/package-info.java","src/main/java/com/azure/storage/queue/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/main/resources/azure-storage-queue-tsp.properties b/sdk/storage/azure-storage-queue/src/main/resources/azure-storage-queue-tsp.properties new file mode 100644 index 000000000000..ca812989b4f2 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/resources/azure-storage-queue-tsp.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueTestBase.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueTestBase.java index 09fa8892604e..cc82ed6a3ef4 100644 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueTestBase.java +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueTestBase.java @@ -41,15 +41,26 @@ public void beforeTest() { prefix = StorageCommonTestUtils.getCrc32(testContextManager.getTestPlaybackRecordingName()); if (getTestMode() != TestMode.LIVE) { - interceptorManager.addSanitizers( - Collections.singletonList(new TestProxySanitizer("sig=(.*)", "REDACTED", TestProxySanitizerType.URL))); + interceptorManager + .addSanitizers(Arrays.asList(new TestProxySanitizer("sig=(.*)", "REDACTED", TestProxySanitizerType.URL), + // The TypeSpec-generated protocol layer carries the queue name in the client base URL and addresses + // queue-scoped operations with query-only path templates (e.g. @Get("?comp=metadata")). azure-core's + // RestProxy assembles those into '.../{queue}/?comp=metadata' (a slash before the query), whereas the + // AutoRest recordings captured '.../{queue}?comp=metadata'. The trailing slash is semantically + // insignificant to the Queue service (LIVE behavior is identical), so normalize it away for playback + // matching rather than treating it as a behavior change. + new TestProxySanitizer("(?/)[?]comp=", "", TestProxySanitizerType.URL).setGroupForReplace("s"))); } // Ignore changes to the order of query parameters and wholly ignore the 'sv' (service version) query parameter // in SAS tokens. + // The 'Accept' header is excluded from matching because the TypeSpec-generated protocol layer omits it (sending + // the default '*/*') on operations without a response body, whereas the AutoRest recordings captured + // 'application/xml'. This mirrors the .NET migration, which added Accept to its LegacyExcludedHeaders. // TODO (alzimmer): Once all Storage libraries are migrated to test proxy move this into the common parent. - interceptorManager.addMatchers(Arrays - .asList(new CustomMatcher().setQueryOrderingIgnored(true).setIgnoredQueryParameters(Arrays.asList("sv")))); + interceptorManager.addMatchers(Arrays.asList(new CustomMatcher().setQueryOrderingIgnored(true) + .setIgnoredQueryParameters(Arrays.asList("sv")) + .setExcludedHeaders(Arrays.asList("Accept")))); } /** diff --git a/sdk/storage/azure-storage-queue/tsp-location.yaml b/sdk/storage/azure-storage-queue/tsp-location.yaml new file mode 100644 index 000000000000..21c879d17ece --- /dev/null +++ b/sdk/storage/azure-storage-queue/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/storage/data-plane/QueueStorage +commit: e594f9e6853ec4044c9642948466d697c2fd8544 +repo: gunjansingh-msft/azure-rest-api-specs +additionalDirectories: +