Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use service type block-storage for volume v3 #83

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,21 @@ pub struct GenericService {
major_version: VersionSelector,
}

/// Compute service.
/// Block storage service (v3).
#[derive(Copy, Clone, Debug)]
#[non_exhaustive]
pub struct ComputeService;
pub struct BlockStorageService;

service! {
#[doc = "Bare Metal service."]
BAREMETAL: BareMetalService -> "baremetal", header "x-openstack-ironic-api-version"
}

/// Compute service.
#[derive(Copy, Clone, Debug)]
#[non_exhaustive]
pub struct ComputeService;

service! {
#[doc = "Image service."]
IMAGE: ImageService -> "image"
Expand All @@ -157,11 +162,6 @@ service! {
OBJECT_STORAGE: ObjectStorageService -> "object-store", discovery false
}

service! {
#[doc = "Block Storage service (v3)."]
BLOCK_STORAGE: BlockStorageService -> "volumev3"
}

impl GenericService {
/// Create a new generic service.
pub const fn new(catalog_type: &'static str, major_version: VersionSelector) -> GenericService {
Expand All @@ -187,13 +187,30 @@ impl ServiceType for GenericService {
}
}

impl BlockStorageService {
/// Create a Compute service type.
pub const fn new() -> BlockStorageService {
BlockStorageService
}
}

impl ComputeService {
/// Create a Compute service type.
pub const fn new() -> ComputeService {
ComputeService
}
}

impl ServiceType for BlockStorageService {
fn catalog_type(&self) -> &'static str {
"block-storage"
}

fn major_version_supported(&self, version: ApiVersion) -> bool {
version.0 == 3
}
}

impl ServiceType for ComputeService {
fn catalog_type(&self) -> &'static str {
"compute"
Expand All @@ -214,5 +231,8 @@ impl VersionedService for ComputeService {
}
}

/// Block storage service (v3).
pub const BLOCK_STORAGE: BlockStorageService = BlockStorageService::new();

/// Compute service.
pub const COMPUTE: ComputeService = ComputeService::new();
Loading