
com.azure.cosmos.ForbiddenException Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.cosmos;
import com.azure.cosmos.implementation.HttpConstants;
import com.azure.cosmos.implementation.RMResources;
import com.azure.cosmos.implementation.directconnectivity.HttpUtils;
import com.azure.cosmos.implementation.http.HttpHeaders;
import java.net.URI;
import java.util.Map;
public class ForbiddenException extends CosmosClientException {
ForbiddenException() {
this(RMResources.Forbidden);
}
public ForbiddenException(CosmosError cosmosError, long lsn, String partitionKeyRangeId,
Map responseHeaders) {
super(HttpConstants.StatusCodes.FORBIDDEN, cosmosError, responseHeaders);
BridgeInternal.setLSN(this, lsn);
BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId);
}
ForbiddenException(String message) {
this(message, null, null, null);
}
ForbiddenException(String message, HttpHeaders headers, String requestUrlString) {
this(message, null, headers, requestUrlString);
}
public ForbiddenException(String message, HttpHeaders headers, URI requestUri) {
this(message, headers, requestUri != null ? requestUri.toString() : null);
}
ForbiddenException(Exception innerException) {
this(RMResources.Forbidden, innerException, null, null);
}
ForbiddenException(String message,
Exception innerException,
HttpHeaders headers,
String requestUrlString) {
super(String.format("%s: %s", RMResources.Forbidden, message),
innerException,
HttpUtils.asMap(headers),
HttpConstants.StatusCodes.FORBIDDEN,
requestUrlString);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy