diff --git a/sdk/storage/azure-storage-queue/checkstyle-suppressions.xml b/sdk/storage/azure-storage-queue/checkstyle-suppressions.xml index 10b84decdca4..c17009ecf9c5 100644 --- a/sdk/storage/azure-storage-queue/checkstyle-suppressions.xml +++ b/sdk/storage/azure-storage-queue/checkstyle-suppressions.xml @@ -8,4 +8,6 @@ + + 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..2ae28e7c4bdd --- /dev/null +++ b/sdk/storage/azure-storage-queue/customization/src/main/java/QueueStorageCustomizations.java @@ -0,0 +1,460 @@ +// 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 com.github.javaparser.javadoc.Javadoc; +import com.github.javaparser.javadoc.description.JavadocDescription; +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 PKG_ROOT = "src/main/java/com/azure/storage/queue/"; + + private static final String MODELS_PACKAGE = "com.azure.storage.queue.models"; + + private static final String IMPL_PACKAGE = "com.azure.storage.queue.implementation"; + + // Models that shipped as @Fluent (public no-arg ctor + setters) before the TypeSpec migration. With + // required-fields-as-ctor-args:true these regenerate as @Immutable with a required-args ctor and no setters -- + // a breaking change. restoreFluentModels restores the shipped fluent shape per-model. Expand from the RevApi + // "method removed" report. + private static final List FLUENT_MODELS_TO_RESTORE = Arrays.asList( + "QueueRetentionPolicy", "QueueMetrics", "QueueCorsRule", "QueueAnalyticsLogging", "QueueSignedIdentifier", + "GeoReplication", "QueueItem", "QueueServiceStatistics", "SendMessageResult", "UserDelegationKey"); + + // Generated convenience clients + builder + service version emitted by typespec-java on top of the + // implementation/*Impl operation layer. The public surface is the hand-written clients, so delete the + // generated ones (removeFile is a no-op when a name is absent). + private static final List GENERATED_CLIENTS_TO_REMOVE = Arrays.asList( + "QueueClient", "QueueAsyncClient", + "ServiceClient", "ServiceAsyncClient", + "MessagesClient", "MessagesAsyncClient", + "MessageIdsClient", "MessageIdsAsyncClient", + "AzureQueueStorageBuilder", + "QueuesServiceVersion"); + + // Generated XML wrapper models unused by the hand-written clients (they use the hand-authored *Wrapper types). + private static final List GENERATED_MODELS_TO_REMOVE = Arrays.asList( + "ReceivedMessages", "PeekedMessages", "ListOfSentMessage", "SignedIdentifiers"); + + // module-info.java is hand-authored: the module descriptor carries the full requires/exports/opens (incl. the + // transitive com.azure.storage.common visibility). typespec-java regenerates a minimal version that overwrites + // it, so drop the generated copy and keep the hand-written descriptor. + private static final List GENERATED_DESCRIPTOR_FILES_TO_REMOVE = Arrays.asList( + "src/main/java/module-info.java"); + + @Override + public void customize(LibraryCustomization customization, Logger logger) { + Editor editor = customization.getRawEditor(); + removeGeneratedFiles(editor, logger); + fixXmlSerializerRedundantCast(editor, logger); + retargetServiceVersionReferences(editor, logger); + restoreFluentModels(customization, logger); + exposeRawListQueuesResponse(customization.getPackage(IMPL_PACKAGE), logger); + removeUnusedXmlNextLinkHelpers(customization.getPackage(IMPL_PACKAGE), logger); + updateImplToMapInternalException(customization.getPackage(IMPL_PACKAGE), logger); + } + + private static void restoreFluentModels(LibraryCustomization customization, Logger logger) { + PackageCustomization models = customization.getPackage(MODELS_PACKAGE); + for (String className : FLUENT_MODELS_TO_RESTORE) { + 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.setJavadocComment( + new Javadoc(JavadocDescription.parseText("Creates an instance of " + className + " class."))); + 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)); + String description = accessorDescription(clazz, fieldName); + String summary = description == null + ? "Set the " + fieldName + " property." + : "Set the " + fieldName + " property: " + description; + setter.setJavadocComment(new Javadoc(JavadocDescription.parseText(summary)) + .addBlockTag("param", fieldName, "the " + fieldName + " value to set.") + .addBlockTag("return", "the " + className + " object itself.")); + 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 its fields, and return it. The statements are + // inserted directly into the enclosing block (not wrapped in a nested block, which Checkstyle rejects). + ReturnStmt ret = findAncestor(oce, ReturnStmt.class).orElseThrow( + () -> new IllegalStateException("Unexpected " + className + " construction context.")); + BlockStmt block = (BlockStmt) ret.getParentNode().orElseThrow( + () -> new IllegalStateException("No enclosing block for " + className + " return.")); + String localName = "deserialized" + className; + int idx = block.getStatements().indexOf(ret); + block.addStatement(idx, + StaticJavaParser.parseStatement(className + " " + localName + " = new " + className + "();")); + int offset = 1; + for (String argName : argNames) { + block.addStatement(idx + offset, StaticJavaParser.parseStatement( + fieldAssignment(clazz, localName, argName))); + offset++; + } + ret.setExpression(StaticJavaParser.parseExpression(localName)); + } + } + + 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 accessorDescription(ClassOrInterfaceDeclaration clazz, String fieldName) { + String suffix = capitalize(fieldName); + for (String prefix : new String[] { "get", "is" }) { + for (MethodDeclaration getter : clazz.getMethodsByName(prefix + suffix)) { + if (getter.getParameters().isEmpty() && getter.getJavadoc().isPresent()) { + String text = getter.getJavadoc().get().getDescription().toText().trim(); + int idx = text.indexOf(": "); + return idx >= 0 ? text.substring(idx + 2).trim() : text; + } + } + } + return null; + } + + 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."); + })); + } + + // exposeRawListQueuesResponse replaces the emitter's paginated path, leaving the generated getXmlNextLink + // helpers uncalled and tripping SpotBugs UPM_UNCALLED_PRIVATE_METHOD. + private static void removeUnusedXmlNextLinkHelpers(PackageCustomization implPackage, Logger logger) { + if (implPackage.getClass("ServicesImpl") == null) { + logger.info("ServicesImpl not present; skipping getXmlNextLink removal."); + return; + } + implPackage.getClass("ServicesImpl").customizeAst(ast -> ast.getClassByName("ServicesImpl").ifPresent(clazz -> { + List unused = clazz.getMethodsByName("getXmlNextLink"); + if (unused.isEmpty()) { + logger.info("No getXmlNextLink methods found in ServicesImpl; skipping removal."); + return; + } + new ArrayList<>(unused).forEach(MethodDeclaration::remove); + logger.info("Removed {} unused getXmlNextLink method(s) from ServicesImpl.", unused.size()); + })); + } + + private static void retargetServiceVersionReferences(Editor editor, Logger logger) { + String implDir = PKG_ROOT + "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 removeGeneratedFiles(Editor editor, Logger logger) { + for (String className : GENERATED_CLIENTS_TO_REMOVE) { + removeFileIfPresent(editor, PKG_ROOT + className + ".java", logger); + } + for (String modelName : GENERATED_MODELS_TO_REMOVE) { + removeFileIfPresent(editor, PKG_ROOT + "implementation/models/" + modelName + ".java", logger); + } + for (String path : GENERATED_DESCRIPTOR_FILES_TO_REMOVE) { + removeFileIfPresent(editor, path, logger); + } + } + + private static void removeFileIfPresent(Editor editor, String path, Logger logger) { + if (editor.getContents().containsKey(path)) { + editor.removeFile(path); + logger.info("Removed generated file {}", path); + } else { + logger.info("Generated file {} not present; skipping removal.", path); + } + } + + // The generated XmlSerializer casts typeReference.getJavaClass() (already Class) to Class -- a redundant + // cast that trips the module's -Werror build. The file is emitter-generated and wired into ServicesImpl (XML + // pageable responses), so it can't be removed; drop the redundant cast here instead. + private static void fixXmlSerializerRedundantCast(Editor editor, Logger logger) { + String path = PKG_ROOT + "implementation/XmlSerializer.java"; + String content = editor.getContents().get(path); + if (content == null) { + logger.info("XmlSerializer not present in editor; skipping cast fix."); + return; + } + String updated = content.replace("(Class) typeReference.getJavaClass()", "typeReference.getJavaClass()"); + if (!updated.equals(content)) { + editor.replaceFile(path, updated); + logger.info("Removed redundant cast in XmlSerializer."); + } else { + logger.info("XmlSerializer redundant cast not found; skipping."); + } + } + + 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..81e2d01f057c 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,13 +20,13 @@ 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.MessagesDequeueHeaders; -import com.azure.storage.queue.implementation.models.MessagesPeekHeaders; import com.azure.storage.queue.implementation.models.PeekedMessageItemInternal; import com.azure.storage.queue.implementation.models.PeekedMessageItemInternalWrapper; 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.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 +130,7 @@ public final class QueueAsyncClient { * @return the URL of the storage queue */ public String getQueueUrl() { - return client.getUrl() + "/" + queueName; + return client.getUrl(); } /** @@ -224,8 +224,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 +361,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 +494,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(response.getHeaders())))); } catch (RuntimeException ex) { return monoError(LOGGER, ex); } @@ -576,8 +576,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 +611,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, null)); return new PagedFlux<>(() -> retriever.apply(null), retriever); } catch (RuntimeException ex) { @@ -710,8 +715,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 +770,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 +952,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 +1074,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 +1087,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 +1122,7 @@ private Mono> transf })) .collectList() .map(queueMessageItems -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), - response.getHeaders(), queueMessageItems, null, response.getDeserializedHeaders())); + response.getHeaders(), queueMessageItems, null, null)); } /** @@ -1177,10 +1190,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) { @@ -1188,12 +1204,12 @@ public PagedFlux peekMessages(Integer maxMessages) { } } - private Mono> - transformMessagesPeekResponse(ResponseBase response) { - List peekedMessageInternalItems = response.getValue().items(); - if (peekedMessageInternalItems == null) { - peekedMessageInternalItems = Collections.emptyList(); - } + private Mono> + 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 +1239,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, null)); } /** @@ -1318,18 +1334,24 @@ 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 -> { + return new SimpleResponse<>(response, + ModelHelper.transformUpdateMessageResult(response.getHeaders())); + }); + }); } catch (RuntimeException ex) { return monoError(LOGGER, ex); } @@ -1411,7 +1433,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..8137d1b91723 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; @@ -19,18 +19,12 @@ 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.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; 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.models.UserDelegationKey; import com.azure.storage.queue.implementation.util.ModelHelper; @@ -128,7 +122,7 @@ public final class QueueClient { * @return the URL of the storage queue. */ public String getQueueUrl() { - return azureQueueStorage.getUrl() + "/" + queueName; + return azureQueueStorage.getUrl(); } /** @@ -214,8 +208,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 +279,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 +347,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 +407,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 +479,11 @@ 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(response.getHeaders())); } /** @@ -563,8 +563,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 +596,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, null); return new PagedIterable<>(response); } @@ -669,8 +673,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 +733,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 +905,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 +1032,28 @@ 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); + PagedResponseBase transformedMessages = transformMessagesDequeueResponse(response); Supplier> res = () -> new PagedResponseBase<>(response.getRequest(), - response.getStatusCode(), response.getHeaders(), transformedMessages, response.getDeserializedHeaders()); + response.getStatusCode(), response.getHeaders(), transformedMessages, null); 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 +1083,7 @@ private PagedResponseBase transformMes } } return new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), - messageItems, null, response.getDeserializedHeaders()); + messageItems, null, null); } /** @@ -1146,26 +1156,25 @@ 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); + PagedResponseBase transformedMessages = transformMessagesPeekResponse(response); Supplier> res = () -> new PagedResponseBase<>(response.getRequest(), - response.getStatusCode(), response.getHeaders(), transformedMessages, response.getDeserializedHeaders()); + response.getStatusCode(), response.getHeaders(), transformedMessages, null); return new PagedIterable<>(res); } - private PagedResponseBase - transformMessagesPeekResponse(ResponseBase response) { - List peekedMessageInternalItems = response.getValue().items(); - if (peekedMessageInternalItems == null) { - peekedMessageInternalItems = Collections.emptyList(); - } + private PagedResponseBase 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 +1204,7 @@ PagedIterable peekMessagesWithOptionalTimeout(Integer maxMess } } return new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), - messageItems, null, response.getDeserializedHeaders()); + messageItems, null, null); } /** @@ -1276,20 +1285,24 @@ 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()); + UpdateMessageResult result = ModelHelper.transformUpdateMessageResult(response.getHeaders()); return new SimpleResponse<>(response, result); } @@ -1355,7 +1368,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..562692bf211f 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 @@ -16,12 +16,12 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.implementation.AccountSasImplUtil; -import com.azure.storage.common.implementation.Constants; import com.azure.storage.common.implementation.SasImplUtils; 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.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 +132,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 +351,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 +422,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 +547,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 +612,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 +791,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..0a946cf746db 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 @@ -10,20 +10,18 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.PagedResponse; 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; import com.azure.storage.common.implementation.AccountSasImplUtil; -import com.azure.storage.common.implementation.Constants; import com.azure.storage.common.implementation.SasImplUtils; 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; import com.azure.storage.queue.models.QueueCorsRule; import com.azure.storage.queue.models.QueueGetUserDelegationKeyOptions; import com.azure.storage.queue.models.QueueItem; @@ -141,10 +139,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 +335,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 +404,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 +543,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 +602,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 +764,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..e8c21106de70 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: OffsetDateTime (Optional)
+     *                 Expiry: OffsetDateTime (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: OffsetDateTime (Optional)
+     *                 Expiry: OffsetDateTime (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: OffsetDateTime (Optional)
+     *                 Expiry: OffsetDateTime (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: OffsetDateTime (Optional)
+     *                 Expiry: OffsetDateTime (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..ae0dc528ceb8 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,874 @@ 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("/") + @Put("?restype=service&comp=properties") @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("/") - @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, + 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) - 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, + 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); - @Get("/") + @Get("?restype=service&comp=properties") @ExpectedResponses({ 200 }) @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, - Context context); + Mono> getProperties(@HostParam("url") String url, + @HeaderParam("x-ms-version") String xMsVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); - @Post("/") + @Get("?restype=service&comp=properties") @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); + Response getPropertiesSync(@HostParam("url") String url, + @HeaderParam("x-ms-version") String xMsVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); - @Post("/") + @Get("?restype=service&comp=stats") @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); + Mono> getStatistics(@HostParam("url") String url, + @HeaderParam("x-ms-version") String xMsVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); - @Post("/") + @Get("?restype=service&comp=stats") @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); + Response getStatisticsSync(@HostParam("url") String url, + @HeaderParam("x-ms-version") String xMsVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); - @Post("/") + @Post("?restype=service&comp=userdelegationkey") @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> 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("/") + @Post("?restype=service&comp=userdelegationkey") @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 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("/") + @Get("?comp=list") @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); + Mono> getQueues(@HostParam("url") String url, + @HeaderParam("x-ms-version") String xMsVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); - @Get("/") + @Get("?comp=list") @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); - - @Get("/") - @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); - - @Get("{nextLink}") - @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); - - @Get("{nextLink}") - @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); - - @Get("{nextLink}") - @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); - - @Get("{nextLink}") - @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 storage 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)) + .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 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) - .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 storage 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"; - 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. + * 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 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"; + public Mono> getStatisticsWithResponseAsync(RequestOptions requestOptions) { final String accept = "application/xml"; - return service - .getStatisticsNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - requestId, accept, context) + return FluxUtil + .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. + * 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 stats for the storage service along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getStatisticsNoCustomHeadersWithResponse(Integer timeout, String requestId, - Context context) { + 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. + * 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. - * @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) { - 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. - * - * @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 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. - * - * @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. + * 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. - * @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"; - 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)) - .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}. - */ - @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"; + * 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.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) + .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(), 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}. + getXmlValues(res.getValue(), reader -> { + try { + return BinaryData.fromObject(com.azure.storage.queue.models.QueueItem.fromXml(reader, "Queue"), + XML_SERIALIZER); + } catch (javax.xml.stream.XMLStreamException e) { + throw new IllegalStateException(e); + } + }, "Queues", "Queue"), 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 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) { + 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.NONE); + 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()); + getXmlValues(res.getValue(), reader -> { + try { + return BinaryData.fromObject(com.azure.storage.queue.models.QueueItem.fromXml(reader, "Queue"), + XML_SERIALIZER); + } catch (javax.xml.stream.XMLStreamException e) { + throw new IllegalStateException(e); + } + }, "Queues", "Queue"), 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. - * @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) { - 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); - 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. - * @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 { + Object value = binaryData.toObject(Map.class); + for (String segment : path) { + value = ((Map) value).get(segment); + } + List values = (List) value; + 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 { + Object value = binaryData.toObject(Map.class); + for (String segment : path) { + value = ((Map) value).get(segment); + } + return (String) value; + } 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) { - 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)); - } + private static final com.azure.core.util.serializer.ObjectSerializer XML_SERIALIZER + = XmlSerializerProviders.createInstance(); - /** - * 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) { + private List getXmlValues(BinaryData binaryData, + java.util.function.Function valueReader, String... path) { 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()); + try (com.azure.xml.XmlReader reader = com.azure.xml.XmlReader.fromStream(binaryData.toStream())) { + reader.nextElement(); + return getXmlValues(reader, valueReader, path, 0); + } catch (javax.xml.stream.XMLStreamException e) { + throw new IllegalStateException("Failed to read XML pageable response.", e); + } } 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) { + private List getXmlValues(com.azure.xml.XmlReader reader, + java.util.function.Function valueReader, String[] path, int pathIndex) + throws javax.xml.stream.XMLStreamException { 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()); + List values = new java.util.ArrayList<>(); + while (reader.nextElement() != com.azure.xml.XmlToken.END_ELEMENT) { + if (!reader.elementNameMatches(path[pathIndex])) { + reader.skipElement(); + } else if (pathIndex == path.length - 1) { + values.add(valueReader.apply(reader)); + } else { + values.addAll(getXmlValues(reader, valueReader, path, pathIndex + 1)); + } + } + return values; } 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); - } + public Mono> getQueuesWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/xml"; + return FluxUtil + .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/XmlSerializer.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/XmlSerializer.java new file mode 100644 index 000000000000..4c1ce51a74dd --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/XmlSerializer.java @@ -0,0 +1,78 @@ +// 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; + +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import com.azure.xml.XmlReader; +import com.azure.xml.XmlSerializable; +import com.azure.xml.XmlWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.UncheckedIOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.concurrent.ConcurrentHashMap; +import javax.xml.stream.XMLStreamException; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +/** + * An {@link ObjectSerializer} implementation that serializes and deserializes {@link XmlSerializable} types using + * {@code azure-xml}. Deserialization relies on the generated static {@code fromXml(XmlReader)} factory method on the + * target type. + */ +public final class XmlSerializer implements ObjectSerializer { + + private static final ConcurrentHashMap, Method> FROM_XML_CACHE = new ConcurrentHashMap<>(); + + @Override + @SuppressWarnings("unchecked") + public T deserialize(InputStream stream, TypeReference typeReference) { + Class clazz = typeReference.getJavaClass(); + Method fromXml = FROM_XML_CACHE.computeIfAbsent(clazz, c -> { + try { + return c.getDeclaredMethod("fromXml", XmlReader.class); + } catch (NoSuchMethodException e) { + throw new IllegalStateException( + "Type " + c.getName() + " does not have a static fromXml(XmlReader) method.", e); + } + }); + try (XmlReader xmlReader = XmlReader.fromStream(stream)) { + return (T) fromXml.invoke(null, xmlReader); + } catch (XMLStreamException | IllegalAccessException e) { + throw new IllegalStateException(e); + } catch (InvocationTargetException e) { + throw new IllegalStateException(e.getCause() == null ? e : e.getCause()); + } + } + + @Override + public Mono deserializeAsync(InputStream stream, TypeReference typeReference) { + return Mono.fromCallable(() -> deserialize(stream, typeReference)); + } + + @Override + public void serialize(OutputStream stream, Object value) { + if (!(value instanceof XmlSerializable)) { + throw new IllegalArgumentException("Value must implement XmlSerializable to be serialized as XML, but was: " + + (value == null ? "null" : value.getClass().getName())); + } + try (XmlWriter xmlWriter = XmlWriter.toStream(stream)) { + xmlWriter.writeStartDocument(); + xmlWriter.writeXml((XmlSerializable) value); + xmlWriter.flush(); + } catch (XMLStreamException e) { + throw new UncheckedIOException(new IOException(e)); + } + } + + @Override + public Mono serializeAsync(OutputStream stream, Object value) { + return Mono.fromRunnable(() -> serialize(stream, value)); + } +} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/XmlSerializerProviders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/XmlSerializerProviders.java new file mode 100644 index 000000000000..b258540509aa --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/XmlSerializerProviders.java @@ -0,0 +1,29 @@ +// 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; + +import com.azure.core.util.serializer.ObjectSerializer; + +// DO NOT modify this helper class + +/** + * This class is a proxy for creating an {@link ObjectSerializer} that serializes and deserializes XML payloads using + * {@code azure-xml}. It mirrors the pattern of {@code JsonSerializerProviders} in {@code azure-core}, but for XML. + */ +public final class XmlSerializerProviders { + + /** + * Creates an instance of an XML {@link ObjectSerializer}. + * + * @return A new instance of an XML {@link ObjectSerializer}. + */ + public static ObjectSerializer createInstance() { + return new XmlSerializer(); + } + + private XmlSerializerProviders() { + // no-op + } +} 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..099ab42e72bc 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,46 +1,52 @@ // 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; } /** @@ -49,7 +55,7 @@ public KeyInfo() { * @return the start value. */ @Generated - public String getStart() { + public OffsetDateTime getStart() { return this.start; } @@ -60,7 +66,7 @@ public String getStart() { * @return the KeyInfo object itself. */ @Generated - public KeyInfo setStart(String start) { + public KeyInfo setStart(OffsetDateTime start) { this.start = start; return this; } @@ -71,24 +77,12 @@ public KeyInfo setStart(String start) { * @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. */ @@ -98,7 +92,7 @@ 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,8 +114,10 @@ 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(); } @@ -132,6 +128,7 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt * @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 @@ -147,6 +144,7 @@ public static KeyInfo fromXml(XmlReader xmlReader) throws XMLStreamException { * 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,20 +152,25 @@ 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/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/MessageIdsDeleteHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessageIdsDeleteHeaders.java deleted file mode 100644 index 093768d96624..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessageIdsDeleteHeaders.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The MessageIdsDeleteHeaders model. - */ -@Fluent -public final class MessageIdsDeleteHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of MessageIdsDeleteHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public MessageIdsDeleteHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the MessageIdsDeleteHeaders object itself. - */ - @Generated - public MessageIdsDeleteHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the MessageIdsDeleteHeaders object itself. - */ - @Generated - public MessageIdsDeleteHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the MessageIdsDeleteHeaders object itself. - */ - @Generated - public MessageIdsDeleteHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessageIdsUpdateHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessageIdsUpdateHeaders.java index 1b83c4de5098..92a2d163b359 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessageIdsUpdateHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessageIdsUpdateHeaders.java @@ -1,11 +1,11 @@ // 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.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.util.DateTimeRfc1123; @@ -14,44 +14,50 @@ /** * The MessageIdsUpdateHeaders model. */ -@Fluent +@Immutable public final class MessageIdsUpdateHeaders { /* - * The x-ms-request-id property. + * The x-ms-popreceipt property. */ @Generated - private String xMsRequestId; + private final String popReceipt; /* - * The x-ms-version property. + * The x-ms-time-next-visible property. */ @Generated - private String xMsVersion; + private final DateTimeRfc1123 timeNextVisible; /* - * The Date property. + * The x-ms-version property. */ @Generated - private DateTimeRfc1123 date; + private final String version; /* - * The x-ms-popreceipt property. + * The x-ms-request-id property. */ @Generated - private String xMsPopreceipt; + private final String requestId; /* - * The x-ms-time-next-visible property. + * The x-ms-client-request-id property. */ @Generated - private DateTimeRfc1123 xMsTimeNextVisible; + private final String clientRequestId; - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + /* + * The Date property. + */ + @Generated + private final DateTimeRfc1123 date; private static final HttpHeaderName X_MS_POPRECEIPT = HttpHeaderName.fromString("x-ms-popreceipt"); private static final HttpHeaderName X_MS_TIME_NEXT_VISIBLE = HttpHeaderName.fromString("x-ms-time-next-visible"); + private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); + // HttpHeaders containing the raw property values. /** * Creates an instance of MessageIdsUpdateHeaders class. @@ -59,144 +65,87 @@ public final class MessageIdsUpdateHeaders { * @param rawHeaders The raw HttpHeaders that will be used to create the property values. */ public MessageIdsUpdateHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.popReceipt = rawHeaders.getValue(X_MS_POPRECEIPT); + String timeNextVisible = rawHeaders.getValue(X_MS_TIME_NEXT_VISIBLE); + if (timeNextVisible != null) { + this.timeNextVisible = new DateTimeRfc1123(timeNextVisible); + } else { + this.timeNextVisible = null; + } + this.version = rawHeaders.getValue(X_MS_VERSION); + this.requestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); + this.clientRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_CLIENT_REQUEST_ID); String date = rawHeaders.getValue(HttpHeaderName.DATE); if (date != null) { this.date = new DateTimeRfc1123(date); } else { this.date = null; } - this.xMsPopreceipt = rawHeaders.getValue(X_MS_POPRECEIPT); - String xMsTimeNextVisible = rawHeaders.getValue(X_MS_TIME_NEXT_VISIBLE); - if (xMsTimeNextVisible != null) { - this.xMsTimeNextVisible = new DateTimeRfc1123(xMsTimeNextVisible); - } else { - this.xMsTimeNextVisible = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the MessageIdsUpdateHeaders object itself. - */ - @Generated - public MessageIdsUpdateHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; } /** - * Get the xMsVersion property: The x-ms-version property. + * Get the popReceipt property: The x-ms-popreceipt property. * - * @return the xMsVersion value. + * @return the popReceipt value. */ @Generated - public String getXMsVersion() { - return this.xMsVersion; + public String getPopReceipt() { + return this.popReceipt; } /** - * Set the xMsVersion property: The x-ms-version property. + * Get the timeNextVisible property: The x-ms-time-next-visible property. * - * @param xMsVersion the xMsVersion value to set. - * @return the MessageIdsUpdateHeaders object itself. + * @return the timeNextVisible value. */ @Generated - public MessageIdsUpdateHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { + public OffsetDateTime getTimeNextVisible() { + if (this.timeNextVisible == null) { return null; } - return this.date.getDateTime(); + return this.timeNextVisible.getDateTime(); } /** - * Set the date property: The Date property. + * Get the version property: The x-ms-version property. * - * @param date the date value to set. - * @return the MessageIdsUpdateHeaders object itself. + * @return the version value. */ @Generated - public MessageIdsUpdateHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; + public String getVersion() { + return this.version; } /** - * Get the xMsPopreceipt property: The x-ms-popreceipt property. + * Get the requestId property: The x-ms-request-id property. * - * @return the xMsPopreceipt value. + * @return the requestId value. */ @Generated - public String getXMsPopreceipt() { - return this.xMsPopreceipt; + public String getRequestId() { + return this.requestId; } /** - * Set the xMsPopreceipt property: The x-ms-popreceipt property. + * Get the clientRequestId property: The x-ms-client-request-id property. * - * @param xMsPopreceipt the xMsPopreceipt value to set. - * @return the MessageIdsUpdateHeaders object itself. + * @return the clientRequestId value. */ @Generated - public MessageIdsUpdateHeaders setXMsPopreceipt(String xMsPopreceipt) { - this.xMsPopreceipt = xMsPopreceipt; - return this; + public String getClientRequestId() { + return this.clientRequestId; } /** - * Get the xMsTimeNextVisible property: The x-ms-time-next-visible property. + * Get the date property: The Date property. * - * @return the xMsTimeNextVisible value. + * @return the date value. */ @Generated - public OffsetDateTime getXMsTimeNextVisible() { - if (this.xMsTimeNextVisible == null) { + public OffsetDateTime getDate() { + if (this.date == null) { return null; } - return this.xMsTimeNextVisible.getDateTime(); - } - - /** - * Set the xMsTimeNextVisible property: The x-ms-time-next-visible property. - * - * @param xMsTimeNextVisible the xMsTimeNextVisible value to set. - * @return the MessageIdsUpdateHeaders object itself. - */ - @Generated - public MessageIdsUpdateHeaders setXMsTimeNextVisible(OffsetDateTime xMsTimeNextVisible) { - if (xMsTimeNextVisible == null) { - this.xMsTimeNextVisible = null; - } else { - this.xMsTimeNextVisible = new DateTimeRfc1123(xMsTimeNextVisible); - } - return this; + return this.date.getDateTime(); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessagesClearHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessagesClearHeaders.java deleted file mode 100644 index 5854125e2944..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessagesClearHeaders.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The MessagesClearHeaders model. - */ -@Fluent -public final class MessagesClearHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of MessagesClearHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public MessagesClearHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the MessagesClearHeaders object itself. - */ - @Generated - public MessagesClearHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the MessagesClearHeaders object itself. - */ - @Generated - public MessagesClearHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the MessagesClearHeaders object itself. - */ - @Generated - public MessagesClearHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessagesDequeueHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessagesDequeueHeaders.java deleted file mode 100644 index b27f839f9e52..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessagesDequeueHeaders.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The MessagesDequeueHeaders model. - */ -@Fluent -public final class MessagesDequeueHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of MessagesDequeueHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public MessagesDequeueHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the MessagesDequeueHeaders object itself. - */ - @Generated - public MessagesDequeueHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the MessagesDequeueHeaders object itself. - */ - @Generated - public MessagesDequeueHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the MessagesDequeueHeaders object itself. - */ - @Generated - public MessagesDequeueHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessagesEnqueueHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessagesEnqueueHeaders.java deleted file mode 100644 index 5bd7ffec6fb0..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessagesEnqueueHeaders.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The MessagesEnqueueHeaders model. - */ -@Fluent -public final class MessagesEnqueueHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of MessagesEnqueueHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public MessagesEnqueueHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the MessagesEnqueueHeaders object itself. - */ - @Generated - public MessagesEnqueueHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the MessagesEnqueueHeaders object itself. - */ - @Generated - public MessagesEnqueueHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the MessagesEnqueueHeaders object itself. - */ - @Generated - public MessagesEnqueueHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessagesPeekHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessagesPeekHeaders.java deleted file mode 100644 index eefaa79faf95..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/MessagesPeekHeaders.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The MessagesPeekHeaders model. - */ -@Fluent -public final class MessagesPeekHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of MessagesPeekHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public MessagesPeekHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the MessagesPeekHeaders object itself. - */ - @Generated - public MessagesPeekHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the MessagesPeekHeaders object itself. - */ - @Generated - public MessagesPeekHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the MessagesPeekHeaders object itself. - */ - @Generated - public MessagesPeekHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} 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..5890b34d8467 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,11 @@ // 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,49 +17,69 @@ 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. */ @@ -69,19 +89,7 @@ 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. */ @@ -94,23 +102,7 @@ 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. */ @@ -122,22 +114,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 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. * @@ -149,19 +125,7 @@ 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. */ @@ -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 { @@ -207,6 +159,7 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt * @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 @@ -222,6 +175,7 @@ public static PeekedMessageItemInternal fromXml(XmlReader xmlReader) throws XMLS * 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,35 @@ 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/QueueMessage.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueueMessage.java index 8dd364c11d54..5d2de75506ef 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,11 @@ // 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,21 +14,24 @@ 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; } /** @@ -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 { @@ -74,6 +65,7 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt * @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 @@ -89,6 +81,7 @@ public static QueueMessage fromXml(XmlReader xmlReader) throws XMLStreamExceptio * 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,17 @@ 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..14609d256a58 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,11 @@ // 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,62 +17,90 @@ 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. */ @@ -82,19 +110,7 @@ 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. */ @@ -107,23 +123,7 @@ 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. */ @@ -136,24 +136,8 @@ 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. */ @@ -163,20 +147,7 @@ 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. */ @@ -188,22 +159,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 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. * @@ -215,19 +170,7 @@ 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. */ @@ -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 { @@ -275,6 +206,7 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt * @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 @@ -290,6 +222,7 @@ public static QueueMessageItemInternal fromXml(XmlReader xmlReader) throws XMLSt * 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,45 @@ 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/QueuesCreateHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesCreateHeaders.java deleted file mode 100644 index b1b2c6c7b728..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesCreateHeaders.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The QueuesCreateHeaders model. - */ -@Fluent -public final class QueuesCreateHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of QueuesCreateHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public QueuesCreateHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the QueuesCreateHeaders object itself. - */ - @Generated - public QueuesCreateHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the QueuesCreateHeaders object itself. - */ - @Generated - public QueuesCreateHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the QueuesCreateHeaders object itself. - */ - @Generated - public QueuesCreateHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesDeleteHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesDeleteHeaders.java deleted file mode 100644 index 58487958fcb9..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesDeleteHeaders.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The QueuesDeleteHeaders model. - */ -@Fluent -public final class QueuesDeleteHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of QueuesDeleteHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public QueuesDeleteHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the QueuesDeleteHeaders object itself. - */ - @Generated - public QueuesDeleteHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the QueuesDeleteHeaders object itself. - */ - @Generated - public QueuesDeleteHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the QueuesDeleteHeaders object itself. - */ - @Generated - public QueuesDeleteHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesGetAccessPolicyHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesGetAccessPolicyHeaders.java deleted file mode 100644 index 6c4bca8f533e..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesGetAccessPolicyHeaders.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The QueuesGetAccessPolicyHeaders model. - */ -@Fluent -public final class QueuesGetAccessPolicyHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of QueuesGetAccessPolicyHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public QueuesGetAccessPolicyHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the QueuesGetAccessPolicyHeaders object itself. - */ - @Generated - public QueuesGetAccessPolicyHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the QueuesGetAccessPolicyHeaders object itself. - */ - @Generated - public QueuesGetAccessPolicyHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the QueuesGetAccessPolicyHeaders object itself. - */ - @Generated - public QueuesGetAccessPolicyHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesGetPropertiesHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesGetPropertiesHeaders.java index 9daac6030ab4..a7980fc9d195 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesGetPropertiesHeaders.java @@ -1,52 +1,58 @@ // 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.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.util.DateTimeRfc1123; import java.time.OffsetDateTime; -import java.util.LinkedHashMap; -import java.util.Map; /** * The QueuesGetPropertiesHeaders model. */ -@Fluent +@Immutable public final class QueuesGetPropertiesHeaders { /* - * The x-ms-meta- property. + * The x-ms-meta property. */ @Generated - private Map xMsMeta; + private final String metadata; /* * The x-ms-approximate-messages-count property. */ @Generated - private Long xMsApproximateMessagesCount; + private final Long approximateMessagesCount; + + /* + * The x-ms-version property. + */ + @Generated + private final String version; /* * The x-ms-request-id property. */ @Generated - private String xMsRequestId; + private final String requestId; /* - * The x-ms-version property. + * The x-ms-client-request-id property. */ @Generated - private String xMsVersion; + private final String clientRequestId; /* * The Date property. */ @Generated - private DateTimeRfc1123 date; + private final DateTimeRfc1123 date; + + private static final HttpHeaderName X_MS_META = HttpHeaderName.fromString("x-ms-meta"); private static final HttpHeaderName X_MS_APPROXIMATE_MESSAGES_COUNT = HttpHeaderName.fromString("x-ms-approximate-messages-count"); @@ -60,117 +66,72 @@ public final class QueuesGetPropertiesHeaders { * @param rawHeaders The raw HttpHeaders that will be used to create the property values. */ public QueuesGetPropertiesHeaders(HttpHeaders rawHeaders) { - String xMsApproximateMessagesCount = rawHeaders.getValue(X_MS_APPROXIMATE_MESSAGES_COUNT); - if (xMsApproximateMessagesCount != null) { - this.xMsApproximateMessagesCount = Long.parseLong(xMsApproximateMessagesCount); + this.metadata = rawHeaders.getValue(X_MS_META); + String approximateMessagesCount = rawHeaders.getValue(X_MS_APPROXIMATE_MESSAGES_COUNT); + if (approximateMessagesCount != null) { + this.approximateMessagesCount = Long.parseLong(approximateMessagesCount); } else { - this.xMsApproximateMessagesCount = null; + this.approximateMessagesCount = null; } - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); + this.version = rawHeaders.getValue(X_MS_VERSION); + this.requestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); + this.clientRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_CLIENT_REQUEST_ID); String date = rawHeaders.getValue(HttpHeaderName.DATE); if (date != null) { this.date = new DateTimeRfc1123(date); } else { this.date = null; } - Map xMsMetaHeaderCollection = new LinkedHashMap<>(); - - rawHeaders.stream().forEach(header -> { - String headerName = header.getName(); - if (headerName.startsWith("x-ms-meta-")) { - xMsMetaHeaderCollection.put(headerName.substring(10), header.getValue()); - } - }); - this.xMsMeta = xMsMetaHeaderCollection; - } - - /** - * Get the xMsMeta property: The x-ms-meta- property. - * - * @return the xMsMeta value. - */ - @Generated - public Map getXMsMeta() { - return this.xMsMeta; } /** - * Set the xMsMeta property: The x-ms-meta- property. + * Get the metadata property: The x-ms-meta property. * - * @param xMsMeta the xMsMeta value to set. - * @return the QueuesGetPropertiesHeaders object itself. + * @return the metadata value. */ @Generated - public QueuesGetPropertiesHeaders setXMsMeta(Map xMsMeta) { - this.xMsMeta = xMsMeta; - return this; + public String getMetadata() { + return this.metadata; } /** - * Get the xMsApproximateMessagesCount property: The x-ms-approximate-messages-count property. + * Get the approximateMessagesCount property: The x-ms-approximate-messages-count property. * - * @return the xMsApproximateMessagesCount value. + * @return the approximateMessagesCount value. */ @Generated - public Long getXMsApproximateMessagesCount() { - return this.xMsApproximateMessagesCount; + public Long getApproximateMessagesCount() { + return this.approximateMessagesCount; } /** - * Set the xMsApproximateMessagesCount property: The x-ms-approximate-messages-count property. + * Get the version property: The x-ms-version property. * - * @param xMsApproximateMessagesCount the xMsApproximateMessagesCount value to set. - * @return the QueuesGetPropertiesHeaders object itself. + * @return the version value. */ @Generated - public QueuesGetPropertiesHeaders setXMsApproximateMessagesCount(Long xMsApproximateMessagesCount) { - this.xMsApproximateMessagesCount = xMsApproximateMessagesCount; - return this; + public String getVersion() { + return this.version; } /** - * Get the xMsRequestId property: The x-ms-request-id property. + * Get the requestId property: The x-ms-request-id property. * - * @return the xMsRequestId value. + * @return the requestId value. */ @Generated - public String getXMsRequestId() { - return this.xMsRequestId; + public String getRequestId() { + return this.requestId; } /** - * Set the xMsRequestId property: The x-ms-request-id property. + * Get the clientRequestId property: The x-ms-client-request-id property. * - * @param xMsRequestId the xMsRequestId value to set. - * @return the QueuesGetPropertiesHeaders object itself. + * @return the clientRequestId value. */ @Generated - public QueuesGetPropertiesHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the QueuesGetPropertiesHeaders object itself. - */ - @Generated - public QueuesGetPropertiesHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; + public String getClientRequestId() { + return this.clientRequestId; } /** @@ -185,20 +146,4 @@ public OffsetDateTime getDate() { } return this.date.getDateTime(); } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the QueuesGetPropertiesHeaders object itself. - */ - @Generated - public QueuesGetPropertiesHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesSetAccessPolicyHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesSetAccessPolicyHeaders.java deleted file mode 100644 index 7adf9fed3ad9..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesSetAccessPolicyHeaders.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The QueuesSetAccessPolicyHeaders model. - */ -@Fluent -public final class QueuesSetAccessPolicyHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of QueuesSetAccessPolicyHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public QueuesSetAccessPolicyHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the QueuesSetAccessPolicyHeaders object itself. - */ - @Generated - public QueuesSetAccessPolicyHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the QueuesSetAccessPolicyHeaders object itself. - */ - @Generated - public QueuesSetAccessPolicyHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the QueuesSetAccessPolicyHeaders object itself. - */ - @Generated - public QueuesSetAccessPolicyHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesSetMetadataHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesSetMetadataHeaders.java deleted file mode 100644 index c69ab94185cb..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/QueuesSetMetadataHeaders.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The QueuesSetMetadataHeaders model. - */ -@Fluent -public final class QueuesSetMetadataHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of QueuesSetMetadataHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public QueuesSetMetadataHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the QueuesSetMetadataHeaders object itself. - */ - @Generated - public QueuesSetMetadataHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the QueuesSetMetadataHeaders object itself. - */ - @Generated - public QueuesSetMetadataHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the QueuesSetMetadataHeaders object itself. - */ - @Generated - public QueuesSetMetadataHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesGetPropertiesHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesGetPropertiesHeaders.java deleted file mode 100644 index 9cc098ea2313..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesGetPropertiesHeaders.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; - -/** - * The ServicesGetPropertiesHeaders model. - */ -@Fluent -public final class ServicesGetPropertiesHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of ServicesGetPropertiesHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public ServicesGetPropertiesHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the ServicesGetPropertiesHeaders object itself. - */ - @Generated - public ServicesGetPropertiesHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the ServicesGetPropertiesHeaders object itself. - */ - @Generated - public ServicesGetPropertiesHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesGetStatisticsHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesGetStatisticsHeaders.java deleted file mode 100644 index f42573d678b2..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesGetStatisticsHeaders.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The ServicesGetStatisticsHeaders model. - */ -@Fluent -public final class ServicesGetStatisticsHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of ServicesGetStatisticsHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public ServicesGetStatisticsHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the ServicesGetStatisticsHeaders object itself. - */ - @Generated - public ServicesGetStatisticsHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the ServicesGetStatisticsHeaders object itself. - */ - @Generated - public ServicesGetStatisticsHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the ServicesGetStatisticsHeaders object itself. - */ - @Generated - public ServicesGetStatisticsHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesGetUserDelegationKeyHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesGetUserDelegationKeyHeaders.java deleted file mode 100644 index f4882f4ecbb0..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesGetUserDelegationKeyHeaders.java +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The ServicesGetUserDelegationKeyHeaders model. - */ -@Fluent -public final class ServicesGetUserDelegationKeyHeaders { - /* - * The x-ms-client-request-id property. - */ - @Generated - private String xMsClientRequestId; - - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of ServicesGetUserDelegationKeyHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public ServicesGetUserDelegationKeyHeaders(HttpHeaders rawHeaders) { - this.xMsClientRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_CLIENT_REQUEST_ID); - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsClientRequestId property: The x-ms-client-request-id property. - * - * @return the xMsClientRequestId value. - */ - @Generated - public String getXMsClientRequestId() { - return this.xMsClientRequestId; - } - - /** - * Set the xMsClientRequestId property: The x-ms-client-request-id property. - * - * @param xMsClientRequestId the xMsClientRequestId value to set. - * @return the ServicesGetUserDelegationKeyHeaders object itself. - */ - @Generated - public ServicesGetUserDelegationKeyHeaders setXMsClientRequestId(String xMsClientRequestId) { - this.xMsClientRequestId = xMsClientRequestId; - return this; - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the ServicesGetUserDelegationKeyHeaders object itself. - */ - @Generated - public ServicesGetUserDelegationKeyHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the ServicesGetUserDelegationKeyHeaders object itself. - */ - @Generated - public ServicesGetUserDelegationKeyHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the ServicesGetUserDelegationKeyHeaders object itself. - */ - @Generated - public ServicesGetUserDelegationKeyHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesListQueuesSegmentHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesListQueuesSegmentHeaders.java deleted file mode 100644 index 23ef483052a1..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesListQueuesSegmentHeaders.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The ServicesListQueuesSegmentHeaders model. - */ -@Fluent -public final class ServicesListQueuesSegmentHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of ServicesListQueuesSegmentHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public ServicesListQueuesSegmentHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the ServicesListQueuesSegmentHeaders object itself. - */ - @Generated - public ServicesListQueuesSegmentHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the ServicesListQueuesSegmentHeaders object itself. - */ - @Generated - public ServicesListQueuesSegmentHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the ServicesListQueuesSegmentHeaders object itself. - */ - @Generated - public ServicesListQueuesSegmentHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesListQueuesSegmentNextHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesListQueuesSegmentNextHeaders.java deleted file mode 100644 index 054c5ac9a685..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesListQueuesSegmentNextHeaders.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * The ServicesListQueuesSegmentNextHeaders model. - */ -@Fluent -public final class ServicesListQueuesSegmentNextHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - /* - * The Date property. - */ - @Generated - private DateTimeRfc1123 date; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of ServicesListQueuesSegmentNextHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public ServicesListQueuesSegmentNextHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - String date = rawHeaders.getValue(HttpHeaderName.DATE); - if (date != null) { - this.date = new DateTimeRfc1123(date); - } else { - this.date = null; - } - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the ServicesListQueuesSegmentNextHeaders object itself. - */ - @Generated - public ServicesListQueuesSegmentNextHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the ServicesListQueuesSegmentNextHeaders object itself. - */ - @Generated - public ServicesListQueuesSegmentNextHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } - - /** - * Get the date property: The Date property. - * - * @return the date value. - */ - @Generated - public OffsetDateTime getDate() { - if (this.date == null) { - return null; - } - return this.date.getDateTime(); - } - - /** - * Set the date property: The Date property. - * - * @param date the date value to set. - * @return the ServicesListQueuesSegmentNextHeaders object itself. - */ - @Generated - public ServicesListQueuesSegmentNextHeaders setDate(OffsetDateTime date) { - if (date == null) { - this.date = null; - } else { - this.date = new DateTimeRfc1123(date); - } - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesSetPropertiesHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesSetPropertiesHeaders.java deleted file mode 100644 index d1d721a93f8e..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/ServicesSetPropertiesHeaders.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; - -/** - * The ServicesSetPropertiesHeaders model. - */ -@Fluent -public final class ServicesSetPropertiesHeaders { - /* - * The x-ms-request-id property. - */ - @Generated - private String xMsRequestId; - - /* - * The x-ms-version property. - */ - @Generated - private String xMsVersion; - - private static final HttpHeaderName X_MS_VERSION = HttpHeaderName.fromString("x-ms-version"); - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of ServicesSetPropertiesHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public ServicesSetPropertiesHeaders(HttpHeaders rawHeaders) { - this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); - this.xMsVersion = rawHeaders.getValue(X_MS_VERSION); - } - - /** - * Get the xMsRequestId property: The x-ms-request-id property. - * - * @return the xMsRequestId value. - */ - @Generated - public String getXMsRequestId() { - return this.xMsRequestId; - } - - /** - * Set the xMsRequestId property: The x-ms-request-id property. - * - * @param xMsRequestId the xMsRequestId value to set. - * @return the ServicesSetPropertiesHeaders object itself. - */ - @Generated - public ServicesSetPropertiesHeaders setXMsRequestId(String xMsRequestId) { - this.xMsRequestId = xMsRequestId; - return this; - } - - /** - * Get the xMsVersion property: The x-ms-version property. - * - * @return the xMsVersion value. - */ - @Generated - public String getXMsVersion() { - return this.xMsVersion; - } - - /** - * Set the xMsVersion property: The x-ms-version property. - * - * @param xMsVersion the xMsVersion value to set. - * @return the ServicesSetPropertiesHeaders object itself. - */ - @Generated - public ServicesSetPropertiesHeaders setXMsVersion(String xMsVersion) { - this.xMsVersion = xMsVersion; - return this; - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/StorageError.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/StorageError.java deleted file mode 100644 index ade7d70ebfc0..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/StorageError.java +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.xml.XmlReader; -import com.azure.xml.XmlSerializable; -import com.azure.xml.XmlToken; -import com.azure.xml.XmlWriter; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; - -/** - * The StorageError model. - */ -@Fluent -public final class StorageError implements XmlSerializable { - /* - * The Message property. - */ - @Generated - private String message; - - /** - * Creates an instance of StorageError class. - */ - @Generated - public StorageError() { - } - - /** - * Get the message property: The Message property. - * - * @return the message value. - */ - @Generated - public String getMessage() { - return this.message; - } - - /** - * Set the message property: The Message property. - * - * @param message the message value to set. - * @return the StorageError object itself. - */ - @Generated - public StorageError setMessage(String message) { - this.message = message; - return this; - } - - @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() ? "StorageError" : rootElementName; - xmlWriter.writeStartElement(rootElementName); - xmlWriter.writeStringElement("Message", this.message); - return xmlWriter.writeEndElement(); - } - - /** - * Reads an instance of StorageError from the XmlReader. - * - * @param xmlReader The XmlReader being read. - * @return An instance of StorageError if the XmlReader was pointing to an instance of it, or null if it was - * pointing to XML null. - * @throws XMLStreamException If an error occurs while reading the StorageError. - */ - @Generated - public static StorageError fromXml(XmlReader xmlReader) throws XMLStreamException { - return fromXml(xmlReader, null); - } - - /** - * Reads an instance of StorageError 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 StorageError if the XmlReader was pointing to an instance of it, or null if it was - * pointing to XML null. - * @throws XMLStreamException If an error occurs while reading the StorageError. - */ - @Generated - public static StorageError fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException { - String finalRootElementName - = rootElementName == null || rootElementName.isEmpty() ? "StorageError" : rootElementName; - return xmlReader.readObject(finalRootElementName, reader -> { - StorageError deserializedStorageError = new StorageError(); - while (reader.nextElement() != XmlToken.END_ELEMENT) { - QName elementName = reader.getElementName(); - - if ("Message".equals(elementName.getLocalPart())) { - deserializedStorageError.message = reader.getStringElement(); - } else { - reader.skipElement(); - } - } - - return deserializedStorageError; - }); - } -} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/StorageErrorException.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/StorageErrorException.java deleted file mode 100644 index 5b1aa602fce0..000000000000 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/models/StorageErrorException.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation.models; - -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.HttpResponse; - -/** - * Exception thrown for an invalid response with StorageError information. - */ -public final class StorageErrorException extends HttpResponseException { - /** - * Initializes a new instance of the StorageErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - */ - public StorageErrorException(String message, HttpResponse response) { - super(message, response); - } - - /** - * Initializes a new instance of the StorageErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - * @param value the deserialized response value. - */ - public StorageErrorException(String message, HttpResponse response, StorageError value) { - super(message, response, value); - } - - /** - * {@inheritDoc} - */ - @Override - public StorageError getValue() { - return (StorageError) super.getValue(); - } -} 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..c1aa33203a25 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,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 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..9f3fcc695bcd 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,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 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/BuilderHelper.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/BuilderHelper.java index 9917c979bd6a..244bf669f351 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/BuilderHelper.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/BuilderHelper.java @@ -185,6 +185,10 @@ public static HttpPipeline buildPipeline(StorageSharedKeyCredential storageShare } policies.add(new MetadataValidationPolicy()); + // Restore the AutoRest request URL shape (drop the trailing slash RestProxy adds for query-only queue-scoped + // routes). Placed before the credential policy since the URL is part of the shared-key string-to-sign. + policies.add(new QueueUrlTrailingSlashPolicy()); + if (storageSharedKeyCredential != null) { policies.add(new StorageSharedKeyCredentialPolicy(storageSharedKeyCredential)); } 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..bbed27620fd1 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,25 +3,47 @@ package com.azure.storage.queue.implementation.util; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.HttpHeaders; +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.MessageIdsUpdateHeaders; 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.implementation.models.QueueStorageExceptionInternal; 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.storage.queue.models.UpdateMessageResult; +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.LinkedHashMap; +import java.util.List; +import java.util.Map; import java.util.Objects; public class ModelHelper { private static final ClientLogger LOGGER = new ClientLogger(ModelHelper.class); + private static final String X_MS_META_PREFIX = "x-ms-meta-"; + private static BinaryData decodeMessageBody(String messageText, QueueMessageEncoding messageEncoding) { if (messageText == null) { return null; @@ -86,8 +108,23 @@ public static String encodeMessage(BinaryData message, QueueMessageEncoding mess } } - public static QueueProperties transformQueueProperties(QueuesGetPropertiesHeaders headers) { - return new QueueProperties(headers.getXMsMeta(), headers.getXMsApproximateMessagesCount()); + public static QueueProperties transformQueueProperties(HttpHeaders headers) { + Map metadata = new LinkedHashMap<>(); + for (HttpHeader header : headers) { + String name = header.getName(); + if (name.regionMatches(true, 0, X_MS_META_PREFIX, 0, X_MS_META_PREFIX.length())) { + metadata.put(name.substring(X_MS_META_PREFIX.length()), header.getValue()); + } + } + // The generated header model provides the typed approximate-messages-count; the metadata map is a dynamic + // x-ms-meta-* collection the single-valued header model cannot represent, so it is still read manually. + Long count = new QueuesGetPropertiesHeaders(headers).getApproximateMessagesCount(); + return new QueueProperties(metadata, count == null ? 0L : count); + } + + public static UpdateMessageResult transformUpdateMessageResult(HttpHeaders headers) { + MessageIdsUpdateHeaders updateHeaders = new MessageIdsUpdateHeaders(headers); + return new UpdateMessageResult(updateHeaders.getPopReceipt(), updateHeaders.getTimeNextVisible()); } /** @@ -107,4 +144,166 @@ 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); + // Match the AutoRest wire behavior: emit "include=" whenever the list is non-null (an empty list produces an + // empty value), rather than omitting it. Keeps the request URL identical to the pre-migration implementation. + if (include != null) { + requestOptions.addQueryParam("include", 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/implementation/util/QueueUrlTrailingSlashPolicy.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/QueueUrlTrailingSlashPolicy.java new file mode 100644 index 000000000000..604c3b178836 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/QueueUrlTrailingSlashPolicy.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.implementation.util; + +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpPipelineNextSyncPolicy; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.util.UrlBuilder; +import com.azure.core.util.logging.ClientLogger; +import reactor.core.publisher.Mono; + +/** + * Restores the pre-TypeSpec (AutoRest) request URL shape for queue-scoped operations. + *

+ * 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. {@code @Get("?comp=metadata")}). azure-core's {@code RestProxy} + * assembles those into {@code .../{queue}/?comp=metadata} -- a slash before the query -- whereas AutoRest emitted + * {@code .../{queue}?comp=metadata} (the queue name was a path parameter). This policy strips that single trailing + * path slash so the wire URL is identical to the AutoRest behavior, keeping the account-root slash for service-scoped + * operations (path {@code "/"}) untouched. It must run before the credential policy so the shared-key signature is + * computed over the corrected URL. + */ +public final class QueueUrlTrailingSlashPolicy implements HttpPipelinePolicy { + private static final ClientLogger LOGGER = new ClientLogger(QueueUrlTrailingSlashPolicy.class); + + @Override + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + normalizeUrl(context); + return next.process(); + } + + @Override + public HttpResponse processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next) { + normalizeUrl(context); + return next.processSync(); + } + + private static void normalizeUrl(HttpPipelineCallContext context) { + UrlBuilder urlBuilder = UrlBuilder.parse(context.getHttpRequest().getUrl()); + String path = urlBuilder.getPath(); + // Only strip a trailing slash on a non-root path (queue-scoped ops); leave the account-root "/" alone. + if (path != null && path.length() > 1 && path.charAt(path.length() - 1) == '/') { + urlBuilder.setPath(path.substring(0, path.length() - 1)); + try { + context.getHttpRequest().setUrl(urlBuilder.toUrl()); + } catch (java.net.MalformedURLException e) { + throw LOGGER.logExceptionAsError(new IllegalStateException(e)); + } + } + } +} 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..9890a352ba90 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; @@ -21,29 +20,24 @@ */ @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,23 +45,12 @@ 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; - return this; - } - /** * 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,24 +61,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) { - this.lastSyncTime = null; - } else { - this.lastSyncTime = new DateTimeRfc1123(lastSyncTime); - } - return this; - } - @Generated @Override public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @@ -114,10 +79,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 +93,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 +107,63 @@ 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(); } } - + GeoReplication deserializedGeoReplication = new GeoReplication(); + deserializedGeoReplication.status = status; + deserializedGeoReplication.lastSyncTime = lastSyncTime == null ? null : new DateTimeRfc1123(lastSyncTime); return deserializedGeoReplication; }); } + + /** + * Creates an instance of GeoReplication class. + */ + @Generated + public GeoReplication() { + } + + /** + * 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; + return this; + } + + /** + * 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) { + this.lastSyncTime = null; + } else { + this.lastSyncTime = new DateTimeRfc1123(lastSyncTime); + } + return this; + } } 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..de69fcfa5cb5 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,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.models; @@ -9,23 +9,23 @@ 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"); 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..43f1c8e4ddab 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,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.models; @@ -22,19 +22,19 @@ @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 acl policy. */ @Generated private String permissions; @@ -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)); @@ -157,7 +157,7 @@ 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) { 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..5a1da3ecb65c 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,6 +17,7 @@ */ @Fluent public final class QueueAnalyticsLogging implements XmlSerializable { + /* * The version of Storage Analytics to configure. */ @@ -43,21 +43,14 @@ public final class QueueAnalyticsLogging implements XmlSerializable { - 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(); } } - + QueueAnalyticsLogging deserializedQueueAnalyticsLogging = new QueueAnalyticsLogging(); + deserializedQueueAnalyticsLogging.version = version; + deserializedQueueAnalyticsLogging.delete = delete; + deserializedQueueAnalyticsLogging.read = read; + deserializedQueueAnalyticsLogging.write = write; + deserializedQueueAnalyticsLogging.retentionPolicy = retentionPolicy; return deserializedQueueAnalyticsLogging; }); } + + /** + * Creates an instance of QueueAnalyticsLogging class. + */ + @Generated + public QueueAnalyticsLogging() { + } + + /** + * 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; + return this; + } + + /** + * 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; + return this; + } + + /** + * 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; + return this; + } + + /** + * 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; + return this; + } + + /** + * 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; + return this; + } } 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..dd96bf54f80e 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; @@ -21,6 +20,7 @@ */ @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 @@ -31,7 +31,7 @@ public final class QueueCorsRule implements XmlSerializable { private String allowedOrigins; /* - * The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated) + * The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated). */ @Generated private String allowedMethods; @@ -44,7 +44,7 @@ public final class QueueCorsRule implements XmlSerializable { /* * The response headers that may be sent in the response to the CORS request and exposed by the browser to the - * request issuer + * request issuer. */ @Generated private String exposedHeaders; @@ -55,19 +55,12 @@ public final class QueueCorsRule implements XmlSerializable { @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. - * + * * @return the allowedOrigins value. */ @Generated @@ -75,25 +68,10 @@ 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; - return this; - } - /** * Get the allowedMethods property: The methods (HTTP request verbs) that the origin domain may use for a CORS * request. (comma separated). - * + * * @return the allowedMethods value. */ @Generated @@ -101,22 +79,9 @@ 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; - return this; - } - /** * Get the allowedHeaders property: the request headers that the origin domain may specify on the CORS request. - * + * * @return the allowedHeaders value. */ @Generated @@ -124,22 +89,10 @@ 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; - return this; - } - /** * 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. - * + * * @return the exposedHeaders value. */ @Generated @@ -147,23 +100,10 @@ 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; - return this; - } - /** * Get the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS * request. - * + * * @return the maxAgeInSeconds value. */ @Generated @@ -171,19 +111,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; - return this; - } - @Generated @Override public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @@ -205,10 +132,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 +146,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 +160,107 @@ 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(); } } - + QueueCorsRule deserializedQueueCorsRule = new QueueCorsRule(); + deserializedQueueCorsRule.allowedOrigins = allowedOrigins; + deserializedQueueCorsRule.allowedMethods = allowedMethods; + deserializedQueueCorsRule.allowedHeaders = allowedHeaders; + deserializedQueueCorsRule.exposedHeaders = exposedHeaders; + deserializedQueueCorsRule.maxAgeInSeconds = maxAgeInSeconds; return deserializedQueueCorsRule; }); } + + /** + * Creates an instance of QueueCorsRule class. + */ + @Generated + public QueueCorsRule() { + } + + /** + * 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; + return this; + } + + /** + * 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; + return this; + } + + /** + * 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; + return this; + } + + /** + * 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; + return this; + } + + /** + * 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; + return this; + } } 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..36a9aff25b15 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,6 +19,7 @@ */ @Fluent public final class QueueItem implements XmlSerializable { + /* * The name of the Queue. */ @@ -27,21 +27,14 @@ public final class QueueItem implements XmlSerializable { private String name; /* - * Dictionary of + * Dictionary of . */ @Generated private Map metadata; - /** - * Creates an instance of QueueItem class. - */ - @Generated - public QueueItem() { - } - /** * Get the name property: The name of the Queue. - * + * * @return the name value. */ @Generated @@ -49,21 +42,9 @@ 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; - return this; - } - /** * Get the metadata property: Dictionary of <string>. - * + * * @return the metadata value. */ @Generated @@ -71,18 +52,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; - return this; - } - @Generated @Override public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @@ -107,10 +76,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,38 +90,71 @@ 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; }); } + + /** + * Creates an instance of QueueItem class. + */ + @Generated + public QueueItem() { + } + + /** + * 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; + return this; + } + + /** + * 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; + return this; + } } 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..c83b5c244444 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; @@ -18,6 +17,7 @@ */ @Fluent public final class QueueMetrics implements XmlSerializable { + /* * The version of Storage Analytics to configure. */ @@ -37,21 +37,14 @@ public final class QueueMetrics implements XmlSerializable { private Boolean includeApis; /* - * the retention policy + * the retention policy. */ @Generated private QueueRetentionPolicy retentionPolicy; - /** - * Creates an instance of QueueMetrics class. - */ - @Generated - public QueueMetrics() { - } - /** * Get the version property: The version of Storage Analytics to configure. - * + * * @return the version value. */ @Generated @@ -61,7 +54,7 @@ public String getVersion() { /** * Set the version property: The version of Storage Analytics to configure. - * + * * @param version the version value to set. * @return the QueueMetrics object itself. */ @@ -73,7 +66,7 @@ public QueueMetrics setVersion(String version) { /** * Get the enabled property: Indicates whether metrics are enabled for the Queue service. - * + * * @return the enabled value. */ @Generated @@ -81,22 +74,10 @@ 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; - return this; - } - /** * Get the includeApis property: Indicates whether metrics should generate summary statistics for called API * operations. - * + * * @return the includeApis value. */ @Generated @@ -107,7 +88,7 @@ public Boolean isIncludeApis() { /** * Set the includeApis property: Indicates whether metrics should generate summary statistics for called API * operations. - * + * * @param includeApis the includeApis value to set. * @return the QueueMetrics object itself. */ @@ -119,7 +100,7 @@ public QueueMetrics setIncludeApis(Boolean includeApis) { /** * Get the retentionPolicy property: the retention policy. - * + * * @return the retentionPolicy value. */ @Generated @@ -129,7 +110,7 @@ public QueueRetentionPolicy getRetentionPolicy() { /** * Set the retentionPolicy property: the retention policy. - * + * * @param retentionPolicy the retentionPolicy value to set. * @return the QueueMetrics object itself. */ @@ -148,7 +129,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 +140,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,37 +154,63 @@ 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; }); } + + /** + * Creates an instance of QueueMetrics class. + */ + @Generated + public QueueMetrics() { + } + + /** + * 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; + return this; + } } 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..7d112ecde9b7 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; @@ -18,29 +17,23 @@ */ @Fluent public final class QueueRetentionPolicy implements XmlSerializable { + /* - * Indicates whether a retention policy is enabled for the storage service + * Indicates whether a retention policy is enabled for the storage service. */ @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 + * this value will be deleted. */ @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. - * + * * @return the enabled value. */ @Generated @@ -48,22 +41,10 @@ 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; - return this; - } - /** * 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. - * + * * @return the days value. */ @Generated @@ -74,7 +55,7 @@ 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. - * + * * @param days the days value to set. * @return the QueueRetentionPolicy object itself. */ @@ -93,8 +74,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 +83,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,33 +97,55 @@ 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; }); } + + /** + * Creates an instance of QueueRetentionPolicy class. + */ + @Generated + public QueueRetentionPolicy() { + } + + /** + * 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; + return this; + } } 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..cd3bea54e024 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,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.models; @@ -21,19 +21,19 @@ @Fluent public final class QueueServiceProperties implements XmlSerializable { /* - * Azure Analytics Logging settings + * Azure Analytics Logging settings. */ @Generated private QueueAnalyticsLogging analyticsLogging; /* - * A summary of request statistics grouped by API in hourly aggregates for queues + * A summary of request statistics grouped by API in hourly aggregates for queues. */ @Generated private QueueMetrics hourMetrics; /* - * a summary of request statistics grouped by API in minute aggregates for queues + * a summary of request statistics grouped by API in minute aggregates for queues. */ @Generated private QueueMetrics minuteMetrics; 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..b913f6ad7b80 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; @@ -18,22 +17,16 @@ */ @Fluent public final class QueueServiceStatistics implements XmlSerializable { + /* - * Geo-Replication information for the Secondary Storage Service + * Geo-Replication information for the Secondary Storage Service. */ @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. - * + * * @return the geoReplication value. */ @Generated @@ -41,18 +34,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; - return this; - } - @Generated @Override public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @@ -63,7 +44,7 @@ public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @Override public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException { rootElementName - = rootElementName == null || rootElementName.isEmpty() ? "QueueServiceStatistics" : rootElementName; + = rootElementName == null || rootElementName.isEmpty() ? "StorageServiceStats" : rootElementName; xmlWriter.writeStartElement(rootElementName); xmlWriter.writeXml(this.geoReplication, "GeoReplication"); return xmlWriter.writeEndElement(); @@ -71,7 +52,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 +65,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 +77,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() ? "StorageServiceStats" : 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,8 +89,26 @@ public static QueueServiceStatistics fromXml(XmlReader xmlReader, String rootEle reader.skipElement(); } } - return deserializedQueueServiceStatistics; }); } + + /** + * Creates an instance of QueueServiceStatistics class. + */ + @Generated + public QueueServiceStatistics() { + } + + /** + * 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; + return this; + } } 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..e5d6ebdd2118 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; @@ -18,28 +17,22 @@ */ @Fluent public final class QueueSignedIdentifier implements XmlSerializable { + /* - * a unique id + * a unique id. */ @Generated private String id; /* - * The access policy + * The access policy. */ @Generated private QueueAccessPolicy accessPolicy; - /** - * Creates an instance of QueueSignedIdentifier class. - */ - @Generated - public QueueSignedIdentifier() { - } - /** * Get the id property: a unique id. - * + * * @return the id value. */ @Generated @@ -47,21 +40,9 @@ 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; - return this; - } - /** * Get the accessPolicy property: The access policy. - * + * * @return the accessPolicy value. */ @Generated @@ -69,18 +50,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; - return this; - } - @Generated @Override public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException { @@ -99,10 +68,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 +82,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 +96,53 @@ 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(); } } - + QueueSignedIdentifier deserializedQueueSignedIdentifier = new QueueSignedIdentifier(); + deserializedQueueSignedIdentifier.id = id; + deserializedQueueSignedIdentifier.accessPolicy = accessPolicy; return deserializedQueueSignedIdentifier; }); } + + /** + * Creates an instance of QueueSignedIdentifier class. + */ + @Generated + public QueueSignedIdentifier() { + } + + /** + * 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; + return this; + } + + /** + * 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; + return this; + } } 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..d58af8c30e35 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; @@ -21,6 +20,7 @@ */ @Fluent public final class SendMessageResult implements XmlSerializable { + /* * The Id of the Message. */ @@ -52,16 +52,9 @@ public final class SendMessageResult implements XmlSerializable { - 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(); } } - + 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; }); } + + /** + * Creates an instance of SendMessageResult class. + */ + @Generated + public SendMessageResult() { + } + + /** + * 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; + return this; + } + + /** + * 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) { + this.insertionTime = null; + } else { + this.insertionTime = new DateTimeRfc1123(insertionTime); + } + return this; + } + + /** + * 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) { + this.expirationTime = null; + } else { + this.expirationTime = new DateTimeRfc1123(expirationTime); + } + return this; + } + + /** + * 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; + return this; + } + + /** + * 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) { + this.timeNextVisible = null; + } else { + this.timeNextVisible = new DateTimeRfc1123(timeNextVisible); + } + return this; + } } 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..ff367f3012b1 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,6 +20,7 @@ */ @Fluent public final class UserDelegationKey implements XmlSerializable { + /* * The Azure Active Directory object ID in GUID format. */ @@ -28,31 +28,31 @@ public final class UserDelegationKey implements XmlSerializable { - 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; }); } + + /** + * Creates an instance of UserDelegationKey class. + */ + @Generated + public UserDelegationKey() { + } + + /** + * 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; + } + + /** + * 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; + } + + /** + * 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; + return this; + } + + /** + * 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; + return this; + } + + /** + * 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; + return this; + } + + /** + * 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; + } + + /** + * 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; + } + + /** + * 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; + 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..08458b73a0a5 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,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 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..16d0ca7df1d6 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,8 @@ // 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..298a54f25d97 --- /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":"b46cb9eb31bd","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.MessageIdsUpdateHeaders":null,"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.QueuesGetPropertiesHeaders":null,"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/XmlSerializer.java","src/main/java/com/azure/storage/queue/implementation/XmlSerializerProviders.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/MessageIdsUpdateHeaders.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/QueuesGetPropertiesHeaders.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..7b25125e7195 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 @@ -20,7 +20,6 @@ import java.time.Duration; import java.util.Arrays; -import java.util.Collections; /** * Base class for Azure Storage Queue tests. @@ -42,14 +41,18 @@ public void beforeTest() { if (getTestMode() != TestMode.LIVE) { interceptorManager.addSanitizers( - Collections.singletonList(new TestProxySanitizer("sig=(.*)", "REDACTED", TestProxySanitizerType.URL))); + Arrays.asList(new TestProxySanitizer("sig=(.*)", "REDACTED", TestProxySanitizerType.URL))); } // 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..5df33062ffaa --- /dev/null +++ b/sdk/storage/azure-storage-queue/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/storage/data-plane/QueueStorage +commit: 21116d8bddf1bda117c09517d629d3ab2f0c2681 +repo: gunjansingh-msft/azure-rest-api-specs +additionalDirectories: [] +