This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,448 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub mod certificate; | ||
pub mod definition; | ||
pub mod deployment; | ||
pub mod domain; | ||
pub mod errors; | ||
pub mod healthcheck; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
use async_trait::async_trait; | ||
use golem_gateway_client::apis::api_certificate_api::{ | ||
v1_api_certificates_delete, v1_api_certificates_get, v1_api_certificates_post, | ||
}; | ||
use golem_gateway_client::apis::configuration::Configuration; | ||
use golem_gateway_client::models::{Certificate, CertificateRequest}; | ||
use tracing::info; | ||
|
||
use crate::model::{GolemError, ProjectId}; | ||
|
||
#[async_trait] | ||
pub trait CertificateClient { | ||
async fn get( | ||
&self, | ||
project_id: ProjectId, | ||
certificate_id: Option<&str>, | ||
) -> Result<Vec<Certificate>, GolemError>; | ||
|
||
async fn create(&self, certificate: CertificateRequest) -> Result<Certificate, GolemError>; | ||
|
||
async fn delete( | ||
&self, | ||
project_id: ProjectId, | ||
certificate_id: &str, | ||
) -> Result<String, GolemError>; | ||
} | ||
|
||
pub struct CertificateClientLive { | ||
pub configuration: Configuration, | ||
} | ||
|
||
#[async_trait] | ||
impl CertificateClient for CertificateClientLive { | ||
async fn get( | ||
&self, | ||
project_id: ProjectId, | ||
certificate_id: Option<&str>, | ||
) -> Result<Vec<Certificate>, GolemError> { | ||
info!("Calling v1_api_certificates_get for project_id {project_id:?}, certificate_id {certificate_id:?} on base url {}", self.configuration.base_path); | ||
Ok(v1_api_certificates_get( | ||
&self.configuration, | ||
&project_id.0.to_string(), | ||
certificate_id, | ||
) | ||
.await?) | ||
} | ||
|
||
async fn create(&self, certificate: CertificateRequest) -> Result<Certificate, GolemError> { | ||
info!( | ||
"Calling v1_api_certificates_post on base url {}", | ||
self.configuration.base_path | ||
); | ||
Ok(v1_api_certificates_post(&self.configuration, certificate).await?) | ||
} | ||
|
||
async fn delete( | ||
&self, | ||
project_id: ProjectId, | ||
certificate_id: &str, | ||
) -> Result<String, GolemError> { | ||
info!("Calling v1_api_certificates_delete for project_id {project_id:?}, certificate_id {certificate_id} on base url {}", self.configuration.base_path); | ||
Ok(v1_api_certificates_delete( | ||
&self.configuration, | ||
&project_id.0.to_string(), | ||
certificate_id, | ||
) | ||
.await?) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
use async_trait::async_trait; | ||
use golem_gateway_client::apis::api_definition_api::{ | ||
v1_api_definitions_delete, v1_api_definitions_get, v1_api_definitions_put, | ||
}; | ||
use golem_gateway_client::apis::configuration::Configuration; | ||
use golem_gateway_client::models::ApiDefinition; | ||
use tracing::info; | ||
|
||
use crate::model::{GolemError, ProjectId}; | ||
|
||
#[async_trait] | ||
pub trait DefinitionClient { | ||
async fn get( | ||
&self, | ||
project_id: ProjectId, | ||
api_definition_id: Option<&str>, | ||
) -> Result<Vec<ApiDefinition>, GolemError>; | ||
|
||
async fn update(&self, api_definition: ApiDefinition) -> Result<ApiDefinition, GolemError>; | ||
|
||
async fn delete( | ||
&self, | ||
project_id: ProjectId, | ||
api_definition_id: &str, | ||
) -> Result<String, GolemError>; | ||
} | ||
|
||
pub struct DefinitionClientLive { | ||
pub configuration: Configuration, | ||
} | ||
|
||
#[async_trait] | ||
impl DefinitionClient for DefinitionClientLive { | ||
async fn get( | ||
&self, | ||
project_id: ProjectId, | ||
api_definition_id: Option<&str>, | ||
) -> Result<Vec<ApiDefinition>, GolemError> { | ||
info!("Calling v1_api_definitions_get for project_id {project_id:?}, api_definition_id {api_definition_id:?} on base url {}", self.configuration.base_path); | ||
Ok(v1_api_definitions_get( | ||
&self.configuration, | ||
&project_id.0.to_string(), | ||
api_definition_id, | ||
) | ||
.await?) | ||
} | ||
|
||
async fn update(&self, api_definition: ApiDefinition) -> Result<ApiDefinition, GolemError> { | ||
info!( | ||
"Calling v1_api_definitions_put on base url {}", | ||
self.configuration.base_path | ||
); | ||
Ok(v1_api_definitions_put(&self.configuration, api_definition).await?) | ||
} | ||
|
||
async fn delete( | ||
&self, | ||
project_id: ProjectId, | ||
api_definition_id: &str, | ||
) -> Result<String, GolemError> { | ||
info!("Calling v1_api_definitions_delete for project_id {project_id:?}, api_definition_id {api_definition_id} on base url {}", self.configuration.base_path); | ||
Ok(v1_api_definitions_delete( | ||
&self.configuration, | ||
&project_id.0.to_string(), | ||
api_definition_id, | ||
) | ||
.await?) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
use async_trait::async_trait; | ||
use golem_gateway_client::apis::api_deployment_api::{ | ||
v1_api_deployments_delete, v1_api_deployments_get, v1_api_deployments_put, | ||
}; | ||
use golem_gateway_client::apis::configuration::Configuration; | ||
use golem_gateway_client::models::ApiDeployment; | ||
use tracing::info; | ||
|
||
use crate::model::{GolemError, ProjectId}; | ||
|
||
#[async_trait] | ||
pub trait DeploymentClient { | ||
async fn get( | ||
&self, | ||
project_id: ProjectId, | ||
api_definition_id: &str, | ||
) -> Result<Vec<ApiDeployment>, GolemError>; | ||
async fn update(&self, api_deployment: ApiDeployment) -> Result<ApiDeployment, GolemError>; | ||
async fn delete( | ||
&self, | ||
project_id: ProjectId, | ||
api_definition_id: &str, | ||
site: &str, | ||
) -> Result<String, GolemError>; | ||
} | ||
|
||
pub struct DeploymentClientLive { | ||
pub configuration: Configuration, | ||
} | ||
|
||
#[async_trait] | ||
impl DeploymentClient for DeploymentClientLive { | ||
async fn get( | ||
&self, | ||
project_id: ProjectId, | ||
api_definition_id: &str, | ||
) -> Result<Vec<ApiDeployment>, GolemError> { | ||
info!("Calling v1_api_deployments_get for project_id {project_id:?}, api_definition_id {api_definition_id} on base url: {}", self.configuration.base_path); | ||
Ok(v1_api_deployments_get( | ||
&self.configuration, | ||
&project_id.0.to_string(), | ||
api_definition_id, | ||
) | ||
.await?) | ||
} | ||
|
||
async fn update(&self, api_deployment: ApiDeployment) -> Result<ApiDeployment, GolemError> { | ||
info!( | ||
"Calling v1_api_deployments_put on base url: {}", | ||
self.configuration.base_path | ||
); | ||
Ok(v1_api_deployments_put(&self.configuration, api_deployment).await?) | ||
} | ||
|
||
async fn delete( | ||
&self, | ||
project_id: ProjectId, | ||
api_definition_id: &str, | ||
site: &str, | ||
) -> Result<String, GolemError> { | ||
info!("Calling v1_api_deployments_delete for project_id {project_id:?}, api_definition_id {api_definition_id}, site {site} on base url: {}", self.configuration.base_path); | ||
Ok(v1_api_deployments_delete( | ||
&self.configuration, | ||
&project_id.0.to_string(), | ||
api_definition_id, | ||
site, | ||
) | ||
.await?) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
use async_trait::async_trait; | ||
use golem_gateway_client::apis::api_domain_api::{ | ||
v1_api_domains_delete, v1_api_domains_get, v1_api_domains_put, | ||
}; | ||
use golem_gateway_client::apis::configuration::Configuration; | ||
use golem_gateway_client::models::{ApiDomain, DomainRequest}; | ||
use tracing::info; | ||
|
||
use crate::model::{GolemError, ProjectId}; | ||
|
||
#[async_trait] | ||
pub trait DomainClient { | ||
async fn get(&self, project_id: ProjectId) -> Result<Vec<ApiDomain>, GolemError>; | ||
|
||
async fn update( | ||
&self, | ||
project_id: ProjectId, | ||
domain_name: String, | ||
) -> Result<ApiDomain, GolemError>; | ||
|
||
async fn delete(&self, project_id: ProjectId, domain_name: &str) -> Result<String, GolemError>; | ||
} | ||
|
||
pub struct DomainClientLive { | ||
pub configuration: Configuration, | ||
} | ||
|
||
#[async_trait] | ||
impl DomainClient for DomainClientLive { | ||
async fn get(&self, project_id: ProjectId) -> Result<Vec<ApiDomain>, GolemError> { | ||
info!( | ||
"Calling v1_api_domains_get for project_id {project_id:?} on base url {}", | ||
self.configuration.base_path | ||
); | ||
Ok(v1_api_domains_get(&self.configuration, &project_id.0.to_string()).await?) | ||
} | ||
|
||
async fn update( | ||
&self, | ||
project_id: ProjectId, | ||
domain_name: String, | ||
) -> Result<ApiDomain, GolemError> { | ||
info!("Calling v1_api_domains_get for project_id {project_id:?}, domain_name {domain_name} on base url {}", self.configuration.base_path); | ||
Ok(v1_api_domains_put( | ||
&self.configuration, | ||
DomainRequest { | ||
project_id: project_id.0, | ||
domain_name, | ||
}, | ||
) | ||
.await?) | ||
} | ||
|
||
async fn delete(&self, project_id: ProjectId, domain_name: &str) -> Result<String, GolemError> { | ||
info!("Calling v1_api_domains_get for project_id {project_id:?}, domain_name {domain_name} on base url {}", self.configuration.base_path); | ||
Ok( | ||
v1_api_domains_delete(&self.configuration, &project_id.0.to_string(), domain_name) | ||
.await?, | ||
) | ||
} | ||
} |
Oops, something went wrong.