copy profile to another server1

This commit is contained in:
Priec
2026-09-03 19:21:54 +02:00
parent cfb3bde02e
commit 05c387406c
7 changed files with 454 additions and 2 deletions

Binary file not shown.

View File

@@ -456,6 +456,89 @@ pub struct CopyProfileResponse {
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExportProfileBlueprintRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
/// Empty exports every dynamic table in the profile. Otherwise only these tables
/// are created by import; their unselected local dependencies become requirements.
#[prost(string, repeated, tag = "2")]
pub table_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExportProfileBlueprintResponse {
#[prost(string, tag = "1")]
pub blueprint_json: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub blueprint_sha256: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub tables: i32,
#[prost(int32, tag = "4")]
pub required_local_tables: i32,
#[prost(int32, tag = "5")]
pub required_global_tables: i32,
#[prost(int32, tag = "6")]
pub templates: i32,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PlanProfileBlueprintImportRequest {
#[prost(string, tag = "1")]
pub target_profile_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub blueprint_json: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ProfileBlueprintImportAction {
/// One of create, reuse, add, or conflict.
#[prost(string, tag = "1")]
pub action: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub resource: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub detail: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PlanProfileBlueprintImportResponse {
#[prost(bool, tag = "1")]
pub can_import: bool,
#[prost(string, tag = "2")]
pub plan_sha256: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub actions: ::prost::alloc::vec::Vec<ProfileBlueprintImportAction>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ImportProfileBlueprintRequest {
#[prost(string, tag = "1")]
pub target_profile_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub blueprint_json: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub expected_plan_sha256: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ImportProfileBlueprintResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub tables_created: i32,
#[prost(int32, tag = "4")]
pub globals_created: i32,
#[prost(int32, tag = "5")]
pub globals_reused: i32,
#[prost(int32, tag = "6")]
pub templates_created: i32,
#[prost(int32, tag = "7")]
pub templates_reused: i32,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetAliasChangeHistoryRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
@@ -1533,6 +1616,98 @@ pub mod table_definition_client {
);
self.inner.unary(req, path, codec).await
}
/// Serializes selected table structure and every required structural dependency.
/// Dynamic table rows and deployment-local security state are never included.
pub async fn export_profile_blueprint(
&mut self,
request: impl tonic::IntoRequest<super::ExportProfileBlueprintRequest>,
) -> std::result::Result<
tonic::Response<super::ExportProfileBlueprintResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_definition.TableDefinition/ExportProfileBlueprint",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"komp_ac.table_definition.TableDefinition",
"ExportProfileBlueprint",
),
);
self.inner.unary(req, path, codec).await
}
/// Reconciles a portable blueprint against a destination profile without writing.
pub async fn plan_profile_blueprint_import(
&mut self,
request: impl tonic::IntoRequest<super::PlanProfileBlueprintImportRequest>,
) -> std::result::Result<
tonic::Response<super::PlanProfileBlueprintImportResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_definition.TableDefinition/PlanProfileBlueprintImport",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"komp_ac.table_definition.TableDefinition",
"PlanProfileBlueprintImport",
),
);
self.inner.unary(req, path, codec).await
}
/// Applies a previously reviewed blueprint plan atomically. The plan hash protects
/// against both a changed package and destination drift between preview and apply.
pub async fn import_profile_blueprint(
&mut self,
request: impl tonic::IntoRequest<super::ImportProfileBlueprintRequest>,
) -> std::result::Result<
tonic::Response<super::ImportProfileBlueprintResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_definition.TableDefinition/ImportProfileBlueprint",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"komp_ac.table_definition.TableDefinition",
"ImportProfileBlueprint",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns the unified append-only history for column and option aliases.
pub async fn get_alias_change_history(
&mut self,
@@ -1927,6 +2102,32 @@ pub mod table_definition_server {
tonic::Response<super::CopyProfileResponse>,
tonic::Status,
>;
/// Serializes selected table structure and every required structural dependency.
/// Dynamic table rows and deployment-local security state are never included.
async fn export_profile_blueprint(
&self,
request: tonic::Request<super::ExportProfileBlueprintRequest>,
) -> std::result::Result<
tonic::Response<super::ExportProfileBlueprintResponse>,
tonic::Status,
>;
/// Reconciles a portable blueprint against a destination profile without writing.
async fn plan_profile_blueprint_import(
&self,
request: tonic::Request<super::PlanProfileBlueprintImportRequest>,
) -> std::result::Result<
tonic::Response<super::PlanProfileBlueprintImportResponse>,
tonic::Status,
>;
/// Applies a previously reviewed blueprint plan atomically. The plan hash protects
/// against both a changed package and destination drift between preview and apply.
async fn import_profile_blueprint(
&self,
request: tonic::Request<super::ImportProfileBlueprintRequest>,
) -> std::result::Result<
tonic::Response<super::ImportProfileBlueprintResponse>,
tonic::Status,
>;
/// Returns the unified append-only history for column and option aliases.
async fn get_alias_change_history(
&self,
@@ -2619,6 +2820,156 @@ pub mod table_definition_server {
};
Box::pin(fut)
}
"/komp_ac.table_definition.TableDefinition/ExportProfileBlueprint" => {
#[allow(non_camel_case_types)]
struct ExportProfileBlueprintSvc<T: TableDefinition>(pub Arc<T>);
impl<
T: TableDefinition,
> tonic::server::UnaryService<super::ExportProfileBlueprintRequest>
for ExportProfileBlueprintSvc<T> {
type Response = super::ExportProfileBlueprintResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ExportProfileBlueprintRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TableDefinition>::export_profile_blueprint(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ExportProfileBlueprintSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.table_definition.TableDefinition/PlanProfileBlueprintImport" => {
#[allow(non_camel_case_types)]
struct PlanProfileBlueprintImportSvc<T: TableDefinition>(pub Arc<T>);
impl<
T: TableDefinition,
> tonic::server::UnaryService<
super::PlanProfileBlueprintImportRequest,
> for PlanProfileBlueprintImportSvc<T> {
type Response = super::PlanProfileBlueprintImportResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::PlanProfileBlueprintImportRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TableDefinition>::plan_profile_blueprint_import(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = PlanProfileBlueprintImportSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.table_definition.TableDefinition/ImportProfileBlueprint" => {
#[allow(non_camel_case_types)]
struct ImportProfileBlueprintSvc<T: TableDefinition>(pub Arc<T>);
impl<
T: TableDefinition,
> tonic::server::UnaryService<super::ImportProfileBlueprintRequest>
for ImportProfileBlueprintSvc<T> {
type Response = super::ImportProfileBlueprintResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ImportProfileBlueprintRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TableDefinition>::import_profile_blueprint(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ImportProfileBlueprintSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.table_definition.TableDefinition/GetAliasChangeHistory" => {
#[allow(non_camel_case_types)]
struct GetAliasChangeHistorySvc<T: TableDefinition>(pub Arc<T>);