//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `external/credentials/issue`. Version: `0.2`.
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
/// Error types.
pub mod error {
/// Error from a `TryFrom` or `FromStr` implementation.
pub struct ConversionError(::std::borrow::Cow<'static, str>);
impl ::std::error::Error for ConversionError {}
impl ::std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Display::fmt(&self.0, f)
}
}
impl ::std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
///The custodian context that owns the account. Act scope in this context decides who may manage the account and who may consume it; the account's keys are derived in this context's key space.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "AccountContextId",
/// "description": "The custodian context that owns the account. Act scope in this context decides who may manage the account and who may consume it; the account's keys are derived in this context's key space.",
/// "type": "string",
/// "maxLength": 256,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct AccountContextId(::std::string::String);
impl ::std::ops::Deref for AccountContextId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<AccountContextId> for ::std::string::String {
fn from(value: AccountContextId) -> Self {
value.0
}
}
impl ::std::str::FromStr for AccountContextId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 256usize {
return Err("longer than 256 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for AccountContextId {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for AccountContextId {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for AccountContextId {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for AccountContextId {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///The account's identifier within its context, chosen by whoever creates it. Lowercase letters, digits and hyphens, so that it can be embedded in a certificate subject, a token subject or a provider-side condition without escaping. Unique per context; never reused after deletion while anything that names it (a provider-side trust policy, an audit row) may still exist.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "AccountId",
/// "description": "The account's identifier within its context, chosen by whoever creates it. Lowercase letters, digits and hyphens, so that it can be embedded in a certificate subject, a token subject or a provider-side condition without escaping. Unique per context; never reused after deletion while anything that names it (a provider-side trust policy, an audit row) may still exist.",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1,
/// "pattern": "^[a-z0-9][a-z0-9-]*$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct AccountId(::std::string::String);
impl ::std::ops::Deref for AccountId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<AccountId> for ::std::string::String {
fn from(value: AccountId) -> Self {
value.0
}
}
impl ::std::str::FromStr for AccountId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 64usize {
return Err("longer than 64 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| ::regress::Regex::new("^[a-z0-9][a-z0-9-]*$").unwrap());
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[a-z0-9][a-z0-9-]*$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for AccountId {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for AccountId {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for AccountId {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for AccountId {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///A SHA-256 digest in standard base64 (RFC 4648 §4, padded), as S3 carries it in `x-amz-checksum-sha256`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ChecksumSha256",
/// "description": "A SHA-256 digest in standard base64 (RFC 4648 §4, padded), as S3 carries it in `x-amz-checksum-sha256`.",
/// "type": "string",
/// "maxLength": 44,
/// "minLength": 44,
/// "pattern": "^[A-Za-z0-9+/]{43}=$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ChecksumSha256(::std::string::String);
impl ::std::ops::Deref for ChecksumSha256 {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ChecksumSha256> for ::std::string::String {
fn from(value: ChecksumSha256) -> Self {
value.0
}
}
impl ::std::str::FromStr for ChecksumSha256 {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 44usize {
return Err("longer than 44 characters".into());
}
if value.chars().count() < 44usize {
return Err("shorter than 44 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| ::regress::Regex::new("^[A-Za-z0-9+/]{43}=$").unwrap());
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[A-Za-z0-9+/]{43}=$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ChecksumSha256 {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ChecksumSha256 {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ChecksumSha256 {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ChecksumSha256 {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///What one issuance may do. For storage models, `prefix` and `actions` (both required, a rule this schema leaves to the custodian because other models use neither); for `s3-static-presign`, also `objectKey`, since a presigned URL is one operation on one object; for `oauth2-private-key-jwt`, `scopes`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "CredentialScope",
/// "description": "What one issuance may do. For storage models, `prefix` and `actions` (both required, a rule this schema leaves to the custodian because other models use neither); for `s3-static-presign`, also `objectKey`, since a presigned URL is one operation on one object; for `oauth2-private-key-jwt`, `scopes`.",
/// "type": "object",
/// "properties": {
/// "actions": {
/// "type": "array",
/// "items": {
/// "$ref": "#/definitions/ProviderObjectAction"
/// },
/// "maxItems": 3,
/// "minItems": 1,
/// "uniqueItems": true
/// },
/// "objectKey": {
/// "description": "`s3-static-presign` only: the object's name within `prefix`. The presigned URL names `prefix` + `objectKey` and nothing else, and `actions` must hold exactly one action.",
/// "type": "string",
/// "maxLength": 1024,
/// "minLength": 1,
/// "pattern": "^[A-Za-z0-9._-]+$"
/// },
/// "prefix": {
/// "$ref": "#/definitions/ProviderObjectPrefix"
/// },
/// "scopes": {
/// "description": "`oauth2-private-key-jwt` only: the OAuth scopes requested.",
/// "type": "array",
/// "items": {
/// "type": "string",
/// "maxLength": 256,
/// "pattern": "^[!#-\\[\\]-~]+$"
/// },
/// "maxItems": 64,
/// "uniqueItems": true
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct CredentialScope {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub actions: ::std::option::Option<Vec<ProviderObjectAction>>,
///`s3-static-presign` only: the object's name within `prefix`. The presigned URL names `prefix` + `objectKey` and nothing else, and `actions` must hold exactly one action.
#[serde(
rename = "objectKey",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub object_key: ::std::option::Option<CredentialScopeObjectKey>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub prefix: ::std::option::Option<ProviderObjectPrefix>,
///`oauth2-private-key-jwt` only: the OAuth scopes requested.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub scopes: ::std::option::Option<Vec<CredentialScopeScopesItem>>,
}
impl ::std::default::Default for CredentialScope {
fn default() -> Self {
Self {
actions: Default::default(),
object_key: Default::default(),
prefix: Default::default(),
scopes: Default::default(),
}
}
}
impl CredentialScope {
pub fn builder() -> builder::CredentialScope {
Default::default()
}
}
///`s3-static-presign` only: the object's name within `prefix`. The presigned URL names `prefix` + `objectKey` and nothing else, and `actions` must hold exactly one action.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "`s3-static-presign` only: the object's name within `prefix`. The presigned URL names `prefix` + `objectKey` and nothing else, and `actions` must hold exactly one action.",
/// "type": "string",
/// "maxLength": 1024,
/// "minLength": 1,
/// "pattern": "^[A-Za-z0-9._-]+$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct CredentialScopeObjectKey(::std::string::String);
impl ::std::ops::Deref for CredentialScopeObjectKey {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<CredentialScopeObjectKey> for ::std::string::String {
fn from(value: CredentialScopeObjectKey) -> Self {
value.0
}
}
impl ::std::str::FromStr for CredentialScopeObjectKey {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 1024usize {
return Err("longer than 1024 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| ::regress::Regex::new("^[A-Za-z0-9._-]+$").unwrap());
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[A-Za-z0-9._-]+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for CredentialScopeObjectKey {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for CredentialScopeObjectKey {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for CredentialScopeObjectKey {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for CredentialScopeObjectKey {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///`CredentialScopeScopesItem`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "maxLength": 256,
/// "pattern": "^[!#-\\[\\]-~]+$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct CredentialScopeScopesItem(::std::string::String);
impl ::std::ops::Deref for CredentialScopeScopesItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<CredentialScopeScopesItem> for ::std::string::String {
fn from(value: CredentialScopeScopesItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for CredentialScopeScopesItem {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 256usize {
return Err("longer than 256 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| ::regress::Regex::new("^[!#-\\[\\]-~]+$").unwrap());
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[!#-\\[\\]-~]+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for CredentialScopeScopesItem {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for CredentialScopeScopesItem {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for CredentialScopeScopesItem {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for CredentialScopeScopesItem {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Ext",
/// "description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
/// "type": "object",
/// "minProperties": 1,
/// "additionalProperties": true,
/// "propertyNames": {
/// "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct Ext(pub ::std::collections::HashMap<ExtKey, ::serde_json::Value>);
impl ::std::ops::Deref for Ext {
type Target = ::std::collections::HashMap<ExtKey, ::serde_json::Value>;
fn deref(&self) -> &::std::collections::HashMap<ExtKey, ::serde_json::Value> {
&self.0
}
}
impl ::std::convert::From<Ext> for ::std::collections::HashMap<ExtKey, ::serde_json::Value> {
fn from(value: Ext) -> Self {
value.0
}
}
impl ::std::convert::From<::std::collections::HashMap<ExtKey, ::serde_json::Value>> for Ext {
fn from(value: ::std::collections::HashMap<ExtKey, ::serde_json::Value>) -> Self {
Self(value)
}
}
///`ExtKey`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ExtKey(::std::string::String);
impl ::std::ops::Deref for ExtKey {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ExtKey> for ::std::string::String {
fn from(value: ExtKey) -> Self {
value.0
}
}
impl ::std::str::FromStr for ExtKey {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ExtKey {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///Obtain a short-lived, downscoped provider credential from an external account, sealed to the caller: session or token credentials under `scope`, or a batch of presigned requests on one object under `presign`. The outer document members are owned by the framework — SPEC §6.3.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/external/credentials/issue/0.2",
/// "title": "Payload",
/// "description": "Obtain a short-lived, downscoped provider credential from an external account, sealed to the caller: session or token credentials under `scope`, or a batch of presigned requests on one object under `presign`. The outer document members are owned by the framework — SPEC §6.3.",
/// "type": "object",
/// "oneOf": [
/// {
/// "not": {
/// "required": [
/// "presign"
/// ]
/// },
/// "required": [
/// "scope"
/// ]
/// },
/// {
/// "not": {
/// "required": [
/// "scope"
/// ]
/// },
/// "required": [
/// "presign"
/// ]
/// }
/// ],
/// "required": [
/// "account",
/// "context",
/// "ttlSeconds"
/// ],
/// "properties": {
/// "account": {
/// "$ref": "#/definitions/AccountId"
/// },
/// "context": {
/// "$ref": "#/definitions/AccountContextId"
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "presign": {
/// "$ref": "#/definitions/PresignBatch"
/// },
/// "scope": {
/// "description": "For every brokered model but `s3-static-presign`: the prefix and actions, or the OAuth scopes, the session or token is downscoped to. `objectKey` is not used in this version.",
/// "$ref": "#/definitions/CredentialScope"
/// },
/// "ttlSeconds": {
/// "description": "Requested lifetime; never more than the binding's `maxTtlSeconds`. For `presign`, the lifetime of every URL in the batch.",
/// "type": "integer",
/// "maximum": 3600.0,
/// "minimum": 60.0
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged, deny_unknown_fields)]
#[non_exhaustive]
pub enum Payload {
Variant0 {
account: AccountId,
context: AccountContextId,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
ext: ::std::option::Option<Ext>,
///For every brokered model but `s3-static-presign`: the prefix and actions, or the OAuth scopes, the session or token is downscoped to. `objectKey` is not used in this version.
scope: CredentialScope,
///Requested lifetime; never more than the binding's `maxTtlSeconds`. For `presign`, the lifetime of every URL in the batch.
#[serde(rename = "ttlSeconds")]
ttl_seconds: i64,
},
Variant1 {
account: AccountId,
context: AccountContextId,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
ext: ::std::option::Option<Ext>,
presign: PresignBatch,
///Requested lifetime; never more than the binding's `maxTtlSeconds`. For `presign`, the lifetime of every URL in the batch.
#[serde(rename = "ttlSeconds")]
ttl_seconds: i64,
},
}
///`s3-static-presign` only: up to 128 operations on **one** object, `prefix` + `objectKey`, and at most one multipart upload of it. Each operation becomes one presigned request, sealed together. Consistency rules JSON Schema cannot state, which the custodian enforces: `uploadId` is present exactly when an operation needs it (`upload-part`, `list-parts`, `complete-multipart`, `abort-multipart`) and absent when the batch holds `create-multipart`; no two operations are identical; no two `upload-part` operations name the same `partNumber`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "PresignBatch",
/// "description": "`s3-static-presign` only: up to 128 operations on **one** object, `prefix` + `objectKey`, and at most one multipart upload of it. Each operation becomes one presigned request, sealed together. Consistency rules JSON Schema cannot state, which the custodian enforces: `uploadId` is present exactly when an operation needs it (`upload-part`, `list-parts`, `complete-multipart`, `abort-multipart`) and absent when the batch holds `create-multipart`; no two operations are identical; no two `upload-part` operations name the same `partNumber`.",
/// "type": "object",
/// "required": [
/// "objectKey",
/// "prefix",
/// "requests"
/// ],
/// "properties": {
/// "objectKey": {
/// "description": "The object's name within `prefix`. Every request in the batch names `prefix` + `objectKey` and no other object.",
/// "type": "string",
/// "maxLength": 1024,
/// "minLength": 1,
/// "pattern": "^[A-Za-z0-9._-]+$"
/// },
/// "prefix": {
/// "$ref": "#/definitions/ProviderObjectPrefix"
/// },
/// "requests": {
/// "type": "array",
/// "items": {
/// "$ref": "#/definitions/PresignRequest"
/// },
/// "maxItems": 128,
/// "minItems": 1
/// },
/// "uploadId": {
/// "description": "The multipart upload the batch's multipart operations act on, as storage returned it from CreateMultipartUpload. Signed into each such request's query, percent-encoded by the SigV4 encoder, never interpolated.",
/// "type": "string",
/// "maxLength": 1024,
/// "minLength": 1,
/// "pattern": "^[A-Za-z0-9._~+/=-]+$"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct PresignBatch {
///The object's name within `prefix`. Every request in the batch names `prefix` + `objectKey` and no other object.
#[serde(rename = "objectKey")]
pub object_key: PresignBatchObjectKey,
pub prefix: ProviderObjectPrefix,
pub requests: ::std::vec::Vec<PresignRequest>,
///The multipart upload the batch's multipart operations act on, as storage returned it from CreateMultipartUpload. Signed into each such request's query, percent-encoded by the SigV4 encoder, never interpolated.
#[serde(
rename = "uploadId",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub upload_id: ::std::option::Option<PresignBatchUploadId>,
}
impl PresignBatch {
pub fn builder() -> builder::PresignBatch {
Default::default()
}
}
///The object's name within `prefix`. Every request in the batch names `prefix` + `objectKey` and no other object.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The object's name within `prefix`. Every request in the batch names `prefix` + `objectKey` and no other object.",
/// "type": "string",
/// "maxLength": 1024,
/// "minLength": 1,
/// "pattern": "^[A-Za-z0-9._-]+$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PresignBatchObjectKey(::std::string::String);
impl ::std::ops::Deref for PresignBatchObjectKey {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PresignBatchObjectKey> for ::std::string::String {
fn from(value: PresignBatchObjectKey) -> Self {
value.0
}
}
impl ::std::str::FromStr for PresignBatchObjectKey {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 1024usize {
return Err("longer than 1024 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| ::regress::Regex::new("^[A-Za-z0-9._-]+$").unwrap());
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[A-Za-z0-9._-]+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PresignBatchObjectKey {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for PresignBatchObjectKey {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for PresignBatchObjectKey {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for PresignBatchObjectKey {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///The multipart upload the batch's multipart operations act on, as storage returned it from CreateMultipartUpload. Signed into each such request's query, percent-encoded by the SigV4 encoder, never interpolated.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The multipart upload the batch's multipart operations act on, as storage returned it from CreateMultipartUpload. Signed into each such request's query, percent-encoded by the SigV4 encoder, never interpolated.",
/// "type": "string",
/// "maxLength": 1024,
/// "minLength": 1,
/// "pattern": "^[A-Za-z0-9._~+/=-]+$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PresignBatchUploadId(::std::string::String);
impl ::std::ops::Deref for PresignBatchUploadId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PresignBatchUploadId> for ::std::string::String {
fn from(value: PresignBatchUploadId) -> Self {
value.0
}
}
impl ::std::str::FromStr for PresignBatchUploadId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 1024usize {
return Err("longer than 1024 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| ::regress::Regex::new("^[A-Za-z0-9._~+/=-]+$").unwrap());
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[A-Za-z0-9._~+/=-]+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PresignBatchUploadId {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for PresignBatchUploadId {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for PresignBatchUploadId {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for PresignBatchUploadId {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///One operation to presign, discriminated by `operation`. The ceiling action each needs is in `PresignOperation`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "PresignRequest",
/// "description": "One operation to presign, discriminated by `operation`. The ceiling action each needs is in `PresignOperation`.",
/// "oneOf": [
/// {
/// "title": "PresignPut",
/// "description": "PutObject of the whole object, bound to its exact length and SHA-256.",
/// "type": "object",
/// "required": [
/// "checksumSha256",
/// "contentLength",
/// "operation"
/// ],
/// "properties": {
/// "checksumSha256": {
/// "$ref": "#/definitions/ChecksumSha256"
/// },
/// "contentLength": {
/// "description": "The object's exact length in bytes, signed into the request as `Content-Length`. At most 5 GiB, S3's single-request ceiling.",
/// "type": "integer",
/// "maximum": 5368709120.0,
/// "minimum": 0.0
/// },
/// "operation": {
/// "type": "string",
/// "const": "put"
/// }
/// },
/// "additionalProperties": false
/// },
/// {
/// "title": "PresignGet",
/// "description": "GetObject.",
/// "type": "object",
/// "required": [
/// "operation"
/// ],
/// "properties": {
/// "operation": {
/// "type": "string",
/// "const": "get"
/// }
/// },
/// "additionalProperties": false
/// },
/// {
/// "title": "PresignHead",
/// "description": "HeadObject, with `x-amz-checksum-mode: ENABLED` signed so storage reports the object's checksum.",
/// "type": "object",
/// "required": [
/// "operation"
/// ],
/// "properties": {
/// "operation": {
/// "type": "string",
/// "const": "head"
/// }
/// },
/// "additionalProperties": false
/// },
/// {
/// "title": "PresignDelete",
/// "description": "DeleteObject.",
/// "type": "object",
/// "required": [
/// "operation"
/// ],
/// "properties": {
/// "operation": {
/// "type": "string",
/// "const": "delete"
/// }
/// },
/// "additionalProperties": false
/// },
/// {
/// "title": "PresignCreateMultipart",
/// "description": "CreateMultipartUpload, with `x-amz-checksum-algorithm: SHA256` signed so every part of the upload must carry a SHA-256 checksum.",
/// "type": "object",
/// "required": [
/// "operation"
/// ],
/// "properties": {
/// "operation": {
/// "type": "string",
/// "const": "create-multipart"
/// }
/// },
/// "additionalProperties": false
/// },
/// {
/// "title": "PresignUploadPart",
/// "description": "UploadPart of one part of `uploadId`, bound to its number, its exact length and its SHA-256.",
/// "type": "object",
/// "required": [
/// "checksumSha256",
/// "contentLength",
/// "operation",
/// "partNumber"
/// ],
/// "properties": {
/// "checksumSha256": {
/// "$ref": "#/definitions/ChecksumSha256"
/// },
/// "contentLength": {
/// "description": "The part's exact length in bytes, signed into the request as `Content-Length`. At most 5 GiB, S3's part ceiling.",
/// "type": "integer",
/// "maximum": 5368709120.0,
/// "minimum": 1.0
/// },
/// "operation": {
/// "type": "string",
/// "const": "upload-part"
/// },
/// "partNumber": {
/// "type": "integer",
/// "maximum": 10000.0,
/// "minimum": 1.0
/// }
/// },
/// "additionalProperties": false
/// },
/// {
/// "title": "PresignListParts",
/// "description": "ListParts of `uploadId`: each part's number, length, ETag and checksum, up to 1000 per page.",
/// "type": "object",
/// "required": [
/// "operation"
/// ],
/// "properties": {
/// "operation": {
/// "type": "string",
/// "const": "list-parts"
/// },
/// "partNumberMarker": {
/// "description": "List parts after this number. Absent, from the first.",
/// "type": "integer",
/// "maximum": 10000.0,
/// "minimum": 0.0
/// }
/// },
/// "additionalProperties": false
/// },
/// {
/// "title": "PresignCompleteMultipart",
/// "description": "CompleteMultipartUpload of `uploadId`, bound to the assembled object's exact length.",
/// "type": "object",
/// "required": [
/// "contentLength",
/// "operation"
/// ],
/// "properties": {
/// "contentLength": {
/// "description": "The assembled object's exact length in bytes, signed into the request as `x-amz-mp-object-size`, so storage refuses a completion that would assemble any other size. At most 5 TiB, S3's object ceiling.",
/// "type": "integer",
/// "maximum": 5497558138880.0,
/// "minimum": 0.0
/// },
/// "operation": {
/// "type": "string",
/// "const": "complete-multipart"
/// }
/// },
/// "additionalProperties": false
/// },
/// {
/// "title": "PresignAbortMultipart",
/// "description": "AbortMultipartUpload of `uploadId`.",
/// "type": "object",
/// "required": [
/// "operation"
/// ],
/// "properties": {
/// "operation": {
/// "type": "string",
/// "const": "abort-multipart"
/// }
/// },
/// "additionalProperties": false
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(tag = "operation", deny_unknown_fields)]
#[non_exhaustive]
pub enum PresignRequest {
/**
PresignPut
PutObject of the whole object, bound to its exact length and SHA-256.*/
#[serde(rename = "put")]
Put {
#[serde(rename = "checksumSha256")]
checksum_sha256: ChecksumSha256,
///The object's exact length in bytes, signed into the request as `Content-Length`. At most 5 GiB, S3's single-request ceiling.
#[serde(rename = "contentLength")]
content_length: i64,
},
#[serde(rename = "get")]
Get,
#[serde(rename = "head")]
Head,
#[serde(rename = "delete")]
Delete,
#[serde(rename = "create-multipart")]
CreateMultipart,
/**
PresignUploadPart
UploadPart of one part of `uploadId`, bound to its number, its exact length and its SHA-256.*/
#[serde(rename = "upload-part")]
UploadPart {
#[serde(rename = "checksumSha256")]
checksum_sha256: ChecksumSha256,
///The part's exact length in bytes, signed into the request as `Content-Length`. At most 5 GiB, S3's part ceiling.
#[serde(rename = "contentLength")]
content_length: ::std::num::NonZeroU64,
#[serde(rename = "partNumber")]
part_number: ::std::num::NonZeroU64,
},
/**
PresignListParts
ListParts of `uploadId`: each part's number, length, ETag and checksum, up to 1000 per page.*/
#[serde(rename = "list-parts")]
ListParts {
///List parts after this number. Absent, from the first.
#[serde(
rename = "partNumberMarker",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
part_number_marker: ::std::option::Option<i64>,
},
/**
PresignCompleteMultipart
CompleteMultipartUpload of `uploadId`, bound to the assembled object's exact length.*/
#[serde(rename = "complete-multipart")]
CompleteMultipart {
///The assembled object's exact length in bytes, signed into the request as `x-amz-mp-object-size`, so storage refuses a completion that would assemble any other size. At most 5 TiB, S3's object ceiling.
#[serde(rename = "contentLength")]
content_length: i64,
},
#[serde(rename = "abort-multipart")]
AbortMultipart,
}
///`put`: write an object. `get`: read one. `delete`: remove one. No list, ACL, policy or bucket-level action exists here, so none can be granted.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ProviderObjectAction",
/// "description": "`put`: write an object. `get`: read one. `delete`: remove one. No list, ACL, policy or bucket-level action exists here, so none can be granted.",
/// "type": "string",
/// "enum": [
/// "put",
/// "get",
/// "delete"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum ProviderObjectAction {
#[serde(rename = "put")]
Put,
#[serde(rename = "get")]
Get,
#[serde(rename = "delete")]
Delete,
}
impl ::std::fmt::Display for ProviderObjectAction {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Put => f.write_str("put"),
Self::Get => f.write_str("get"),
Self::Delete => f.write_str("delete"),
}
}
}
impl ::std::str::FromStr for ProviderObjectAction {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"put" => Ok(Self::Put),
"get" => Ok(Self::Get),
"delete" => Ok(Self::Delete),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for ProviderObjectAction {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ProviderObjectAction {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ProviderObjectAction {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///An object-key prefix within the account's bucket: one or more segments of lowercase letters, digits, `.`, `_` and `-`, each beginning with a letter or digit and ending with `/`. No quote, backslash, wildcard, whitespace, `..` segment or empty segment can appear. That is deliberate: the custodian places this value inside a provider policy — an IAM session policy (JSON), a GCS Credential Access Boundary condition (CEL) — and a value able to carry a metacharacter can break out of the string it is placed in and widen the policy. That is a known class of defect (CVE-2026-42811, a CEL injection in downscoped GCS credentials). Even with this pattern, a custodian MUST build provider policies with the provider language's own encoder, never by string interpolation.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ProviderObjectPrefix",
/// "description": "An object-key prefix within the account's bucket: one or more segments of lowercase letters, digits, `.`, `_` and `-`, each beginning with a letter or digit and ending with `/`. No quote, backslash, wildcard, whitespace, `..` segment or empty segment can appear. That is deliberate: the custodian places this value inside a provider policy — an IAM session policy (JSON), a GCS Credential Access Boundary condition (CEL) — and a value able to carry a metacharacter can break out of the string it is placed in and widen the policy. That is a known class of defect (CVE-2026-42811, a CEL injection in downscoped GCS credentials). Even with this pattern, a custodian MUST build provider policies with the provider language's own encoder, never by string interpolation.",
/// "type": "string",
/// "maxLength": 512,
/// "minLength": 2,
/// "pattern": "^([a-z0-9][a-z0-9._-]{0,127}/){1,16}$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ProviderObjectPrefix(::std::string::String);
impl ::std::ops::Deref for ProviderObjectPrefix {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ProviderObjectPrefix> for ::std::string::String {
fn from(value: ProviderObjectPrefix) -> Self {
value.0
}
}
impl ::std::str::FromStr for ProviderObjectPrefix {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 512usize {
return Err("longer than 512 characters".into());
}
if value.chars().count() < 2usize {
return Err("shorter than 2 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^([a-z0-9][a-z0-9._-]{0,127}/){1,16}$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^([a-z0-9][a-z0-9._-]{0,127}/){1,16}$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ProviderObjectPrefix {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ProviderObjectPrefix {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ProviderObjectPrefix {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ProviderObjectPrefix {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///`Response`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "type": "object",
/// "oneOf": [
/// {
/// "not": {
/// "required": [
/// "presign"
/// ]
/// },
/// "required": [
/// "scope"
/// ]
/// },
/// {
/// "not": {
/// "required": [
/// "scope"
/// ]
/// },
/// "required": [
/// "presign"
/// ]
/// }
/// ],
/// "required": [
/// "expiresAt",
/// "sealedCredential"
/// ],
/// "properties": {
/// "expiresAt": {
/// "description": "The provider's expiry for the credential, in the clear; for `presign`, the earliest expiry in the batch.",
/// "type": "string",
/// "format": "date-time"
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "presign": {
/// "description": "The batch actually presigned, which equals the requested one.",
/// "$ref": "#/definitions/PresignBatch"
/// },
/// "scope": {
/// "description": "The scope actually granted, which equals the requested one.",
/// "$ref": "#/definitions/CredentialScope"
/// },
/// "sealedCredential": {
/// "description": "A `SealedTransferBundle` (external/_shared/0.1), sealed to the caller's key-agreement key, whose cleartext is an `ExternalCredentialPayload` for `scope` or a `PresignedRequestSet` for `presign`. Bounded at 256 KiB rather than the shared 64 KiB because a batch of 128 presigned requests does not fit 64 KiB.",
/// "type": "string",
/// "maxLength": 262144,
/// "minLength": 64,
/// "pattern": "^-----BEGIN VTA SEALED BUNDLE-----[\\s\\S]+-----END VTA SEALED BUNDLE-----\\s*$"
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "response"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged, deny_unknown_fields)]
#[non_exhaustive]
pub enum Response {
Variant0 {
///The provider's expiry for the credential, in the clear; for `presign`, the earliest expiry in the batch.
#[serde(rename = "expiresAt")]
expires_at: ::chrono::DateTime<::chrono::offset::Utc>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
ext: ::std::option::Option<Ext>,
///The scope actually granted, which equals the requested one.
scope: CredentialScope,
///A `SealedTransferBundle` (external/_shared/0.1), sealed to the caller's key-agreement key, whose cleartext is an `ExternalCredentialPayload` for `scope` or a `PresignedRequestSet` for `presign`. Bounded at 256 KiB rather than the shared 64 KiB because a batch of 128 presigned requests does not fit 64 KiB.
#[serde(rename = "sealedCredential")]
sealed_credential: ResponseVariant0SealedCredential,
},
Variant1 {
///The provider's expiry for the credential, in the clear; for `presign`, the earliest expiry in the batch.
#[serde(rename = "expiresAt")]
expires_at: ::chrono::DateTime<::chrono::offset::Utc>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
ext: ::std::option::Option<Ext>,
///The batch actually presigned, which equals the requested one.
presign: PresignBatch,
///A `SealedTransferBundle` (external/_shared/0.1), sealed to the caller's key-agreement key, whose cleartext is an `ExternalCredentialPayload` for `scope` or a `PresignedRequestSet` for `presign`. Bounded at 256 KiB rather than the shared 64 KiB because a batch of 128 presigned requests does not fit 64 KiB.
#[serde(rename = "sealedCredential")]
sealed_credential: ResponseVariant1SealedCredential,
},
}
///A `SealedTransferBundle` (external/_shared/0.1), sealed to the caller's key-agreement key, whose cleartext is an `ExternalCredentialPayload` for `scope` or a `PresignedRequestSet` for `presign`. Bounded at 256 KiB rather than the shared 64 KiB because a batch of 128 presigned requests does not fit 64 KiB.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A `SealedTransferBundle` (external/_shared/0.1), sealed to the caller's key-agreement key, whose cleartext is an `ExternalCredentialPayload` for `scope` or a `PresignedRequestSet` for `presign`. Bounded at 256 KiB rather than the shared 64 KiB because a batch of 128 presigned requests does not fit 64 KiB.",
/// "type": "string",
/// "maxLength": 262144,
/// "minLength": 64,
/// "pattern": "^-----BEGIN VTA SEALED BUNDLE-----[\\s\\S]+-----END VTA SEALED BUNDLE-----\\s*$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseVariant0SealedCredential(::std::string::String);
impl ::std::ops::Deref for ResponseVariant0SealedCredential {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseVariant0SealedCredential> for ::std::string::String {
fn from(value: ResponseVariant0SealedCredential) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseVariant0SealedCredential {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 262144usize {
return Err("longer than 262144 characters".into());
}
if value.chars().count() < 64usize {
return Err("shorter than 64 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(
|| {
::regress::Regex::new(
"^-----BEGIN VTA SEALED BUNDLE-----[\\s\\S]+-----END VTA SEALED BUNDLE-----\\s*$",
)
.unwrap()
},
);
if PATTERN.find(value).is_none() {
return Err(
"doesn't match pattern \"^-----BEGIN VTA SEALED BUNDLE-----[\\s\\S]+-----END VTA SEALED BUNDLE-----\\s*$\""
.into(),
);
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ResponseVariant0SealedCredential {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ResponseVariant0SealedCredential {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ResponseVariant0SealedCredential {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ResponseVariant0SealedCredential {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///A `SealedTransferBundle` (external/_shared/0.1), sealed to the caller's key-agreement key, whose cleartext is an `ExternalCredentialPayload` for `scope` or a `PresignedRequestSet` for `presign`. Bounded at 256 KiB rather than the shared 64 KiB because a batch of 128 presigned requests does not fit 64 KiB.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A `SealedTransferBundle` (external/_shared/0.1), sealed to the caller's key-agreement key, whose cleartext is an `ExternalCredentialPayload` for `scope` or a `PresignedRequestSet` for `presign`. Bounded at 256 KiB rather than the shared 64 KiB because a batch of 128 presigned requests does not fit 64 KiB.",
/// "type": "string",
/// "maxLength": 262144,
/// "minLength": 64,
/// "pattern": "^-----BEGIN VTA SEALED BUNDLE-----[\\s\\S]+-----END VTA SEALED BUNDLE-----\\s*$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseVariant1SealedCredential(::std::string::String);
impl ::std::ops::Deref for ResponseVariant1SealedCredential {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseVariant1SealedCredential> for ::std::string::String {
fn from(value: ResponseVariant1SealedCredential) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseVariant1SealedCredential {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 262144usize {
return Err("longer than 262144 characters".into());
}
if value.chars().count() < 64usize {
return Err("shorter than 64 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> = ::std::sync::LazyLock::new(
|| {
::regress::Regex::new(
"^-----BEGIN VTA SEALED BUNDLE-----[\\s\\S]+-----END VTA SEALED BUNDLE-----\\s*$",
)
.unwrap()
},
);
if PATTERN.find(value).is_none() {
return Err(
"doesn't match pattern \"^-----BEGIN VTA SEALED BUNDLE-----[\\s\\S]+-----END VTA SEALED BUNDLE-----\\s*$\""
.into(),
);
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ResponseVariant1SealedCredential {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ResponseVariant1SealedCredential {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ResponseVariant1SealedCredential {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ResponseVariant1SealedCredential {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct CredentialScope {
actions: ::std::result::Result<
::std::option::Option<Vec<super::ProviderObjectAction>>,
::std::string::String,
>,
object_key: ::std::result::Result<
::std::option::Option<super::CredentialScopeObjectKey>,
::std::string::String,
>,
prefix: ::std::result::Result<
::std::option::Option<super::ProviderObjectPrefix>,
::std::string::String,
>,
scopes: ::std::result::Result<
::std::option::Option<Vec<super::CredentialScopeScopesItem>>,
::std::string::String,
>,
}
impl ::std::default::Default for CredentialScope {
fn default() -> Self {
Self {
actions: Ok(Default::default()),
object_key: Ok(Default::default()),
prefix: Ok(Default::default()),
scopes: Ok(Default::default()),
}
}
}
impl CredentialScope {
pub fn actions<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<Vec<super::ProviderObjectAction>>>,
T::Error: ::std::fmt::Display,
{
self.actions = value
.try_into()
.map_err(|e| format!("error converting supplied value for actions: {e}"));
self
}
pub fn object_key<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::CredentialScopeObjectKey>>,
T::Error: ::std::fmt::Display,
{
self.object_key = value
.try_into()
.map_err(|e| format!("error converting supplied value for object_key: {e}"));
self
}
pub fn prefix<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ProviderObjectPrefix>>,
T::Error: ::std::fmt::Display,
{
self.prefix = value
.try_into()
.map_err(|e| format!("error converting supplied value for prefix: {e}"));
self
}
pub fn scopes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<Vec<super::CredentialScopeScopesItem>>,
>,
T::Error: ::std::fmt::Display,
{
self.scopes = value
.try_into()
.map_err(|e| format!("error converting supplied value for scopes: {e}"));
self
}
}
impl ::std::convert::TryFrom<CredentialScope> for super::CredentialScope {
type Error = super::error::ConversionError;
fn try_from(
value: CredentialScope,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
actions: value.actions?,
object_key: value.object_key?,
prefix: value.prefix?,
scopes: value.scopes?,
})
}
}
impl ::std::convert::From<super::CredentialScope> for CredentialScope {
fn from(value: super::CredentialScope) -> Self {
Self {
actions: Ok(value.actions),
object_key: Ok(value.object_key),
prefix: Ok(value.prefix),
scopes: Ok(value.scopes),
}
}
}
#[derive(Clone, Debug)]
pub struct PresignBatch {
object_key: ::std::result::Result<super::PresignBatchObjectKey, ::std::string::String>,
prefix: ::std::result::Result<super::ProviderObjectPrefix, ::std::string::String>,
requests:
::std::result::Result<::std::vec::Vec<super::PresignRequest>, ::std::string::String>,
upload_id: ::std::result::Result<
::std::option::Option<super::PresignBatchUploadId>,
::std::string::String,
>,
}
impl ::std::default::Default for PresignBatch {
fn default() -> Self {
Self {
object_key: Err("no value supplied for object_key".to_string()),
prefix: Err("no value supplied for prefix".to_string()),
requests: Err("no value supplied for requests".to_string()),
upload_id: Ok(Default::default()),
}
}
}
impl PresignBatch {
pub fn object_key<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PresignBatchObjectKey>,
T::Error: ::std::fmt::Display,
{
self.object_key = value
.try_into()
.map_err(|e| format!("error converting supplied value for object_key: {e}"));
self
}
pub fn prefix<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ProviderObjectPrefix>,
T::Error: ::std::fmt::Display,
{
self.prefix = value
.try_into()
.map_err(|e| format!("error converting supplied value for prefix: {e}"));
self
}
pub fn requests<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::PresignRequest>>,
T::Error: ::std::fmt::Display,
{
self.requests = value
.try_into()
.map_err(|e| format!("error converting supplied value for requests: {e}"));
self
}
pub fn upload_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PresignBatchUploadId>>,
T::Error: ::std::fmt::Display,
{
self.upload_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for upload_id: {e}"));
self
}
}
impl ::std::convert::TryFrom<PresignBatch> for super::PresignBatch {
type Error = super::error::ConversionError;
fn try_from(
value: PresignBatch,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
object_key: value.object_key?,
prefix: value.prefix?,
requests: value.requests?,
upload_id: value.upload_id?,
})
}
}
impl ::std::convert::From<super::PresignBatch> for PresignBatch {
fn from(value: super::PresignBatch) -> Self {
Self {
object_key: Ok(value.object_key),
prefix: Ok(value.prefix),
requests: Ok(value.requests),
upload_id: Ok(value.upload_id),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/external/credentials/issue/0.2";
const IS_PROOF_REQUIRED: bool = true;
const IS_ISSUED_AT_REQUIRED: bool = true;
const MAX_DOCUMENT_BYTES: Option<usize> = Some(65536usize);
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\n \"$defs\": {\n \"AccountContextId\": {\n \"description\": \"The custodian context that owns the account. Act scope in this context decides who may manage the account and who may consume it; the account's keys are derived in this context's key space.\",\n \"maxLength\": 256,\n \"minLength\": 1,\n \"title\": \"AccountContextId\",\n \"type\": \"string\"\n },\n \"AccountId\": {\n \"description\": \"The account's identifier within its context, chosen by whoever creates it. Lowercase letters, digits and hyphens, so that it can be embedded in a certificate subject, a token subject or a provider-side condition without escaping. Unique per context; never reused after deletion while anything that names it (a provider-side trust policy, an audit row) may still exist.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\",\n \"title\": \"AccountId\",\n \"type\": \"string\"\n },\n \"ChecksumSha256\": {\n \"description\": \"A SHA-256 digest in standard base64 (RFC 4648 §4, padded), as S3 carries it in `x-amz-checksum-sha256`.\",\n \"maxLength\": 44,\n \"minLength\": 44,\n \"pattern\": \"^[A-Za-z0-9+/]{43}=$\",\n \"title\": \"ChecksumSha256\",\n \"type\": \"string\"\n },\n \"CredentialScope\": {\n \"additionalProperties\": false,\n \"description\": \"What one issuance may do. For storage models, `prefix` and `actions` (both required, a rule this schema leaves to the custodian because other models use neither); for `s3-static-presign`, also `objectKey`, since a presigned URL is one operation on one object; for `oauth2-private-key-jwt`, `scopes`.\",\n \"properties\": {\n \"actions\": {\n \"items\": {\n \"$ref\": \"#/$defs/ProviderObjectAction\"\n },\n \"maxItems\": 3,\n \"minItems\": 1,\n \"type\": \"array\",\n \"uniqueItems\": true\n },\n \"objectKey\": {\n \"description\": \"`s3-static-presign` only: the object's name within `prefix`. The presigned URL names `prefix` + `objectKey` and nothing else, and `actions` must hold exactly one action.\",\n \"maxLength\": 1024,\n \"minLength\": 1,\n \"pattern\": \"^[A-Za-z0-9._-]+$\",\n \"type\": \"string\"\n },\n \"prefix\": {\n \"$ref\": \"#/$defs/ProviderObjectPrefix\"\n },\n \"scopes\": {\n \"description\": \"`oauth2-private-key-jwt` only: the OAuth scopes requested.\",\n \"items\": {\n \"maxLength\": 256,\n \"pattern\": \"^[!#-\\\\[\\\\]-~]+$\",\n \"type\": \"string\"\n },\n \"maxItems\": 64,\n \"type\": \"array\",\n \"uniqueItems\": true\n }\n },\n \"title\": \"CredentialScope\",\n \"type\": \"object\"\n },\n \"Ext\": {\n \"additionalProperties\": true,\n \"description\": \"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"PresignBatch\": {\n \"additionalProperties\": false,\n \"description\": \"`s3-static-presign` only: up to 128 operations on **one** object, `prefix` + `objectKey`, and at most one multipart upload of it. Each operation becomes one presigned request, sealed together. Consistency rules JSON Schema cannot state, which the custodian enforces: `uploadId` is present exactly when an operation needs it (`upload-part`, `list-parts`, `complete-multipart`, `abort-multipart`) and absent when the batch holds `create-multipart`; no two operations are identical; no two `upload-part` operations name the same `partNumber`.\",\n \"properties\": {\n \"objectKey\": {\n \"description\": \"The object's name within `prefix`. Every request in the batch names `prefix` + `objectKey` and no other object.\",\n \"maxLength\": 1024,\n \"minLength\": 1,\n \"pattern\": \"^[A-Za-z0-9._-]+$\",\n \"type\": \"string\"\n },\n \"prefix\": {\n \"$ref\": \"#/$defs/ProviderObjectPrefix\"\n },\n \"requests\": {\n \"items\": {\n \"$ref\": \"#/$defs/PresignRequest\"\n },\n \"maxItems\": 128,\n \"minItems\": 1,\n \"type\": \"array\"\n },\n \"uploadId\": {\n \"description\": \"The multipart upload the batch's multipart operations act on, as storage returned it from CreateMultipartUpload. Signed into each such request's query, percent-encoded by the SigV4 encoder, never interpolated.\",\n \"maxLength\": 1024,\n \"minLength\": 1,\n \"pattern\": \"^[A-Za-z0-9._~+/=-]+$\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"prefix\",\n \"objectKey\",\n \"requests\"\n ],\n \"title\": \"PresignBatch\",\n \"type\": \"object\"\n },\n \"PresignRequest\": {\n \"description\": \"One operation to presign, discriminated by `operation`. The ceiling action each needs is in `PresignOperation`.\",\n \"oneOf\": [\n {\n \"additionalProperties\": false,\n \"description\": \"PutObject of the whole object, bound to its exact length and SHA-256.\",\n \"properties\": {\n \"checksumSha256\": {\n \"$ref\": \"#/$defs/ChecksumSha256\"\n },\n \"contentLength\": {\n \"description\": \"The object's exact length in bytes, signed into the request as `Content-Length`. At most 5 GiB, S3's single-request ceiling.\",\n \"maximum\": 5368709120,\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"operation\": {\n \"const\": \"put\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\",\n \"contentLength\",\n \"checksumSha256\"\n ],\n \"title\": \"PresignPut\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"GetObject.\",\n \"properties\": {\n \"operation\": {\n \"const\": \"get\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\"\n ],\n \"title\": \"PresignGet\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"HeadObject, with `x-amz-checksum-mode: ENABLED` signed so storage reports the object's checksum.\",\n \"properties\": {\n \"operation\": {\n \"const\": \"head\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\"\n ],\n \"title\": \"PresignHead\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"DeleteObject.\",\n \"properties\": {\n \"operation\": {\n \"const\": \"delete\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\"\n ],\n \"title\": \"PresignDelete\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"CreateMultipartUpload, with `x-amz-checksum-algorithm: SHA256` signed so every part of the upload must carry a SHA-256 checksum.\",\n \"properties\": {\n \"operation\": {\n \"const\": \"create-multipart\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\"\n ],\n \"title\": \"PresignCreateMultipart\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"UploadPart of one part of `uploadId`, bound to its number, its exact length and its SHA-256.\",\n \"properties\": {\n \"checksumSha256\": {\n \"$ref\": \"#/$defs/ChecksumSha256\"\n },\n \"contentLength\": {\n \"description\": \"The part's exact length in bytes, signed into the request as `Content-Length`. At most 5 GiB, S3's part ceiling.\",\n \"maximum\": 5368709120,\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"operation\": {\n \"const\": \"upload-part\",\n \"type\": \"string\"\n },\n \"partNumber\": {\n \"maximum\": 10000,\n \"minimum\": 1,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"operation\",\n \"partNumber\",\n \"contentLength\",\n \"checksumSha256\"\n ],\n \"title\": \"PresignUploadPart\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"ListParts of `uploadId`: each part's number, length, ETag and checksum, up to 1000 per page.\",\n \"properties\": {\n \"operation\": {\n \"const\": \"list-parts\",\n \"type\": \"string\"\n },\n \"partNumberMarker\": {\n \"description\": \"List parts after this number. Absent, from the first.\",\n \"maximum\": 10000,\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"operation\"\n ],\n \"title\": \"PresignListParts\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"CompleteMultipartUpload of `uploadId`, bound to the assembled object's exact length.\",\n \"properties\": {\n \"contentLength\": {\n \"description\": \"The assembled object's exact length in bytes, signed into the request as `x-amz-mp-object-size`, so storage refuses a completion that would assemble any other size. At most 5 TiB, S3's object ceiling.\",\n \"maximum\": 5497558138880,\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"operation\": {\n \"const\": \"complete-multipart\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\",\n \"contentLength\"\n ],\n \"title\": \"PresignCompleteMultipart\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"AbortMultipartUpload of `uploadId`.\",\n \"properties\": {\n \"operation\": {\n \"const\": \"abort-multipart\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\"\n ],\n \"title\": \"PresignAbortMultipart\",\n \"type\": \"object\"\n }\n ],\n \"title\": \"PresignRequest\"\n },\n \"ProviderObjectAction\": {\n \"description\": \"`put`: write an object. `get`: read one. `delete`: remove one. No list, ACL, policy or bucket-level action exists here, so none can be granted.\",\n \"enum\": [\n \"put\",\n \"get\",\n \"delete\"\n ],\n \"title\": \"ProviderObjectAction\",\n \"type\": \"string\"\n },\n \"ProviderObjectPrefix\": {\n \"description\": \"An object-key prefix within the account's bucket: one or more segments of lowercase letters, digits, `.`, `_` and `-`, each beginning with a letter or digit and ending with `/`. No quote, backslash, wildcard, whitespace, `..` segment or empty segment can appear. That is deliberate: the custodian places this value inside a provider policy — an IAM session policy (JSON), a GCS Credential Access Boundary condition (CEL) — and a value able to carry a metacharacter can break out of the string it is placed in and widen the policy. That is a known class of defect (CVE-2026-42811, a CEL injection in downscoped GCS credentials). Even with this pattern, a custodian MUST build provider policies with the provider language's own encoder, never by string interpolation.\",\n \"maxLength\": 512,\n \"minLength\": 2,\n \"pattern\": \"^([a-z0-9][a-z0-9._-]{0,127}/){1,16}$\",\n \"title\": \"ProviderObjectPrefix\",\n \"type\": \"string\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"oneOf\": [\n {\n \"not\": {\n \"required\": [\n \"presign\"\n ]\n },\n \"required\": [\n \"scope\"\n ]\n },\n {\n \"not\": {\n \"required\": [\n \"scope\"\n ]\n },\n \"required\": [\n \"presign\"\n ]\n }\n ],\n \"properties\": {\n \"expiresAt\": {\n \"description\": \"The provider's expiry for the credential, in the clear; for `presign`, the earliest expiry in the batch.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"presign\": {\n \"$ref\": \"#/$defs/PresignBatch\",\n \"description\": \"The batch actually presigned, which equals the requested one.\"\n },\n \"scope\": {\n \"$ref\": \"#/$defs/CredentialScope\",\n \"description\": \"The scope actually granted, which equals the requested one.\"\n },\n \"sealedCredential\": {\n \"description\": \"A `SealedTransferBundle` (external/_shared/0.1), sealed to the caller's key-agreement key, whose cleartext is an `ExternalCredentialPayload` for `scope` or a `PresignedRequestSet` for `presign`. Bounded at 256 KiB rather than the shared 64 KiB because a batch of 128 presigned requests does not fit 64 KiB.\",\n \"maxLength\": 262144,\n \"minLength\": 64,\n \"pattern\": \"^-----BEGIN VTA SEALED BUNDLE-----[\\\\s\\\\S]+-----END VTA SEALED BUNDLE-----\\\\s*$\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"sealedCredential\",\n \"expiresAt\"\n ],\n \"title\": \"External Credentials — Issue — response payload\",\n \"type\": \"object\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/external/credentials/issue/0.2\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"description\": \"Obtain a short-lived, downscoped provider credential from an external account, sealed to the caller: session or token credentials under `scope`, or a batch of presigned requests on one object under `presign`. The outer document members are owned by the framework — SPEC §6.3.\",\n \"oneOf\": [\n {\n \"not\": {\n \"required\": [\n \"presign\"\n ]\n },\n \"required\": [\n \"scope\"\n ]\n },\n {\n \"not\": {\n \"required\": [\n \"scope\"\n ]\n },\n \"required\": [\n \"presign\"\n ]\n }\n ],\n \"properties\": {\n \"account\": {\n \"$ref\": \"#/$defs/AccountId\"\n },\n \"context\": {\n \"$ref\": \"#/$defs/AccountContextId\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"presign\": {\n \"$ref\": \"#/$defs/PresignBatch\"\n },\n \"scope\": {\n \"$ref\": \"#/$defs/CredentialScope\",\n \"description\": \"For every brokered model but `s3-static-presign`: the prefix and actions, or the OAuth scopes, the session or token is downscoped to. `objectKey` is not used in this version.\"\n },\n \"ttlSeconds\": {\n \"description\": \"Requested lifetime; never more than the binding's `maxTtlSeconds`. For `presign`, the lifetime of every URL in the batch.\",\n \"maximum\": 3600,\n \"minimum\": 60,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"context\",\n \"account\",\n \"ttlSeconds\"\n ],\n \"title\": \"External Credentials — Issue — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/external/credentials/issue/0.2#response";
const IS_PROOF_REQUIRED: bool = true;
const IS_ISSUED_AT_REQUIRED: bool = true;
const MAX_DOCUMENT_BYTES: Option<usize> = Some(294912usize);
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\n \"$defs\": {\n \"AccountContextId\": {\n \"description\": \"The custodian context that owns the account. Act scope in this context decides who may manage the account and who may consume it; the account's keys are derived in this context's key space.\",\n \"maxLength\": 256,\n \"minLength\": 1,\n \"title\": \"AccountContextId\",\n \"type\": \"string\"\n },\n \"AccountId\": {\n \"description\": \"The account's identifier within its context, chosen by whoever creates it. Lowercase letters, digits and hyphens, so that it can be embedded in a certificate subject, a token subject or a provider-side condition without escaping. Unique per context; never reused after deletion while anything that names it (a provider-side trust policy, an audit row) may still exist.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"pattern\": \"^[a-z0-9][a-z0-9-]*$\",\n \"title\": \"AccountId\",\n \"type\": \"string\"\n },\n \"ChecksumSha256\": {\n \"description\": \"A SHA-256 digest in standard base64 (RFC 4648 §4, padded), as S3 carries it in `x-amz-checksum-sha256`.\",\n \"maxLength\": 44,\n \"minLength\": 44,\n \"pattern\": \"^[A-Za-z0-9+/]{43}=$\",\n \"title\": \"ChecksumSha256\",\n \"type\": \"string\"\n },\n \"CredentialScope\": {\n \"additionalProperties\": false,\n \"description\": \"What one issuance may do. For storage models, `prefix` and `actions` (both required, a rule this schema leaves to the custodian because other models use neither); for `s3-static-presign`, also `objectKey`, since a presigned URL is one operation on one object; for `oauth2-private-key-jwt`, `scopes`.\",\n \"properties\": {\n \"actions\": {\n \"items\": {\n \"$ref\": \"#/$defs/ProviderObjectAction\"\n },\n \"maxItems\": 3,\n \"minItems\": 1,\n \"type\": \"array\",\n \"uniqueItems\": true\n },\n \"objectKey\": {\n \"description\": \"`s3-static-presign` only: the object's name within `prefix`. The presigned URL names `prefix` + `objectKey` and nothing else, and `actions` must hold exactly one action.\",\n \"maxLength\": 1024,\n \"minLength\": 1,\n \"pattern\": \"^[A-Za-z0-9._-]+$\",\n \"type\": \"string\"\n },\n \"prefix\": {\n \"$ref\": \"#/$defs/ProviderObjectPrefix\"\n },\n \"scopes\": {\n \"description\": \"`oauth2-private-key-jwt` only: the OAuth scopes requested.\",\n \"items\": {\n \"maxLength\": 256,\n \"pattern\": \"^[!#-\\\\[\\\\]-~]+$\",\n \"type\": \"string\"\n },\n \"maxItems\": 64,\n \"type\": \"array\",\n \"uniqueItems\": true\n }\n },\n \"title\": \"CredentialScope\",\n \"type\": \"object\"\n },\n \"Ext\": {\n \"additionalProperties\": true,\n \"description\": \"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"PresignBatch\": {\n \"additionalProperties\": false,\n \"description\": \"`s3-static-presign` only: up to 128 operations on **one** object, `prefix` + `objectKey`, and at most one multipart upload of it. Each operation becomes one presigned request, sealed together. Consistency rules JSON Schema cannot state, which the custodian enforces: `uploadId` is present exactly when an operation needs it (`upload-part`, `list-parts`, `complete-multipart`, `abort-multipart`) and absent when the batch holds `create-multipart`; no two operations are identical; no two `upload-part` operations name the same `partNumber`.\",\n \"properties\": {\n \"objectKey\": {\n \"description\": \"The object's name within `prefix`. Every request in the batch names `prefix` + `objectKey` and no other object.\",\n \"maxLength\": 1024,\n \"minLength\": 1,\n \"pattern\": \"^[A-Za-z0-9._-]+$\",\n \"type\": \"string\"\n },\n \"prefix\": {\n \"$ref\": \"#/$defs/ProviderObjectPrefix\"\n },\n \"requests\": {\n \"items\": {\n \"$ref\": \"#/$defs/PresignRequest\"\n },\n \"maxItems\": 128,\n \"minItems\": 1,\n \"type\": \"array\"\n },\n \"uploadId\": {\n \"description\": \"The multipart upload the batch's multipart operations act on, as storage returned it from CreateMultipartUpload. Signed into each such request's query, percent-encoded by the SigV4 encoder, never interpolated.\",\n \"maxLength\": 1024,\n \"minLength\": 1,\n \"pattern\": \"^[A-Za-z0-9._~+/=-]+$\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"prefix\",\n \"objectKey\",\n \"requests\"\n ],\n \"title\": \"PresignBatch\",\n \"type\": \"object\"\n },\n \"PresignRequest\": {\n \"description\": \"One operation to presign, discriminated by `operation`. The ceiling action each needs is in `PresignOperation`.\",\n \"oneOf\": [\n {\n \"additionalProperties\": false,\n \"description\": \"PutObject of the whole object, bound to its exact length and SHA-256.\",\n \"properties\": {\n \"checksumSha256\": {\n \"$ref\": \"#/$defs/ChecksumSha256\"\n },\n \"contentLength\": {\n \"description\": \"The object's exact length in bytes, signed into the request as `Content-Length`. At most 5 GiB, S3's single-request ceiling.\",\n \"maximum\": 5368709120,\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"operation\": {\n \"const\": \"put\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\",\n \"contentLength\",\n \"checksumSha256\"\n ],\n \"title\": \"PresignPut\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"GetObject.\",\n \"properties\": {\n \"operation\": {\n \"const\": \"get\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\"\n ],\n \"title\": \"PresignGet\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"HeadObject, with `x-amz-checksum-mode: ENABLED` signed so storage reports the object's checksum.\",\n \"properties\": {\n \"operation\": {\n \"const\": \"head\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\"\n ],\n \"title\": \"PresignHead\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"DeleteObject.\",\n \"properties\": {\n \"operation\": {\n \"const\": \"delete\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\"\n ],\n \"title\": \"PresignDelete\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"CreateMultipartUpload, with `x-amz-checksum-algorithm: SHA256` signed so every part of the upload must carry a SHA-256 checksum.\",\n \"properties\": {\n \"operation\": {\n \"const\": \"create-multipart\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\"\n ],\n \"title\": \"PresignCreateMultipart\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"UploadPart of one part of `uploadId`, bound to its number, its exact length and its SHA-256.\",\n \"properties\": {\n \"checksumSha256\": {\n \"$ref\": \"#/$defs/ChecksumSha256\"\n },\n \"contentLength\": {\n \"description\": \"The part's exact length in bytes, signed into the request as `Content-Length`. At most 5 GiB, S3's part ceiling.\",\n \"maximum\": 5368709120,\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"operation\": {\n \"const\": \"upload-part\",\n \"type\": \"string\"\n },\n \"partNumber\": {\n \"maximum\": 10000,\n \"minimum\": 1,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"operation\",\n \"partNumber\",\n \"contentLength\",\n \"checksumSha256\"\n ],\n \"title\": \"PresignUploadPart\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"ListParts of `uploadId`: each part's number, length, ETag and checksum, up to 1000 per page.\",\n \"properties\": {\n \"operation\": {\n \"const\": \"list-parts\",\n \"type\": \"string\"\n },\n \"partNumberMarker\": {\n \"description\": \"List parts after this number. Absent, from the first.\",\n \"maximum\": 10000,\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"operation\"\n ],\n \"title\": \"PresignListParts\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"CompleteMultipartUpload of `uploadId`, bound to the assembled object's exact length.\",\n \"properties\": {\n \"contentLength\": {\n \"description\": \"The assembled object's exact length in bytes, signed into the request as `x-amz-mp-object-size`, so storage refuses a completion that would assemble any other size. At most 5 TiB, S3's object ceiling.\",\n \"maximum\": 5497558138880,\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"operation\": {\n \"const\": \"complete-multipart\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\",\n \"contentLength\"\n ],\n \"title\": \"PresignCompleteMultipart\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"description\": \"AbortMultipartUpload of `uploadId`.\",\n \"properties\": {\n \"operation\": {\n \"const\": \"abort-multipart\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\"\n ],\n \"title\": \"PresignAbortMultipart\",\n \"type\": \"object\"\n }\n ],\n \"title\": \"PresignRequest\"\n },\n \"ProviderObjectAction\": {\n \"description\": \"`put`: write an object. `get`: read one. `delete`: remove one. No list, ACL, policy or bucket-level action exists here, so none can be granted.\",\n \"enum\": [\n \"put\",\n \"get\",\n \"delete\"\n ],\n \"title\": \"ProviderObjectAction\",\n \"type\": \"string\"\n },\n \"ProviderObjectPrefix\": {\n \"description\": \"An object-key prefix within the account's bucket: one or more segments of lowercase letters, digits, `.`, `_` and `-`, each beginning with a letter or digit and ending with `/`. No quote, backslash, wildcard, whitespace, `..` segment or empty segment can appear. That is deliberate: the custodian places this value inside a provider policy — an IAM session policy (JSON), a GCS Credential Access Boundary condition (CEL) — and a value able to carry a metacharacter can break out of the string it is placed in and widen the policy. That is a known class of defect (CVE-2026-42811, a CEL injection in downscoped GCS credentials). Even with this pattern, a custodian MUST build provider policies with the provider language's own encoder, never by string interpolation.\",\n \"maxLength\": 512,\n \"minLength\": 2,\n \"pattern\": \"^([a-z0-9][a-z0-9._-]{0,127}/){1,16}$\",\n \"title\": \"ProviderObjectPrefix\",\n \"type\": \"string\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"oneOf\": [\n {\n \"not\": {\n \"required\": [\n \"presign\"\n ]\n },\n \"required\": [\n \"scope\"\n ]\n },\n {\n \"not\": {\n \"required\": [\n \"scope\"\n ]\n },\n \"required\": [\n \"presign\"\n ]\n }\n ],\n \"properties\": {\n \"expiresAt\": {\n \"description\": \"The provider's expiry for the credential, in the clear; for `presign`, the earliest expiry in the batch.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"presign\": {\n \"$ref\": \"#/$defs/PresignBatch\",\n \"description\": \"The batch actually presigned, which equals the requested one.\"\n },\n \"scope\": {\n \"$ref\": \"#/$defs/CredentialScope\",\n \"description\": \"The scope actually granted, which equals the requested one.\"\n },\n \"sealedCredential\": {\n \"description\": \"A `SealedTransferBundle` (external/_shared/0.1), sealed to the caller's key-agreement key, whose cleartext is an `ExternalCredentialPayload` for `scope` or a `PresignedRequestSet` for `presign`. Bounded at 256 KiB rather than the shared 64 KiB because a batch of 128 presigned requests does not fit 64 KiB.\",\n \"maxLength\": 262144,\n \"minLength\": 64,\n \"pattern\": \"^-----BEGIN VTA SEALED BUNDLE-----[\\\\s\\\\S]+-----END VTA SEALED BUNDLE-----\\\\s*$\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"sealedCredential\",\n \"expiresAt\"\n ],\n \"title\": \"External Credentials — Issue — response payload\",\n \"type\": \"object\"\n }\n },\n \"$ref\": \"#/$defs/Response\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\"\n}\n",
);
}
impl crate::RequestPayload for Payload {
type Response = Response;
}
/// The extended error codes this specification declares (SPEC §7.3 item 9,
/// §8.5), in declaration order. Empty when it declares none.
pub const ERROR_CODES: &[crate::DeclaredErrorCode] = &[
error_codes::NOT_FOUND,
error_codes::NOT_ACTIVE,
error_codes::NOT_BOUND,
error_codes::REQUEST_SHAPE_MISMATCH,
error_codes::INVALID_BATCH,
error_codes::SCOPE_OUTSIDE_CEILING,
error_codes::TTL_TOO_LONG,
error_codes::RATE_LIMITED,
error_codes::PROVIDER_SETUP_REQUIRED,
error_codes::PROVIDER_REFUSED,
error_codes::PROVIDER_UNAVAILABLE,
error_codes::NOT_BROKERED,
error_codes::NO_KEY_AGREEMENT,
];
/// One constant per extended error code this specification declares
/// (SPEC §7.3 item 9), named for its local part.
///
/// Emit these rather than a string literal: the code is read from the
/// specification, so it cannot name a code the specification never
/// declared.
pub mod error_codes {
/// `external:notFound`
///
/// No account with this id exists in the named context that the caller may see. See the family conventions §2.
///
/// Declared `retryable: false`.
pub const NOT_FOUND: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external:notFound",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `external:notActive`
///
/// The account is `suspended` or `archived` and cannot be used.
///
/// Declared `retryable: false`.
pub const NOT_ACTIVE: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external:notActive",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `external:notBound`
///
/// The caller is not the consumer of any binding on this account.
///
/// Declared `retryable: false`.
pub const NOT_BOUND: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external:notBound",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `external/credentials/issue:requestShapeMismatch`
///
/// The request uses the shape the account's model does not take: `presign` for a model that issues sessions or tokens, which can bind neither an operation, a length nor a checksum into what it issues; or `scope` for `s3-static-presign`, which in this version issues only presigned requests. `details.expected` names the shape the model takes.
///
/// Declared `retryable: false`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const REQUEST_SHAPE_MISMATCH: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external/credentials/issue:requestShapeMismatch",
retryable: false,
details_schema: ::core::option::Option::Some(
"{\"additionalProperties\":false,\"properties\":{\"expected\":{\"enum\":[\"scope\",\"presign\"],\"type\":\"string\"}},\"required\":[\"expected\"],\"type\":\"object\"}",
),
};
/// `external/credentials/issue:invalidBatch`
///
/// The presign batch breaks a rule its schema cannot state: an `uploadId` missing for an operation that needs one, present beside `create-multipart`, two identical operations, or two `upload-part` operations naming the same part.
///
/// Declared `retryable: false`.
pub const INVALID_BATCH: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external/credentials/issue:invalidBatch",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `external/credentials/issue:scopeOutsideCeiling`
///
/// The requested scope is not inside the binding's ceiling: a prefix no ceiling prefix begins, an action the ceiling lacks, or — for `presign` — an operation whose required ceiling action the ceiling lacks.
///
/// Declared `retryable: false`.
pub const SCOPE_OUTSIDE_CEILING: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external/credentials/issue:scopeOutsideCeiling",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `external/credentials/issue:ttlTooLong`
///
/// `ttlSeconds` exceeds the binding's `maxTtlSeconds`. `details.maxTtlSeconds` states it.
///
/// Declared `retryable: false`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const TTL_TOO_LONG: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external/credentials/issue:ttlTooLong",
retryable: false,
details_schema: ::core::option::Option::Some(
"{\"additionalProperties\":false,\"properties\":{\"maxTtlSeconds\":{\"minimum\":60,\"type\":\"integer\"}},\"required\":[\"maxTtlSeconds\"],\"type\":\"object\"}",
),
};
/// `external:rateLimited`
///
/// The binding's rate is exhausted. `details.retryAfterSeconds` says when to try again.
///
/// Declared `retryable: true`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const RATE_LIMITED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external:rateLimited",
retryable: true,
details_schema: ::core::option::Option::Some(
"{\"additionalProperties\":false,\"properties\":{\"retryAfterSeconds\":{\"minimum\":1,\"type\":\"integer\"}},\"required\":[\"retryAfterSeconds\"],\"type\":\"object\"}",
),
};
/// `external:providerSetupRequired`
///
/// The account cannot be used until its provider-side setup is redone: after a restore that could not carry its key or secret, or while a rotation awaits confirmation.
///
/// Declared `retryable: false`.
pub const PROVIDER_SETUP_REQUIRED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external:providerSetupRequired",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `external:providerRefused`
///
/// The provider refused the custodian's request. `details.providerError` carries the provider's words, verbatim, truncated, with any credential removed.
///
/// Declared `retryable: false`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const PROVIDER_REFUSED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external:providerRefused",
retryable: false,
details_schema: ::core::option::Option::Some(
"{\"additionalProperties\":false,\"properties\":{\"providerError\":{\"maxLength\":2048,\"type\":\"string\"},\"providerRequestId\":{\"maxLength\":256,\"type\":\"string\"}},\"required\":[\"providerError\"],\"type\":\"object\"}",
),
};
/// `external:providerUnavailable`
///
/// The provider could not be reached or did not answer in time.
///
/// Declared `retryable: true`.
pub const PROVIDER_UNAVAILABLE: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external:providerUnavailable",
retryable: true,
details_schema: ::core::option::Option::None,
};
/// `external/credentials/issue:notBrokered`
///
/// The account is `sui-signer`, which issues no credentials; use external/sign.
///
/// Declared `retryable: false`.
pub const NOT_BROKERED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external/credentials/issue:notBrokered",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `external/credentials/issue:noKeyAgreement`
///
/// The caller's DID offers no X25519 key-agreement key to seal the credential to: it is not a `did:key`, and its resolved DID document has no X25519 `keyAgreement` verification method.
///
/// Declared `retryable: false`.
pub const NO_KEY_AGREEMENT: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external/credentials/issue:noKeyAgreement",
retryable: false,
details_schema: ::core::option::Option::None,
};
}