Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-blob/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/storage/azure-storage-blob",
"Tag": "java/storage/azure-storage-blob_47f4243e59"
"Tag": "java/storage/azure-storage-blob_63fe5a46f1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import com.azure.storage.blob.implementation.models.EncryptionScope;
import com.azure.storage.blob.implementation.models.ListBlobsFlatSegmentResponse;
import com.azure.storage.blob.implementation.models.ListBlobsHierarchySegmentResponse;
import com.azure.storage.blob.implementation.models.AuthenticationType;
import com.azure.storage.blob.implementation.models.CreateSessionConfiguration;
import com.azure.storage.blob.implementation.models.CreateSessionResponse;
import com.azure.storage.blob.implementation.util.BlobConstants;
import com.azure.storage.blob.implementation.util.BlobSasImplUtil;
import com.azure.storage.blob.implementation.util.ModelHelper;
Expand Down Expand Up @@ -1691,11 +1694,39 @@ public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureV
.generateSas(SasImplUtils.extractSharedKeyCredential(getHttpPipeline()), stringToSignHandler, context);
}

// private boolean validateNoTime(BlobRequestConditions modifiedRequestConditions) {
// if (modifiedRequestConditions == null) {
// return true;
// }
// return modifiedRequestConditions.getIfModifiedSince() == null
// && modifiedRequestConditions.getIfUnmodifiedSince() == null;
// }
/**
* Creates a session scoped to this container. The session provides temporary credentials (a session token and
* session key) that can be used to sign subsequent requests using the Shared Key protocol.
*
* @return A {@link Mono} containing the {@link CreateSessionResponse} with session credentials.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<CreateSessionResponse> createSession() {
return createSessionWithResponse().flatMap(FluxUtil::toMono);
}

/**
* Creates a session scoped to this container. The session provides temporary credentials (a session token and
* session key) that can be used to sign subsequent requests using the Shared Key protocol.
*
* @return A {@link Mono} containing a {@link Response} with the {@link CreateSessionResponse}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<CreateSessionResponse>> createSessionWithResponse() {
try {
return withContext(this::createSessionWithResponse);
} catch (RuntimeException ex) {
return monoError(LOGGER, ex);
}
}

Mono<Response<CreateSessionResponse>> createSessionWithResponse(Context context) {
context = context == null ? Context.NONE : context;
CreateSessionConfiguration config
= new CreateSessionConfiguration().setAuthenticationType(AuthenticationType.HMAC);
return this.azureBlobStorage.getContainers()
.createSessionWithResponseAsync(containerName, config, context)
.map(response -> new SimpleResponse<>(response, response.getValue()));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import com.azure.storage.blob.implementation.models.FilterBlobSegment;
import com.azure.storage.blob.implementation.models.ListBlobsFlatSegmentResponse;
import com.azure.storage.blob.implementation.models.ListBlobsHierarchySegmentResponse;
import com.azure.storage.blob.implementation.models.AuthenticationType;
import com.azure.storage.blob.implementation.models.CreateSessionConfiguration;
import com.azure.storage.blob.implementation.models.CreateSessionResponse;
import com.azure.storage.blob.implementation.util.BlobConstants;
import com.azure.storage.blob.implementation.util.BlobSasImplUtil;
import com.azure.storage.blob.implementation.util.ModelHelper;
Expand Down Expand Up @@ -1509,4 +1512,33 @@ public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureV
.generateSas(SasImplUtils.extractSharedKeyCredential(getHttpPipeline()), stringToSignHandler, context);
}

/**
* Creates a session scoped to this container. The session provides temporary credentials (a session token and
* session key) that can be used to sign subsequent requests using the Shared Key protocol.
*
* @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised.
* @param context Additional context that is passed through the Http pipeline during the service call.
* @return A response containing the {@link CreateSessionResponse} with session credentials.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<CreateSessionResponse> createSessionWithResponse(Duration timeout, Context context) {
Context finalContext = context == null ? Context.NONE : context;
CreateSessionConfiguration config
= new CreateSessionConfiguration().setAuthenticationType(AuthenticationType.HMAC);
Callable<Response<CreateSessionResponse>> operation = () -> this.azureBlobStorage.getContainers()
.createSessionWithResponse(containerName, config, null, null, finalContext);
return sendRequest(operation, timeout, BlobStorageException.class);
}

/**
* Creates a session scoped to this container. The session provides temporary credentials (a session token and
* session key) that can be used to sign subsequent requests using the Shared Key protocol.
*
* @return The {@link CreateSessionResponse} with session credentials.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public CreateSessionResponse createSession() {
return createSessionWithResponse(null, Context.NONE).getValue();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,7 @@ public enum BlobServiceVersion implements ServiceVersion {
/**
* Service version {@code 2026-04-06}.
*/
V2026_04_06("2026-04-06"),

/**
* Service version {@code 2026-06-06}.
*/
V2026_06_06("2026-06-06");
V2026_04_06("2026-04-06");

private final String version;

Expand All @@ -184,6 +179,6 @@ public String getVersion() {
* @return the latest {@link BlobServiceVersion}
*/
public static BlobServiceVersion getLatest() {
return V2026_06_06;
return V2026_04_06;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
import com.azure.storage.blob.implementation.models.ContainersSetAccessPolicyHeaders;
import com.azure.storage.blob.implementation.models.ContainersSetMetadataHeaders;
import com.azure.storage.blob.implementation.models.ContainersSubmitBatchHeaders;
import com.azure.storage.blob.implementation.models.CreateSessionConfiguration;
import com.azure.storage.blob.implementation.models.CreateSessionResponse;
import com.azure.storage.blob.implementation.models.FilterBlobSegment;
import com.azure.storage.blob.implementation.models.FilterBlobsIncludeItem;
import com.azure.storage.blob.implementation.models.ListBlobsFlatSegmentResponse;
Expand Down Expand Up @@ -938,6 +940,26 @@ Response<Void> getAccountInfoNoCustomHeadersSync(@HostParam("url") String url,
@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);

@Post("/{containerName}")
@ExpectedResponses({ 201 })
@UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class)
Mono<Response<CreateSessionResponse>> createSession(@HostParam("url") String url,
@PathParam("containerName") String containerName, @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") CreateSessionConfiguration createSessionConfiguration,
@HeaderParam("Accept") String accept, Context context);

@Post("/{containerName}")
@ExpectedResponses({ 201 })
@UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class)
Response<CreateSessionResponse> createSessionSync(@HostParam("url") String url,
@PathParam("containerName") String containerName, @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") CreateSessionConfiguration createSessionConfiguration,
@HeaderParam("Accept") String accept, Context context);
}

/**
Expand Down Expand Up @@ -6707,4 +6729,159 @@ public Response<Void> getAccountInfoNoCustomHeadersWithResponse(String container
throw ModelHelper.mapToBlobStorageException(internalException);
}
}

/**
* The Create Session operation enables users to create a session scoped to a container.
*
* @param containerName The container name.
* @param createSessionConfiguration The createSessionConfiguration parameter.
* @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a
* href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations"&gt;Setting
* Timeouts for Blob Service Operations.&lt;/a&gt;.
* @param requestId Provides 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 BlobStorageExceptionInternal thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<CreateSessionResponse>> createSessionWithResponseAsync(String containerName,
CreateSessionConfiguration createSessionConfiguration, Integer timeout, String requestId) {
return FluxUtil
.withContext(context -> createSessionWithResponseAsync(containerName, createSessionConfiguration, timeout,
requestId, context))
.onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException);
}

/**
* The Create Session operation enables users to create a session scoped to a container.
*
* @param containerName The container name.
* @param createSessionConfiguration The createSessionConfiguration parameter.
* @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a
* href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations"&gt;Setting
* Timeouts for Blob Service Operations.&lt;/a&gt;.
* @param requestId Provides 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 BlobStorageExceptionInternal thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<CreateSessionResponse>> createSessionWithResponseAsync(String containerName,
CreateSessionConfiguration createSessionConfiguration, Integer timeout, String requestId, Context context) {
final String restype = "container";
final String comp = "session";
final String accept = "application/xml";
return service
.createSession(this.client.getUrl(), containerName, restype, comp, timeout, this.client.getVersion(),
requestId, createSessionConfiguration, accept, context)
.onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException);
}

/**
* The Create Session operation enables users to create a session scoped to a container.
*
* @param containerName The container name.
* @param createSessionConfiguration The createSessionConfiguration parameter.
* @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a
* href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations"&gt;Setting
* Timeouts for Blob Service Operations.&lt;/a&gt;.
* @param requestId Provides 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 BlobStorageExceptionInternal thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<CreateSessionResponse> createSessionAsync(String containerName,
CreateSessionConfiguration createSessionConfiguration, Integer timeout, String requestId) {
return createSessionWithResponseAsync(containerName, createSessionConfiguration, timeout, requestId)
.onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}

/**
* The Create Session operation enables users to create a session scoped to a container.
*
* @param containerName The container name.
* @param createSessionConfiguration The createSessionConfiguration parameter.
* @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a
* href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations"&gt;Setting
* Timeouts for Blob Service Operations.&lt;/a&gt;.
* @param requestId Provides 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 BlobStorageExceptionInternal thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<CreateSessionResponse> createSessionAsync(String containerName,
CreateSessionConfiguration createSessionConfiguration, Integer timeout, String requestId, Context context) {
return createSessionWithResponseAsync(containerName, createSessionConfiguration, timeout, requestId, context)
.onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}

/**
* The Create Session operation enables users to create a session scoped to a container.
*
* @param containerName The container name.
* @param createSessionConfiguration The createSessionConfiguration parameter.
* @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a
* href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations"&gt;Setting
* Timeouts for Blob Service Operations.&lt;/a&gt;.
* @param requestId Provides 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 BlobStorageExceptionInternal thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<CreateSessionResponse> createSessionWithResponse(String containerName,
CreateSessionConfiguration createSessionConfiguration, Integer timeout, String requestId, Context context) {
try {
final String restype = "container";
final String comp = "session";
final String accept = "application/xml";
return service.createSessionSync(this.client.getUrl(), containerName, restype, comp, timeout,
this.client.getVersion(), requestId, createSessionConfiguration, accept, context);
} catch (BlobStorageExceptionInternal internalException) {
throw ModelHelper.mapToBlobStorageException(internalException);
}
}

/**
* The Create Session operation enables users to create a session scoped to a container.
*
* @param containerName The container name.
* @param createSessionConfiguration The createSessionConfiguration parameter.
* @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a
* href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations"&gt;Setting
* Timeouts for Blob Service Operations.&lt;/a&gt;.
* @param requestId Provides 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 BlobStorageExceptionInternal thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public CreateSessionResponse createSession(String containerName,
CreateSessionConfiguration createSessionConfiguration, Integer timeout, String requestId) {
try {
return createSessionWithResponse(containerName, createSessionConfiguration, timeout, requestId,
Context.NONE).getValue();
} catch (BlobStorageExceptionInternal internalException) {
throw ModelHelper.mapToBlobStorageException(internalException);
}
}
}
Loading