//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `external/accounts/probe`. Version: `0.1`.
#[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())
})
}
}
///`AccountProbeReport`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "AccountProbeReport",
/// "type": "object",
/// "required": [
/// "at",
/// "complete",
/// "ok",
/// "steps"
/// ],
/// "properties": {
/// "at": {
/// "type": "string",
/// "format": "date-time"
/// },
/// "complete": {
/// "description": "True only when the canary steps (`put`, `get`, `delete`, or the model's equivalent) ran, so the account was exercised end to end. A probe that stopped after `exchange` because nothing named a canary prefix is `complete: false` even when `ok` is true, and does not clear `providerSetupRequired`.",
/// "type": "boolean"
/// },
/// "ok": {
/// "description": "True when every step that ran succeeded.",
/// "type": "boolean"
/// },
/// "steps": {
/// "description": "In order; the first failing step ends the probe.",
/// "type": "array",
/// "items": {
/// "type": "object",
/// "required": [
/// "ok",
/// "step"
/// ],
/// "properties": {
/// "durationMs": {
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "ok": {
/// "type": "boolean"
/// },
/// "providerError": {
/// "description": "The provider's error, verbatim and truncated, so an administrator sees the cloud's own words. Untrusted text. A custodian MUST remove any credential, signature or token from it first.",
/// "type": "string",
/// "maxLength": 2048
/// },
/// "providerRequestId": {
/// "type": "string",
/// "maxLength": 256,
/// "pattern": "^[!-~]+$"
/// },
/// "step": {
/// "$ref": "#/definitions/AccountProbeStep"
/// }
/// },
/// "additionalProperties": false
/// },
/// "maxItems": 8
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct AccountProbeReport {
pub at: ::chrono::DateTime<::chrono::offset::Utc>,
///True only when the canary steps (`put`, `get`, `delete`, or the model's equivalent) ran, so the account was exercised end to end. A probe that stopped after `exchange` because nothing named a canary prefix is `complete: false` even when `ok` is true, and does not clear `providerSetupRequired`.
pub complete: bool,
///True when every step that ran succeeded.
pub ok: bool,
///In order; the first failing step ends the probe.
pub steps: ::std::vec::Vec<AccountProbeReportStepsItem>,
}
impl AccountProbeReport {
pub fn builder() -> builder::AccountProbeReport {
Default::default()
}
}
///`AccountProbeReportStepsItem`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "ok",
/// "step"
/// ],
/// "properties": {
/// "durationMs": {
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "ok": {
/// "type": "boolean"
/// },
/// "providerError": {
/// "description": "The provider's error, verbatim and truncated, so an administrator sees the cloud's own words. Untrusted text. A custodian MUST remove any credential, signature or token from it first.",
/// "type": "string",
/// "maxLength": 2048
/// },
/// "providerRequestId": {
/// "type": "string",
/// "maxLength": 256,
/// "pattern": "^[!-~]+$"
/// },
/// "step": {
/// "$ref": "#/definitions/AccountProbeStep"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct AccountProbeReportStepsItem {
#[serde(
rename = "durationMs",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub duration_ms: ::std::option::Option<u64>,
pub ok: bool,
///The provider's error, verbatim and truncated, so an administrator sees the cloud's own words. Untrusted text. A custodian MUST remove any credential, signature or token from it first.
#[serde(
rename = "providerError",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub provider_error: ::std::option::Option<AccountProbeReportStepsItemProviderError>,
#[serde(
rename = "providerRequestId",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub provider_request_id: ::std::option::Option<AccountProbeReportStepsItemProviderRequestId>,
pub step: AccountProbeStep,
}
impl AccountProbeReportStepsItem {
pub fn builder() -> builder::AccountProbeReportStepsItem {
Default::default()
}
}
///The provider's error, verbatim and truncated, so an administrator sees the cloud's own words. Untrusted text. A custodian MUST remove any credential, signature or token from it first.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The provider's error, verbatim and truncated, so an administrator sees the cloud's own words. Untrusted text. A custodian MUST remove any credential, signature or token from it first.",
/// "type": "string",
/// "maxLength": 2048
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct AccountProbeReportStepsItemProviderError(::std::string::String);
impl ::std::ops::Deref for AccountProbeReportStepsItemProviderError {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<AccountProbeReportStepsItemProviderError> for ::std::string::String {
fn from(value: AccountProbeReportStepsItemProviderError) -> Self {
value.0
}
}
impl ::std::str::FromStr for AccountProbeReportStepsItemProviderError {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 2048usize {
return Err("longer than 2048 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for AccountProbeReportStepsItemProviderError {
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 AccountProbeReportStepsItemProviderError {
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 AccountProbeReportStepsItemProviderError {
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 AccountProbeReportStepsItemProviderError {
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())
})
}
}
///`AccountProbeReportStepsItemProviderRequestId`
///
/// <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 AccountProbeReportStepsItemProviderRequestId(::std::string::String);
impl ::std::ops::Deref for AccountProbeReportStepsItemProviderRequestId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<AccountProbeReportStepsItemProviderRequestId> for ::std::string::String {
fn from(value: AccountProbeReportStepsItemProviderRequestId) -> Self {
value.0
}
}
impl ::std::str::FromStr for AccountProbeReportStepsItemProviderRequestId {
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 AccountProbeReportStepsItemProviderRequestId {
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 AccountProbeReportStepsItemProviderRequestId
{
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 AccountProbeReportStepsItemProviderRequestId
{
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 AccountProbeReportStepsItemProviderRequestId {
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())
})
}
}
///`sign`: the custodian signed its assertion, session request or test transaction. `exchange`: the provider issued a credential for it. `put`, `get`, `delete`: one canary object at the narrowest scope of the account's bindings. `decode`: for `sui-signer`, a built test transaction passed the allow-list (it is never submitted).
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "AccountProbeStep",
/// "description": "`sign`: the custodian signed its assertion, session request or test transaction. `exchange`: the provider issued a credential for it. `put`, `get`, `delete`: one canary object at the narrowest scope of the account's bindings. `decode`: for `sui-signer`, a built test transaction passed the allow-list (it is never submitted).",
/// "type": "string",
/// "enum": [
/// "sign",
/// "exchange",
/// "put",
/// "get",
/// "delete",
/// "decode"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum AccountProbeStep {
#[serde(rename = "sign")]
Sign,
#[serde(rename = "exchange")]
Exchange,
#[serde(rename = "put")]
Put,
#[serde(rename = "get")]
Get,
#[serde(rename = "delete")]
Delete,
#[serde(rename = "decode")]
Decode,
}
impl ::std::fmt::Display for AccountProbeStep {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Sign => f.write_str("sign"),
Self::Exchange => f.write_str("exchange"),
Self::Put => f.write_str("put"),
Self::Get => f.write_str("get"),
Self::Delete => f.write_str("delete"),
Self::Decode => f.write_str("decode"),
}
}
}
impl ::std::str::FromStr for AccountProbeStep {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"sign" => Ok(Self::Sign),
"exchange" => Ok(Self::Exchange),
"put" => Ok(Self::Put),
"get" => Ok(Self::Get),
"delete" => Ok(Self::Delete),
"decode" => Ok(Self::Decode),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for AccountProbeStep {
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 AccountProbeStep {
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 AccountProbeStep {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///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())
})
}
}
///Prove an external account works end to end. The outer document members are owned by the framework — SPEC §6.3.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/external/accounts/probe/0.1",
/// "title": "Payload",
/// "description": "Prove an external account works end to end. The outer document members are owned by the framework — SPEC §6.3.",
/// "type": "object",
/// "required": [
/// "context",
/// "id"
/// ],
/// "properties": {
/// "context": {
/// "$ref": "#/definitions/AccountContextId"
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "id": {
/// "$ref": "#/definitions/AccountId"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
pub context: AccountContextId,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
pub id: AccountId,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///`Response`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "type": "object",
/// "required": [
/// "report"
/// ],
/// "properties": {
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "report": {
/// "$ref": "#/definitions/AccountProbeReport"
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "response"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
pub report: AccountProbeReport,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct AccountProbeReport {
at: ::std::result::Result<::chrono::DateTime<::chrono::offset::Utc>, ::std::string::String>,
complete: ::std::result::Result<bool, ::std::string::String>,
ok: ::std::result::Result<bool, ::std::string::String>,
steps: ::std::result::Result<
::std::vec::Vec<super::AccountProbeReportStepsItem>,
::std::string::String,
>,
}
impl ::std::default::Default for AccountProbeReport {
fn default() -> Self {
Self {
at: Err("no value supplied for at".to_string()),
complete: Err("no value supplied for complete".to_string()),
ok: Err("no value supplied for ok".to_string()),
steps: Err("no value supplied for steps".to_string()),
}
}
}
impl AccountProbeReport {
pub fn at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
T::Error: ::std::fmt::Display,
{
self.at = value
.try_into()
.map_err(|e| format!("error converting supplied value for at: {e}"));
self
}
pub fn complete<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.complete = value
.try_into()
.map_err(|e| format!("error converting supplied value for complete: {e}"));
self
}
pub fn ok<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.ok = value
.try_into()
.map_err(|e| format!("error converting supplied value for ok: {e}"));
self
}
pub fn steps<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::AccountProbeReportStepsItem>>,
T::Error: ::std::fmt::Display,
{
self.steps = value
.try_into()
.map_err(|e| format!("error converting supplied value for steps: {e}"));
self
}
}
impl ::std::convert::TryFrom<AccountProbeReport> for super::AccountProbeReport {
type Error = super::error::ConversionError;
fn try_from(
value: AccountProbeReport,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
at: value.at?,
complete: value.complete?,
ok: value.ok?,
steps: value.steps?,
})
}
}
impl ::std::convert::From<super::AccountProbeReport> for AccountProbeReport {
fn from(value: super::AccountProbeReport) -> Self {
Self {
at: Ok(value.at),
complete: Ok(value.complete),
ok: Ok(value.ok),
steps: Ok(value.steps),
}
}
}
#[derive(Clone, Debug)]
pub struct AccountProbeReportStepsItem {
duration_ms: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
ok: ::std::result::Result<bool, ::std::string::String>,
provider_error: ::std::result::Result<
::std::option::Option<super::AccountProbeReportStepsItemProviderError>,
::std::string::String,
>,
provider_request_id: ::std::result::Result<
::std::option::Option<super::AccountProbeReportStepsItemProviderRequestId>,
::std::string::String,
>,
step: ::std::result::Result<super::AccountProbeStep, ::std::string::String>,
}
impl ::std::default::Default for AccountProbeReportStepsItem {
fn default() -> Self {
Self {
duration_ms: Ok(Default::default()),
ok: Err("no value supplied for ok".to_string()),
provider_error: Ok(Default::default()),
provider_request_id: Ok(Default::default()),
step: Err("no value supplied for step".to_string()),
}
}
}
impl AccountProbeReportStepsItem {
pub fn duration_ms<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.duration_ms = value
.try_into()
.map_err(|e| format!("error converting supplied value for duration_ms: {e}"));
self
}
pub fn ok<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.ok = value
.try_into()
.map_err(|e| format!("error converting supplied value for ok: {e}"));
self
}
pub fn provider_error<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<super::AccountProbeReportStepsItemProviderError>,
>,
T::Error: ::std::fmt::Display,
{
self.provider_error = value
.try_into()
.map_err(|e| format!("error converting supplied value for provider_error: {e}"));
self
}
pub fn provider_request_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<super::AccountProbeReportStepsItemProviderRequestId>,
>,
T::Error: ::std::fmt::Display,
{
self.provider_request_id = value.try_into().map_err(|e| {
format!("error converting supplied value for provider_request_id: {e}")
});
self
}
pub fn step<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::AccountProbeStep>,
T::Error: ::std::fmt::Display,
{
self.step = value
.try_into()
.map_err(|e| format!("error converting supplied value for step: {e}"));
self
}
}
impl ::std::convert::TryFrom<AccountProbeReportStepsItem> for super::AccountProbeReportStepsItem {
type Error = super::error::ConversionError;
fn try_from(
value: AccountProbeReportStepsItem,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
duration_ms: value.duration_ms?,
ok: value.ok?,
provider_error: value.provider_error?,
provider_request_id: value.provider_request_id?,
step: value.step?,
})
}
}
impl ::std::convert::From<super::AccountProbeReportStepsItem> for AccountProbeReportStepsItem {
fn from(value: super::AccountProbeReportStepsItem) -> Self {
Self {
duration_ms: Ok(value.duration_ms),
ok: Ok(value.ok),
provider_error: Ok(value.provider_error),
provider_request_id: Ok(value.provider_request_id),
step: Ok(value.step),
}
}
}
#[derive(Clone, Debug)]
pub struct Payload {
context: ::std::result::Result<super::AccountContextId, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
id: ::std::result::Result<super::AccountId, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
context: Err("no value supplied for context".to_string()),
ext: Ok(Default::default()),
id: Err("no value supplied for id".to_string()),
}
}
}
impl Payload {
pub fn context<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::AccountContextId>,
T::Error: ::std::fmt::Display,
{
self.context = value
.try_into()
.map_err(|e| format!("error converting supplied value for context: {e}"));
self
}
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::AccountId>,
T::Error: ::std::fmt::Display,
{
self.id = value
.try_into()
.map_err(|e| format!("error converting supplied value for id: {e}"));
self
}
}
impl ::std::convert::TryFrom<Payload> for super::Payload {
type Error = super::error::ConversionError;
fn try_from(value: Payload) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
context: value.context?,
ext: value.ext?,
id: value.id?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
context: Ok(value.context),
ext: Ok(value.ext),
id: Ok(value.id),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
report: ::std::result::Result<super::AccountProbeReport, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
report: Err("no value supplied for report".to_string()),
}
}
}
impl Response {
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn report<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::AccountProbeReport>,
T::Error: ::std::fmt::Display,
{
self.report = value
.try_into()
.map_err(|e| format!("error converting supplied value for report: {e}"));
self
}
}
impl ::std::convert::TryFrom<Response> for super::Response {
type Error = super::error::ConversionError;
fn try_from(value: Response) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
ext: value.ext?,
report: value.report?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
ext: Ok(value.ext),
report: Ok(value.report),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/external/accounts/probe/0.1";
const IS_PROOF_REQUIRED: bool = true;
const IS_ISSUED_AT_REQUIRED: bool = true;
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 \"AccountProbeReport\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"at\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"complete\": {\n \"description\": \"True only when the canary steps (`put`, `get`, `delete`, or the model's equivalent) ran, so the account was exercised end to end. A probe that stopped after `exchange` because nothing named a canary prefix is `complete: false` even when `ok` is true, and does not clear `providerSetupRequired`.\",\n \"type\": \"boolean\"\n },\n \"ok\": {\n \"description\": \"True when every step that ran succeeded.\",\n \"type\": \"boolean\"\n },\n \"steps\": {\n \"description\": \"In order; the first failing step ends the probe.\",\n \"items\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"durationMs\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"ok\": {\n \"type\": \"boolean\"\n },\n \"providerError\": {\n \"description\": \"The provider's error, verbatim and truncated, so an administrator sees the cloud's own words. Untrusted text. A custodian MUST remove any credential, signature or token from it first.\",\n \"maxLength\": 2048,\n \"type\": \"string\"\n },\n \"providerRequestId\": {\n \"maxLength\": 256,\n \"pattern\": \"^[!-~]+$\",\n \"type\": \"string\"\n },\n \"step\": {\n \"$ref\": \"#/$defs/AccountProbeStep\"\n }\n },\n \"required\": [\n \"step\",\n \"ok\"\n ],\n \"type\": \"object\"\n },\n \"maxItems\": 8,\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"at\",\n \"ok\",\n \"complete\",\n \"steps\"\n ],\n \"title\": \"AccountProbeReport\",\n \"type\": \"object\"\n },\n \"AccountProbeStep\": {\n \"description\": \"`sign`: the custodian signed its assertion, session request or test transaction. `exchange`: the provider issued a credential for it. `put`, `get`, `delete`: one canary object at the narrowest scope of the account's bindings. `decode`: for `sui-signer`, a built test transaction passed the allow-list (it is never submitted).\",\n \"enum\": [\n \"sign\",\n \"exchange\",\n \"put\",\n \"get\",\n \"delete\",\n \"decode\"\n ],\n \"title\": \"AccountProbeStep\",\n \"type\": \"string\"\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 \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"report\": {\n \"$ref\": \"#/$defs/AccountProbeReport\"\n }\n },\n \"required\": [\n \"report\"\n ],\n \"title\": \"External Accounts — Probe — response payload\",\n \"type\": \"object\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/external/accounts/probe/0.1\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"description\": \"Prove an external account works end to end. The outer document members are owned by the framework — SPEC §6.3.\",\n \"properties\": {\n \"context\": {\n \"$ref\": \"#/$defs/AccountContextId\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"id\": {\n \"$ref\": \"#/$defs/AccountId\"\n }\n },\n \"required\": [\n \"context\",\n \"id\"\n ],\n \"title\": \"External Accounts — Probe — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/external/accounts/probe/0.1#response";
const IS_PROOF_REQUIRED: bool = true;
const IS_ISSUED_AT_REQUIRED: bool = true;
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 \"AccountProbeReport\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"at\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"complete\": {\n \"description\": \"True only when the canary steps (`put`, `get`, `delete`, or the model's equivalent) ran, so the account was exercised end to end. A probe that stopped after `exchange` because nothing named a canary prefix is `complete: false` even when `ok` is true, and does not clear `providerSetupRequired`.\",\n \"type\": \"boolean\"\n },\n \"ok\": {\n \"description\": \"True when every step that ran succeeded.\",\n \"type\": \"boolean\"\n },\n \"steps\": {\n \"description\": \"In order; the first failing step ends the probe.\",\n \"items\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"durationMs\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"ok\": {\n \"type\": \"boolean\"\n },\n \"providerError\": {\n \"description\": \"The provider's error, verbatim and truncated, so an administrator sees the cloud's own words. Untrusted text. A custodian MUST remove any credential, signature or token from it first.\",\n \"maxLength\": 2048,\n \"type\": \"string\"\n },\n \"providerRequestId\": {\n \"maxLength\": 256,\n \"pattern\": \"^[!-~]+$\",\n \"type\": \"string\"\n },\n \"step\": {\n \"$ref\": \"#/$defs/AccountProbeStep\"\n }\n },\n \"required\": [\n \"step\",\n \"ok\"\n ],\n \"type\": \"object\"\n },\n \"maxItems\": 8,\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"at\",\n \"ok\",\n \"complete\",\n \"steps\"\n ],\n \"title\": \"AccountProbeReport\",\n \"type\": \"object\"\n },\n \"AccountProbeStep\": {\n \"description\": \"`sign`: the custodian signed its assertion, session request or test transaction. `exchange`: the provider issued a credential for it. `put`, `get`, `delete`: one canary object at the narrowest scope of the account's bindings. `decode`: for `sui-signer`, a built test transaction passed the allow-list (it is never submitted).\",\n \"enum\": [\n \"sign\",\n \"exchange\",\n \"put\",\n \"get\",\n \"delete\",\n \"decode\"\n ],\n \"title\": \"AccountProbeStep\",\n \"type\": \"string\"\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 \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"report\": {\n \"$ref\": \"#/$defs/AccountProbeReport\"\n }\n },\n \"required\": [\n \"report\"\n ],\n \"title\": \"External Accounts — Probe — 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::ARCHIVED,
error_codes::PROVIDER_UNAVAILABLE,
];
/// 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:archived`
///
/// The account is `archived`; restore it before changing or using it. See the family conventions §2.
///
/// Declared `retryable: false`.
pub const ARCHIVED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "external:archived",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `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,
};
}