google-cloud-security-publicca-v1 1.7.0

Google Cloud Client Libraries for Rust - Public Certificate Authority API
Documentation
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// A representation of an ExternalAccountKey used for [external account
/// binding](https://tools.ietf.org/html/rfc8555#section-7.3.4) within ACME.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExternalAccountKey {
    /// Output only. Resource name.
    /// projects/{project}/locations/{location}/externalAccountKeys/{key_id}
    pub name: std::string::String,

    /// Output only. Key ID.
    /// It is generated by the PublicCertificateAuthorityService
    /// when the ExternalAccountKey is created
    pub key_id: std::string::String,

    /// Output only. Base64-URL-encoded HS256 key.
    /// It is generated by the PublicCertificateAuthorityService
    /// when the ExternalAccountKey is created
    pub b64_mac_key: ::bytes::Bytes,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExternalAccountKey {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ExternalAccountKey::name].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_security_publicca_v1::model::ExternalAccountKey;
    /// let x = ExternalAccountKey::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [key_id][crate::model::ExternalAccountKey::key_id].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_security_publicca_v1::model::ExternalAccountKey;
    /// let x = ExternalAccountKey::new().set_key_id("example");
    /// ```
    pub fn set_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.key_id = v.into();
        self
    }

    /// Sets the value of [b64_mac_key][crate::model::ExternalAccountKey::b64_mac_key].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_security_publicca_v1::model::ExternalAccountKey;
    /// let x = ExternalAccountKey::new().set_b64_mac_key(bytes::Bytes::from_static(b"example"));
    /// ```
    pub fn set_b64_mac_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.b64_mac_key = v.into();
        self
    }
}

impl wkt::message::Message for ExternalAccountKey {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.security.publicca.v1.ExternalAccountKey"
    }
}

/// Creates a new
/// [ExternalAccountKey][google.cloud.security.publicca.v1.ExternalAccountKey] in
/// a given project.
///
/// [google.cloud.security.publicca.v1.ExternalAccountKey]: crate::model::ExternalAccountKey
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateExternalAccountKeyRequest {
    /// Required. The parent resource where this external_account_key will be
    /// created. Format: projects/[project_id]/locations/[location]. At present
    /// only the "global" location is supported.
    pub parent: std::string::String,

    /// Required. The external account key to create. This field only exists to
    /// future-proof the API. At present, all fields in ExternalAccountKey are
    /// output only and all values are ignored. For the purpose of the
    /// CreateExternalAccountKeyRequest, set it to a default/empty value.
    pub external_account_key: std::option::Option<crate::model::ExternalAccountKey>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateExternalAccountKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateExternalAccountKeyRequest::parent].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_security_publicca_v1::model::CreateExternalAccountKeyRequest;
    /// let x = CreateExternalAccountKeyRequest::new().set_parent("example");
    /// ```
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [external_account_key][crate::model::CreateExternalAccountKeyRequest::external_account_key].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_security_publicca_v1::model::CreateExternalAccountKeyRequest;
    /// use google_cloud_security_publicca_v1::model::ExternalAccountKey;
    /// let x = CreateExternalAccountKeyRequest::new().set_external_account_key(ExternalAccountKey::default()/* use setters */);
    /// ```
    pub fn set_external_account_key<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ExternalAccountKey>,
    {
        self.external_account_key = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [external_account_key][crate::model::CreateExternalAccountKeyRequest::external_account_key].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_security_publicca_v1::model::CreateExternalAccountKeyRequest;
    /// use google_cloud_security_publicca_v1::model::ExternalAccountKey;
    /// let x = CreateExternalAccountKeyRequest::new().set_or_clear_external_account_key(Some(ExternalAccountKey::default()/* use setters */));
    /// let x = CreateExternalAccountKeyRequest::new().set_or_clear_external_account_key(None::<ExternalAccountKey>);
    /// ```
    pub fn set_or_clear_external_account_key<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ExternalAccountKey>,
    {
        self.external_account_key = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateExternalAccountKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.security.publicca.v1.CreateExternalAccountKeyRequest"
    }
}