pub struct Registry { /* private fields */ }Expand description
The main Terraform Provider Registry.
This struct represents a configured Terraform Provider Registry that serves provider packages from GitHub Releases. It implements the complete Terraform Provider Registry Protocol.
§Creating a Registry
Use the Registry::builder() method to create a new registry:
let registry = Registry::builder()
.github_token("ghp_your_token")
.gpg_signing_key(
"KEY_ID".to_string(),
EncodingKey::Pem("public_key".to_string())
)
.build()
.await?;§Creating a Router
Once built, create an Axum router with create_router():
let app = registry.create_router();Implementations§
Source§impl Registry
impl Registry
Sourcepub fn builder() -> RegistryBuilder
pub fn builder() -> RegistryBuilder
Creates a new RegistryBuilder for configuring a Registry.
This is the recommended way to create a new Registry instance.
§Examples
let registry = Registry::builder()
.github_token("ghp_token")
.gpg_signing_key("KEY_ID".to_string(), EncodingKey::Pem("...".to_string()))
.build()
.await?;Sourcepub fn create_router(&self) -> Router
pub fn create_router(&self) -> Router
Creates an Axum Router configured with this Registry’s routes and state.
The router includes the following endpoints:
/.well-known/terraform.json- Service discovery/{base_url}/{namespace}/{type}/versions- List available provider versions/{base_url}/{namespace}/{type}/{version}/download/{os}/{arch}- Download provider package
§Tracing
The router includes HTTP tracing middleware that logs all requests and responses
at the DEBUG level, including headers.
§Examples
let app = registry.create_router();
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?;
axum::serve(listener, app).await?;Trait Implementations§
Auto Trait Implementations§
impl Freeze for Registry
impl !RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
impl !UnwindSafe for Registry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more