artifact-keeper-client 1.2.1

Rust client for the Artifact Keeper REST API
Documentation
/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.
 *
 * The version of the OpenAPI document: 1.2.1
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// WebhookSecretCreatedResponse : Response returned exactly once when a webhook is created or its secret is rotated. The raw `secret` value is not retrievable afterwards.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookSecretCreatedResponse {
    #[serde(rename = "created_at")]
    pub created_at: String,
    /// Pinned event payload version (e.g. \"2026-04-01\"). Determines the shape of the rendered payload and the value sent in the `X-ArtifactKeeper-Event-Version` header.
    #[serde(rename = "event_schema_version")]
    pub event_schema_version: String,
    #[serde(rename = "events")]
    pub events: Vec<String>,
    #[serde(rename = "headers", skip_serializing_if = "Option::is_none")]
    pub headers: Option<serde_json::Value>,
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "is_enabled")]
    pub is_enabled: bool,
    #[serde(rename = "last_triggered_at", skip_serializing_if = "Option::is_none")]
    pub last_triggered_at: Option<String>,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "payload_template")]
    pub payload_template: models::PayloadTemplate,
    #[serde(rename = "repository_id", skip_serializing_if = "Option::is_none")]
    pub repository_id: Option<uuid::Uuid>,
    /// Short non-reversible identifier for the current signing secret (`whsec_...abcd`), suitable for display in operator UIs. The raw secret is never returned by GET or LIST.
    #[serde(rename = "secret_digest", skip_serializing_if = "Option::is_none")]
    pub secret_digest: Option<String>,
    /// True while a previous secret is still accepted by the retry path during a rotation overlap window.
    #[serde(rename = "secret_rotation_active", skip_serializing_if = "Option::is_none")]
    pub secret_rotation_active: Option<bool>,
    #[serde(rename = "url")]
    pub url: String,
    /// Raw signing secret. Display this to the operator immediately and instruct them to record it; the server retains only the encrypted form and a short digest.  Absent when the webhook was created without a signing secret. This happens when no secret was supplied and the deployment has no `AK_WEBHOOK_SECRET_KEY` configured: rather than fail the create with a 500, the webhook is stored unsigned and deliveries omit the signature header. Configure the key and rotate the secret later to enable signing.
    #[serde(rename = "secret", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub secret: Option<Option<String>>,
}

impl WebhookSecretCreatedResponse {
    /// Response returned exactly once when a webhook is created or its secret is rotated. The raw `secret` value is not retrievable afterwards.
    pub fn new(created_at: String, event_schema_version: String, events: Vec<String>, id: uuid::Uuid, is_enabled: bool, name: String, payload_template: models::PayloadTemplate, url: String) -> WebhookSecretCreatedResponse {
        WebhookSecretCreatedResponse {
            created_at,
            event_schema_version,
            events,
            headers: None,
            id,
            is_enabled,
            last_triggered_at: None,
            name,
            payload_template,
            repository_id: None,
            secret_digest: None,
            secret_rotation_active: None,
            url,
            secret: None,
        }
    }
}