#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetAccessTokenFromApiKeyRequest {
#[prost(string, tag = "1")]
pub api_key_value: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetAccessTokenFromApiKeyResponse {
#[prost(string, tag = "1")]
pub access_token: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub expires_at_seconds: i64,
#[prost(string, tag = "3")]
pub user_uuid: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub org_uuid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IssueSandboxTokenRequest {
#[prost(int64, optional, tag = "1")]
pub requested_ttl_seconds: ::core::option::Option<i64>,
#[prost(string, optional, tag = "2")]
pub shared_secret: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IssueSandboxTokenResponse {
#[prost(string, tag = "1")]
pub access_token: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub expires_at_seconds: i64,
#[prost(string, tag = "3")]
pub user_uuid: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub org_uuid: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub workspace_rid: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum InternalApiKeyError {
ApiKeyNotFound = 0,
}
impl InternalApiKeyError {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::ApiKeyNotFound => "INTERNAL_API_KEY_ERROR_API_KEY_NOT_FOUND",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"INTERNAL_API_KEY_ERROR_API_KEY_NOT_FOUND" => Some(Self::ApiKeyNotFound),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum InternalSandboxTokenError {
SandboxTokenUnavailable = 0,
}
impl InternalSandboxTokenError {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::SandboxTokenUnavailable => {
"INTERNAL_SANDBOX_TOKEN_ERROR_SANDBOX_TOKEN_UNAVAILABLE"
}
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"INTERNAL_SANDBOX_TOKEN_ERROR_SANDBOX_TOKEN_UNAVAILABLE" => {
Some(Self::SandboxTokenUnavailable)
}
_ => None,
}
}
}
pub mod internal_api_key_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct InternalApiKeyServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl InternalApiKeyServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> InternalApiKeyServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InternalApiKeyServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
InternalApiKeyServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get_access_token_from_api_key_value(
&mut self,
request: impl tonic::IntoRequest<super::GetAccessTokenFromApiKeyRequest>,
) -> std::result::Result<
tonic::Response<super::GetAccessTokenFromApiKeyResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.internalauthorization.v1.InternalApiKeyService/GetAccessTokenFromApiKeyValue",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.internalauthorization.v1.InternalApiKeyService",
"GetAccessTokenFromApiKeyValue",
),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod internal_sandbox_token_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct InternalSandboxTokenServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl InternalSandboxTokenServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> InternalSandboxTokenServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InternalSandboxTokenServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
InternalSandboxTokenServiceClient::new(
InterceptedService::new(inner, interceptor),
)
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn issue_sandbox_token(
&mut self,
request: impl tonic::IntoRequest<super::IssueSandboxTokenRequest>,
) -> std::result::Result<
tonic::Response<super::IssueSandboxTokenResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.internalauthorization.v1.InternalSandboxTokenService/IssueSandboxToken",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.internalauthorization.v1.InternalSandboxTokenService",
"IssueSandboxToken",
),
);
self.inner.unary(req, path, codec).await
}
}
}