//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `did-management/registry/check`. 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())
}
}
}
///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())
})
}
}
///`Payload`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/did-management/registry/check/0.2",
/// "title": "Payload",
/// "type": "object",
/// "required": [
/// "instanceId"
/// ],
/// "properties": {
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "instanceId": {
/// "description": "The registry identifier of the instance to re-evaluate.",
/// "type": "string",
/// "maxLength": 256,
/// "minLength": 1
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///The registry identifier of the instance to re-evaluate.
#[serde(rename = "instanceId")]
pub instance_id: PayloadInstanceId,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///The registry identifier of the instance to re-evaluate.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The registry identifier of the instance to re-evaluate.",
/// "type": "string",
/// "maxLength": 256,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadInstanceId(::std::string::String);
impl ::std::ops::Deref for PayloadInstanceId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadInstanceId> for ::std::string::String {
fn from(value: PayloadInstanceId) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadInstanceId {
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 PayloadInstanceId {
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 PayloadInstanceId {
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 PayloadInstanceId {
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 PayloadInstanceId {
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",
/// "required": [
/// "instance"
/// ],
/// "properties": {
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "instance": {
/// "description": "The entry as it stands after the re-evaluation.",
/// "$ref": "#/definitions/ServiceInstance"
/// }
/// },
/// "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>,
///The entry as it stands after the re-evaluation.
pub instance: ServiceInstance,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///`ServiceInstance`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ServiceInstance",
/// "type": "object",
/// "required": [
/// "did",
/// "instanceId",
/// "registeredAt",
/// "servedDomains",
/// "serviceType",
/// "status"
/// ],
/// "properties": {
/// "advertisedServices": {
/// "description": "`service[].type` values of the instance's DID document when the control plane last resolved it. Display only: nothing is routed on it. Absent when the document has not been resolved.",
/// "type": "array",
/// "items": {
/// "type": "string",
/// "minLength": 1
/// }
/// },
/// "did": {
/// "description": "The instance's own DID — the identity its signed documents are verified against and the one the control plane addresses.",
/// "type": "string",
/// "minLength": 1
/// },
/// "enabledMethods": {
/// "description": "DID methods the instance can host (e.g. `webvh`, `web`, `webs`), as it declared at registration.",
/// "type": "array",
/// "items": {
/// "type": "string",
/// "minLength": 1
/// }
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "instanceId": {
/// "description": "Stable identifier the control plane uses for this instance. SHOULD be derived from the instance's DID so it survives restarts.",
/// "type": "string",
/// "minLength": 1
/// },
/// "label": {
/// "description": "Operator-chosen display label. Untrusted free text.",
/// "type": "string",
/// "maxLength": 256
/// },
/// "lastHealthCheckAt": {
/// "description": "When the instance last answered a health probe. Absent when it never has.",
/// "type": "string",
/// "format": "date-time"
/// },
/// "lastInbound": {
/// "description": "The last document the control plane received from this instance. Absent when it has received none.",
/// "$ref": "#/definitions/TransportObservation"
/// },
/// "lastOutbound": {
/// "description": "The last document the control plane delivered to this instance. Absent when it has delivered none.",
/// "$ref": "#/definitions/TransportObservation"
/// },
/// "publicUrl": {
/// "description": "The instance's public base URL, where it serves DID resolution. Absent when the instance registered without one.",
/// "type": "string",
/// "format": "uri"
/// },
/// "registeredAt": {
/// "type": "string",
/// "format": "date-time"
/// },
/// "servedDomains": {
/// "description": "Hosting domains the instance has acknowledged serving. Always present — empty for an instance that serves none, which includes every `witness` and `watcher`.",
/// "type": "array",
/// "items": {
/// "type": "string",
/// "minLength": 1
/// }
/// },
/// "serviceType": {
/// "description": "`server` — a hosting server (edge) that resolves DIDs the control plane syncs to it. `witness` — a did:webvh witness. `watcher` — a did:webvh watcher that mirrors logs.",
/// "type": "string",
/// "enum": [
/// "server",
/// "witness",
/// "watcher"
/// ]
/// },
/// "servicesCheckedAt": {
/// "description": "When `advertisedServices` was last resolved. Absent with it.",
/// "type": "string",
/// "format": "date-time"
/// },
/// "status": {
/// "description": "The control plane's current verdict, from the instance's last answered health probe. `degraded` — answered late; `unreachable` — has not answered within the control plane's configured window.",
/// "type": "string",
/// "enum": [
/// "active",
/// "degraded",
/// "unreachable"
/// ]
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ServiceInstance {
///`service[].type` values of the instance's DID document when the control plane last resolved it. Display only: nothing is routed on it. Absent when the document has not been resolved.
#[serde(
rename = "advertisedServices",
default,
skip_serializing_if = "::std::vec::Vec::is_empty"
)]
pub advertised_services: ::std::vec::Vec<ServiceInstanceAdvertisedServicesItem>,
///The instance's own DID — the identity its signed documents are verified against and the one the control plane addresses.
pub did: ServiceInstanceDid,
///DID methods the instance can host (e.g. `webvh`, `web`, `webs`), as it declared at registration.
#[serde(
rename = "enabledMethods",
default,
skip_serializing_if = "::std::vec::Vec::is_empty"
)]
pub enabled_methods: ::std::vec::Vec<ServiceInstanceEnabledMethodsItem>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///Stable identifier the control plane uses for this instance. SHOULD be derived from the instance's DID so it survives restarts.
#[serde(rename = "instanceId")]
pub instance_id: ServiceInstanceInstanceId,
///Operator-chosen display label. Untrusted free text.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub label: ::std::option::Option<ServiceInstanceLabel>,
///When the instance last answered a health probe. Absent when it never has.
#[serde(
rename = "lastHealthCheckAt",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub last_health_check_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
///The last document the control plane received from this instance. Absent when it has received none.
#[serde(
rename = "lastInbound",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub last_inbound: ::std::option::Option<TransportObservation>,
///The last document the control plane delivered to this instance. Absent when it has delivered none.
#[serde(
rename = "lastOutbound",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub last_outbound: ::std::option::Option<TransportObservation>,
///The instance's public base URL, where it serves DID resolution. Absent when the instance registered without one.
#[serde(
rename = "publicUrl",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub public_url: ::std::option::Option<::std::string::String>,
#[serde(rename = "registeredAt")]
pub registered_at: ::chrono::DateTime<::chrono::offset::Utc>,
///Hosting domains the instance has acknowledged serving. Always present — empty for an instance that serves none, which includes every `witness` and `watcher`.
#[serde(rename = "servedDomains")]
pub served_domains: ::std::vec::Vec<ServiceInstanceServedDomainsItem>,
///`server` — a hosting server (edge) that resolves DIDs the control plane syncs to it. `witness` — a did:webvh witness. `watcher` — a did:webvh watcher that mirrors logs.
#[serde(rename = "serviceType")]
pub service_type: ServiceInstanceServiceType,
///When `advertisedServices` was last resolved. Absent with it.
#[serde(
rename = "servicesCheckedAt",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub services_checked_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
///The control plane's current verdict, from the instance's last answered health probe. `degraded` — answered late; `unreachable` — has not answered within the control plane's configured window.
pub status: ServiceInstanceStatus,
}
impl ServiceInstance {
pub fn builder() -> builder::ServiceInstance {
Default::default()
}
}
///`ServiceInstanceAdvertisedServicesItem`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ServiceInstanceAdvertisedServicesItem(::std::string::String);
impl ::std::ops::Deref for ServiceInstanceAdvertisedServicesItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ServiceInstanceAdvertisedServicesItem> for ::std::string::String {
fn from(value: ServiceInstanceAdvertisedServicesItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for ServiceInstanceAdvertisedServicesItem {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ServiceInstanceAdvertisedServicesItem {
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 ServiceInstanceAdvertisedServicesItem {
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 ServiceInstanceAdvertisedServicesItem {
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 ServiceInstanceAdvertisedServicesItem {
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 instance's own DID — the identity its signed documents are verified against and the one the control plane addresses.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The instance's own DID — the identity its signed documents are verified against and the one the control plane addresses.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ServiceInstanceDid(::std::string::String);
impl ::std::ops::Deref for ServiceInstanceDid {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ServiceInstanceDid> for ::std::string::String {
fn from(value: ServiceInstanceDid) -> Self {
value.0
}
}
impl ::std::str::FromStr for ServiceInstanceDid {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ServiceInstanceDid {
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 ServiceInstanceDid {
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 ServiceInstanceDid {
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 ServiceInstanceDid {
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())
})
}
}
///`ServiceInstanceEnabledMethodsItem`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ServiceInstanceEnabledMethodsItem(::std::string::String);
impl ::std::ops::Deref for ServiceInstanceEnabledMethodsItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ServiceInstanceEnabledMethodsItem> for ::std::string::String {
fn from(value: ServiceInstanceEnabledMethodsItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for ServiceInstanceEnabledMethodsItem {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ServiceInstanceEnabledMethodsItem {
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 ServiceInstanceEnabledMethodsItem {
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 ServiceInstanceEnabledMethodsItem {
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 ServiceInstanceEnabledMethodsItem {
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())
})
}
}
///Stable identifier the control plane uses for this instance. SHOULD be derived from the instance's DID so it survives restarts.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Stable identifier the control plane uses for this instance. SHOULD be derived from the instance's DID so it survives restarts.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ServiceInstanceInstanceId(::std::string::String);
impl ::std::ops::Deref for ServiceInstanceInstanceId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ServiceInstanceInstanceId> for ::std::string::String {
fn from(value: ServiceInstanceInstanceId) -> Self {
value.0
}
}
impl ::std::str::FromStr for ServiceInstanceInstanceId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ServiceInstanceInstanceId {
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 ServiceInstanceInstanceId {
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 ServiceInstanceInstanceId {
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 ServiceInstanceInstanceId {
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())
})
}
}
///Operator-chosen display label. Untrusted free text.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Operator-chosen display label. Untrusted free text.",
/// "type": "string",
/// "maxLength": 256
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ServiceInstanceLabel(::std::string::String);
impl ::std::ops::Deref for ServiceInstanceLabel {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ServiceInstanceLabel> for ::std::string::String {
fn from(value: ServiceInstanceLabel) -> Self {
value.0
}
}
impl ::std::str::FromStr for ServiceInstanceLabel {
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());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ServiceInstanceLabel {
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 ServiceInstanceLabel {
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 ServiceInstanceLabel {
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 ServiceInstanceLabel {
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())
})
}
}
///`ServiceInstanceServedDomainsItem`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ServiceInstanceServedDomainsItem(::std::string::String);
impl ::std::ops::Deref for ServiceInstanceServedDomainsItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ServiceInstanceServedDomainsItem> for ::std::string::String {
fn from(value: ServiceInstanceServedDomainsItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for ServiceInstanceServedDomainsItem {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ServiceInstanceServedDomainsItem {
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 ServiceInstanceServedDomainsItem {
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 ServiceInstanceServedDomainsItem {
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 ServiceInstanceServedDomainsItem {
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())
})
}
}
///`server` — a hosting server (edge) that resolves DIDs the control plane syncs to it. `witness` — a did:webvh witness. `watcher` — a did:webvh watcher that mirrors logs.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "`server` — a hosting server (edge) that resolves DIDs the control plane syncs to it. `witness` — a did:webvh witness. `watcher` — a did:webvh watcher that mirrors logs.",
/// "type": "string",
/// "enum": [
/// "server",
/// "witness",
/// "watcher"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum ServiceInstanceServiceType {
#[serde(rename = "server")]
Server,
#[serde(rename = "witness")]
Witness,
#[serde(rename = "watcher")]
Watcher,
}
impl ::std::fmt::Display for ServiceInstanceServiceType {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Server => f.write_str("server"),
Self::Witness => f.write_str("witness"),
Self::Watcher => f.write_str("watcher"),
}
}
}
impl ::std::str::FromStr for ServiceInstanceServiceType {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"server" => Ok(Self::Server),
"witness" => Ok(Self::Witness),
"watcher" => Ok(Self::Watcher),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for ServiceInstanceServiceType {
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 ServiceInstanceServiceType {
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 ServiceInstanceServiceType {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///The control plane's current verdict, from the instance's last answered health probe. `degraded` — answered late; `unreachable` — has not answered within the control plane's configured window.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The control plane's current verdict, from the instance's last answered health probe. `degraded` — answered late; `unreachable` — has not answered within the control plane's configured window.",
/// "type": "string",
/// "enum": [
/// "active",
/// "degraded",
/// "unreachable"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum ServiceInstanceStatus {
#[serde(rename = "active")]
Active,
#[serde(rename = "degraded")]
Degraded,
#[serde(rename = "unreachable")]
Unreachable,
}
impl ::std::fmt::Display for ServiceInstanceStatus {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Active => f.write_str("active"),
Self::Degraded => f.write_str("degraded"),
Self::Unreachable => f.write_str("unreachable"),
}
}
}
impl ::std::str::FromStr for ServiceInstanceStatus {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"active" => Ok(Self::Active),
"degraded" => Ok(Self::Degraded),
"unreachable" => Ok(Self::Unreachable),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for ServiceInstanceStatus {
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 ServiceInstanceStatus {
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 ServiceInstanceStatus {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///`TransportObservation`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "TransportObservation",
/// "type": "object",
/// "required": [
/// "observedAt",
/// "transport"
/// ],
/// "properties": {
/// "observedAt": {
/// "type": "string",
/// "format": "date-time"
/// },
/// "transport": {
/// "description": "The binding the document actually travelled on.",
/// "type": "string",
/// "enum": [
/// "tsp",
/// "didcomm",
/// "https"
/// ]
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct TransportObservation {
#[serde(rename = "observedAt")]
pub observed_at: ::chrono::DateTime<::chrono::offset::Utc>,
///The binding the document actually travelled on.
pub transport: TransportObservationTransport,
}
impl TransportObservation {
pub fn builder() -> builder::TransportObservation {
Default::default()
}
}
///The binding the document actually travelled on.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The binding the document actually travelled on.",
/// "type": "string",
/// "enum": [
/// "tsp",
/// "didcomm",
/// "https"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum TransportObservationTransport {
#[serde(rename = "tsp")]
Tsp,
#[serde(rename = "didcomm")]
Didcomm,
#[serde(rename = "https")]
Https,
}
impl ::std::fmt::Display for TransportObservationTransport {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Tsp => f.write_str("tsp"),
Self::Didcomm => f.write_str("didcomm"),
Self::Https => f.write_str("https"),
}
}
}
impl ::std::str::FromStr for TransportObservationTransport {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"tsp" => Ok(Self::Tsp),
"didcomm" => Ok(Self::Didcomm),
"https" => Ok(Self::Https),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for TransportObservationTransport {
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 TransportObservationTransport {
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 TransportObservationTransport {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Payload {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
instance_id: ::std::result::Result<super::PayloadInstanceId, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
instance_id: Err("no value supplied for instance_id".to_string()),
}
}
}
impl Payload {
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 instance_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadInstanceId>,
T::Error: ::std::fmt::Display,
{
self.instance_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for instance_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 {
ext: value.ext?,
instance_id: value.instance_id?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
ext: Ok(value.ext),
instance_id: Ok(value.instance_id),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
instance: ::std::result::Result<super::ServiceInstance, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
instance: Err("no value supplied for instance".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 instance<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ServiceInstance>,
T::Error: ::std::fmt::Display,
{
self.instance = value
.try_into()
.map_err(|e| format!("error converting supplied value for instance: {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?,
instance: value.instance?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
ext: Ok(value.ext),
instance: Ok(value.instance),
}
}
}
#[derive(Clone, Debug)]
pub struct ServiceInstance {
advertised_services: ::std::result::Result<
::std::vec::Vec<super::ServiceInstanceAdvertisedServicesItem>,
::std::string::String,
>,
did: ::std::result::Result<super::ServiceInstanceDid, ::std::string::String>,
enabled_methods: ::std::result::Result<
::std::vec::Vec<super::ServiceInstanceEnabledMethodsItem>,
::std::string::String,
>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
instance_id: ::std::result::Result<super::ServiceInstanceInstanceId, ::std::string::String>,
label: ::std::result::Result<
::std::option::Option<super::ServiceInstanceLabel>,
::std::string::String,
>,
last_health_check_at: ::std::result::Result<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
::std::string::String,
>,
last_inbound: ::std::result::Result<
::std::option::Option<super::TransportObservation>,
::std::string::String,
>,
last_outbound: ::std::result::Result<
::std::option::Option<super::TransportObservation>,
::std::string::String,
>,
public_url: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
registered_at:
::std::result::Result<::chrono::DateTime<::chrono::offset::Utc>, ::std::string::String>,
served_domains: ::std::result::Result<
::std::vec::Vec<super::ServiceInstanceServedDomainsItem>,
::std::string::String,
>,
service_type:
::std::result::Result<super::ServiceInstanceServiceType, ::std::string::String>,
services_checked_at: ::std::result::Result<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
::std::string::String,
>,
status: ::std::result::Result<super::ServiceInstanceStatus, ::std::string::String>,
}
impl ::std::default::Default for ServiceInstance {
fn default() -> Self {
Self {
advertised_services: Ok(Default::default()),
did: Err("no value supplied for did".to_string()),
enabled_methods: Ok(Default::default()),
ext: Ok(Default::default()),
instance_id: Err("no value supplied for instance_id".to_string()),
label: Ok(Default::default()),
last_health_check_at: Ok(Default::default()),
last_inbound: Ok(Default::default()),
last_outbound: Ok(Default::default()),
public_url: Ok(Default::default()),
registered_at: Err("no value supplied for registered_at".to_string()),
served_domains: Err("no value supplied for served_domains".to_string()),
service_type: Err("no value supplied for service_type".to_string()),
services_checked_at: Ok(Default::default()),
status: Err("no value supplied for status".to_string()),
}
}
}
impl ServiceInstance {
pub fn advertised_services<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::vec::Vec<super::ServiceInstanceAdvertisedServicesItem>,
>,
T::Error: ::std::fmt::Display,
{
self.advertised_services = value.try_into().map_err(|e| {
format!("error converting supplied value for advertised_services: {e}")
});
self
}
pub fn did<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ServiceInstanceDid>,
T::Error: ::std::fmt::Display,
{
self.did = value
.try_into()
.map_err(|e| format!("error converting supplied value for did: {e}"));
self
}
pub fn enabled_methods<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ServiceInstanceEnabledMethodsItem>>,
T::Error: ::std::fmt::Display,
{
self.enabled_methods = value
.try_into()
.map_err(|e| format!("error converting supplied value for enabled_methods: {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 instance_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ServiceInstanceInstanceId>,
T::Error: ::std::fmt::Display,
{
self.instance_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for instance_id: {e}"));
self
}
pub fn label<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ServiceInstanceLabel>>,
T::Error: ::std::fmt::Display,
{
self.label = value
.try_into()
.map_err(|e| format!("error converting supplied value for label: {e}"));
self
}
pub fn last_health_check_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
>,
T::Error: ::std::fmt::Display,
{
self.last_health_check_at = value.try_into().map_err(|e| {
format!("error converting supplied value for last_health_check_at: {e}")
});
self
}
pub fn last_inbound<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::TransportObservation>>,
T::Error: ::std::fmt::Display,
{
self.last_inbound = value
.try_into()
.map_err(|e| format!("error converting supplied value for last_inbound: {e}"));
self
}
pub fn last_outbound<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::TransportObservation>>,
T::Error: ::std::fmt::Display,
{
self.last_outbound = value
.try_into()
.map_err(|e| format!("error converting supplied value for last_outbound: {e}"));
self
}
pub fn public_url<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.public_url = value
.try_into()
.map_err(|e| format!("error converting supplied value for public_url: {e}"));
self
}
pub fn registered_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
T::Error: ::std::fmt::Display,
{
self.registered_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for registered_at: {e}"));
self
}
pub fn served_domains<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ServiceInstanceServedDomainsItem>>,
T::Error: ::std::fmt::Display,
{
self.served_domains = value
.try_into()
.map_err(|e| format!("error converting supplied value for served_domains: {e}"));
self
}
pub fn service_type<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ServiceInstanceServiceType>,
T::Error: ::std::fmt::Display,
{
self.service_type = value
.try_into()
.map_err(|e| format!("error converting supplied value for service_type: {e}"));
self
}
pub fn services_checked_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
>,
T::Error: ::std::fmt::Display,
{
self.services_checked_at = value.try_into().map_err(|e| {
format!("error converting supplied value for services_checked_at: {e}")
});
self
}
pub fn status<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ServiceInstanceStatus>,
T::Error: ::std::fmt::Display,
{
self.status = value
.try_into()
.map_err(|e| format!("error converting supplied value for status: {e}"));
self
}
}
impl ::std::convert::TryFrom<ServiceInstance> for super::ServiceInstance {
type Error = super::error::ConversionError;
fn try_from(
value: ServiceInstance,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
advertised_services: value.advertised_services?,
did: value.did?,
enabled_methods: value.enabled_methods?,
ext: value.ext?,
instance_id: value.instance_id?,
label: value.label?,
last_health_check_at: value.last_health_check_at?,
last_inbound: value.last_inbound?,
last_outbound: value.last_outbound?,
public_url: value.public_url?,
registered_at: value.registered_at?,
served_domains: value.served_domains?,
service_type: value.service_type?,
services_checked_at: value.services_checked_at?,
status: value.status?,
})
}
}
impl ::std::convert::From<super::ServiceInstance> for ServiceInstance {
fn from(value: super::ServiceInstance) -> Self {
Self {
advertised_services: Ok(value.advertised_services),
did: Ok(value.did),
enabled_methods: Ok(value.enabled_methods),
ext: Ok(value.ext),
instance_id: Ok(value.instance_id),
label: Ok(value.label),
last_health_check_at: Ok(value.last_health_check_at),
last_inbound: Ok(value.last_inbound),
last_outbound: Ok(value.last_outbound),
public_url: Ok(value.public_url),
registered_at: Ok(value.registered_at),
served_domains: Ok(value.served_domains),
service_type: Ok(value.service_type),
services_checked_at: Ok(value.services_checked_at),
status: Ok(value.status),
}
}
}
#[derive(Clone, Debug)]
pub struct TransportObservation {
observed_at:
::std::result::Result<::chrono::DateTime<::chrono::offset::Utc>, ::std::string::String>,
transport:
::std::result::Result<super::TransportObservationTransport, ::std::string::String>,
}
impl ::std::default::Default for TransportObservation {
fn default() -> Self {
Self {
observed_at: Err("no value supplied for observed_at".to_string()),
transport: Err("no value supplied for transport".to_string()),
}
}
}
impl TransportObservation {
pub fn observed_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
T::Error: ::std::fmt::Display,
{
self.observed_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for observed_at: {e}"));
self
}
pub fn transport<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::TransportObservationTransport>,
T::Error: ::std::fmt::Display,
{
self.transport = value
.try_into()
.map_err(|e| format!("error converting supplied value for transport: {e}"));
self
}
}
impl ::std::convert::TryFrom<TransportObservation> for super::TransportObservation {
type Error = super::error::ConversionError;
fn try_from(
value: TransportObservation,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
observed_at: value.observed_at?,
transport: value.transport?,
})
}
}
impl ::std::convert::From<super::TransportObservation> for TransportObservation {
fn from(value: super::TransportObservation) -> Self {
Self {
observed_at: Ok(value.observed_at),
transport: Ok(value.transport),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/did-management/registry/check/0.2";
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 \"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 \"instance\": {\n \"$ref\": \"#/$defs/ServiceInstance\",\n \"description\": \"The entry as it stands after the re-evaluation.\"\n }\n },\n \"required\": [\n \"instance\"\n ],\n \"title\": \"Registry Check — response payload\",\n \"type\": \"object\"\n },\n \"ServiceInstance\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"advertisedServices\": {\n \"description\": \"`service[].type` values of the instance's DID document when the control plane last resolved it. Display only: nothing is routed on it. Absent when the document has not been resolved.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"did\": {\n \"description\": \"The instance's own DID — the identity its signed documents are verified against and the one the control plane addresses.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"enabledMethods\": {\n \"description\": \"DID methods the instance can host (e.g. `webvh`, `web`, `webs`), as it declared at registration.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"instanceId\": {\n \"description\": \"Stable identifier the control plane uses for this instance. SHOULD be derived from the instance's DID so it survives restarts.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"label\": {\n \"description\": \"Operator-chosen display label. Untrusted free text.\",\n \"maxLength\": 256,\n \"type\": \"string\"\n },\n \"lastHealthCheckAt\": {\n \"description\": \"When the instance last answered a health probe. Absent when it never has.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"lastInbound\": {\n \"$ref\": \"#/$defs/TransportObservation\",\n \"description\": \"The last document the control plane received from this instance. Absent when it has received none.\"\n },\n \"lastOutbound\": {\n \"$ref\": \"#/$defs/TransportObservation\",\n \"description\": \"The last document the control plane delivered to this instance. Absent when it has delivered none.\"\n },\n \"publicUrl\": {\n \"description\": \"The instance's public base URL, where it serves DID resolution. Absent when the instance registered without one.\",\n \"format\": \"uri\",\n \"type\": \"string\"\n },\n \"registeredAt\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"servedDomains\": {\n \"description\": \"Hosting domains the instance has acknowledged serving. Always present — empty for an instance that serves none, which includes every `witness` and `watcher`.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"serviceType\": {\n \"description\": \"`server` — a hosting server (edge) that resolves DIDs the control plane syncs to it. `witness` — a did:webvh witness. `watcher` — a did:webvh watcher that mirrors logs.\",\n \"enum\": [\n \"server\",\n \"witness\",\n \"watcher\"\n ],\n \"type\": \"string\"\n },\n \"servicesCheckedAt\": {\n \"description\": \"When `advertisedServices` was last resolved. Absent with it.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"status\": {\n \"description\": \"The control plane's current verdict, from the instance's last answered health probe. `degraded` — answered late; `unreachable` — has not answered within the control plane's configured window.\",\n \"enum\": [\n \"active\",\n \"degraded\",\n \"unreachable\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"instanceId\",\n \"did\",\n \"serviceType\",\n \"status\",\n \"registeredAt\",\n \"servedDomains\"\n ],\n \"title\": \"ServiceInstance\",\n \"type\": \"object\"\n },\n \"TransportObservation\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"observedAt\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"transport\": {\n \"description\": \"The binding the document actually travelled on.\",\n \"enum\": [\n \"tsp\",\n \"didcomm\",\n \"https\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"transport\",\n \"observedAt\"\n ],\n \"title\": \"TransportObservation\",\n \"type\": \"object\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/did-management/registry/check/0.2\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"instanceId\": {\n \"description\": \"The registry identifier of the instance to re-evaluate.\",\n \"maxLength\": 256,\n \"minLength\": 1,\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"instanceId\"\n ],\n \"title\": \"Registry Check — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/did-management/registry/check/0.2#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 \"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 \"instance\": {\n \"$ref\": \"#/$defs/ServiceInstance\",\n \"description\": \"The entry as it stands after the re-evaluation.\"\n }\n },\n \"required\": [\n \"instance\"\n ],\n \"title\": \"Registry Check — response payload\",\n \"type\": \"object\"\n },\n \"ServiceInstance\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"advertisedServices\": {\n \"description\": \"`service[].type` values of the instance's DID document when the control plane last resolved it. Display only: nothing is routed on it. Absent when the document has not been resolved.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"did\": {\n \"description\": \"The instance's own DID — the identity its signed documents are verified against and the one the control plane addresses.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"enabledMethods\": {\n \"description\": \"DID methods the instance can host (e.g. `webvh`, `web`, `webs`), as it declared at registration.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"instanceId\": {\n \"description\": \"Stable identifier the control plane uses for this instance. SHOULD be derived from the instance's DID so it survives restarts.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"label\": {\n \"description\": \"Operator-chosen display label. Untrusted free text.\",\n \"maxLength\": 256,\n \"type\": \"string\"\n },\n \"lastHealthCheckAt\": {\n \"description\": \"When the instance last answered a health probe. Absent when it never has.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"lastInbound\": {\n \"$ref\": \"#/$defs/TransportObservation\",\n \"description\": \"The last document the control plane received from this instance. Absent when it has received none.\"\n },\n \"lastOutbound\": {\n \"$ref\": \"#/$defs/TransportObservation\",\n \"description\": \"The last document the control plane delivered to this instance. Absent when it has delivered none.\"\n },\n \"publicUrl\": {\n \"description\": \"The instance's public base URL, where it serves DID resolution. Absent when the instance registered without one.\",\n \"format\": \"uri\",\n \"type\": \"string\"\n },\n \"registeredAt\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"servedDomains\": {\n \"description\": \"Hosting domains the instance has acknowledged serving. Always present — empty for an instance that serves none, which includes every `witness` and `watcher`.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"serviceType\": {\n \"description\": \"`server` — a hosting server (edge) that resolves DIDs the control plane syncs to it. `witness` — a did:webvh witness. `watcher` — a did:webvh watcher that mirrors logs.\",\n \"enum\": [\n \"server\",\n \"witness\",\n \"watcher\"\n ],\n \"type\": \"string\"\n },\n \"servicesCheckedAt\": {\n \"description\": \"When `advertisedServices` was last resolved. Absent with it.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"status\": {\n \"description\": \"The control plane's current verdict, from the instance's last answered health probe. `degraded` — answered late; `unreachable` — has not answered within the control plane's configured window.\",\n \"enum\": [\n \"active\",\n \"degraded\",\n \"unreachable\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"instanceId\",\n \"did\",\n \"serviceType\",\n \"status\",\n \"registeredAt\",\n \"servedDomains\"\n ],\n \"title\": \"ServiceInstance\",\n \"type\": \"object\"\n },\n \"TransportObservation\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"observedAt\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"transport\": {\n \"description\": \"The binding the document actually travelled on.\",\n \"enum\": [\n \"tsp\",\n \"didcomm\",\n \"https\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"transport\",\n \"observedAt\"\n ],\n \"title\": \"TransportObservation\",\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];
/// 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 {
/// `did-management/registry/check:notFound`
///
/// No registry entry has the submitted `instanceId`.
///
/// Declared `retryable: false`.
pub const NOT_FOUND: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "did-management/registry/check:notFound",
retryable: false,
details_schema: ::core::option::Option::None,
};
}