Skip to content

Commit e394733

Browse files
committed
Use official service types
We now have alias support and Gophercloud will automatically negotiate on our behalf. This means we set the service types to their official value rather than one of the aliases. Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
1 parent 0ba521a commit e394733

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

openstack/blockstorage/noauth/requests.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ func initClientOpts(client *gophercloud.ProviderClient, eo EndpointOpts, clientT
5151

5252
// NewBlockStorageNoAuthV2 creates a ServiceClient that may be used to access "noauth" v2 block storage service.
5353
func NewBlockStorageNoAuthV2(client *gophercloud.ProviderClient, eo EndpointOpts) (*gophercloud.ServiceClient, error) {
54-
return initClientOpts(client, eo, "volumev2")
54+
return initClientOpts(client, eo, "block-storage")
5555
}
5656

5757
// NewBlockStorageNoAuthV3 creates a ServiceClient that may be used to access "noauth" v3 block storage service.
5858
func NewBlockStorageNoAuthV3(client *gophercloud.ProviderClient, eo EndpointOpts) (*gophercloud.ServiceClient, error) {
59-
return initClientOpts(client, eo, "volumev3")
59+
return initClientOpts(client, eo, "block-storage")
6060
}

openstack/client.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ func NewIdentityV3(client *gophercloud.ProviderClient, eo gophercloud.EndpointOp
344344
}, nil
345345
}
346346

347+
// TODO(stephenfin): Allow passing aliases to all New${SERVICE}V${VERSION} methods in v3
347348
func initClientOpts(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts, clientType string) (*gophercloud.ServiceClient, error) {
348349
sc := new(gophercloud.ServiceClient)
349350
eo.ApplyDefaults(clientType)
@@ -393,6 +394,7 @@ func NewNetworkV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpt
393394
return sc, err
394395
}
395396

397+
// TODO(stephenfin): Remove this in v3. We no longer support the V1 Block Storage service.
396398
// NewBlockStorageV1 creates a ServiceClient that may be used to access the v1
397399
// block storage service.
398400
func NewBlockStorageV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
@@ -402,17 +404,17 @@ func NewBlockStorageV1(client *gophercloud.ProviderClient, eo gophercloud.Endpoi
402404
// NewBlockStorageV2 creates a ServiceClient that may be used to access the v2
403405
// block storage service.
404406
func NewBlockStorageV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
405-
return initClientOpts(client, eo, "volumev2")
407+
return initClientOpts(client, eo, "block-storage")
406408
}
407409

408410
// NewBlockStorageV3 creates a ServiceClient that may be used to access the v3 block storage service.
409411
func NewBlockStorageV3(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
410-
return initClientOpts(client, eo, "volumev3")
412+
return initClientOpts(client, eo, "block-storage")
411413
}
412414

413415
// NewSharedFileSystemV2 creates a ServiceClient that may be used to access the v2 shared file system service.
414416
func NewSharedFileSystemV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
415-
return initClientOpts(client, eo, "sharev2")
417+
return initClientOpts(client, eo, "shared-file-system")
416418
}
417419

418420
// NewOrchestrationV1 creates a ServiceClient that may be used to access the v1
@@ -457,14 +459,14 @@ func NewLoadBalancerV2(client *gophercloud.ProviderClient, eo gophercloud.Endpoi
457459
// NewMessagingV2 creates a ServiceClient that may be used with the v2 messaging
458460
// service.
459461
func NewMessagingV2(client *gophercloud.ProviderClient, clientID string, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
460-
sc, err := initClientOpts(client, eo, "messaging")
462+
sc, err := initClientOpts(client, eo, "message")
461463
sc.MoreHeaders = map[string]string{"Client-ID": clientID}
462464
return sc, err
463465
}
464466

465467
// NewContainerV1 creates a ServiceClient that may be used with v1 container package
466468
func NewContainerV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
467-
return initClientOpts(client, eo, "container")
469+
return initClientOpts(client, eo, "application-container")
468470
}
469471

470472
// NewKeyManagerV1 creates a ServiceClient that may be used with the v1 key
@@ -478,12 +480,12 @@ func NewKeyManagerV1(client *gophercloud.ProviderClient, eo gophercloud.Endpoint
478480
// NewContainerInfraV1 creates a ServiceClient that may be used with the v1 container infra management
479481
// package.
480482
func NewContainerInfraV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
481-
return initClientOpts(client, eo, "container-infra")
483+
return initClientOpts(client, eo, "container-infrastructure-management")
482484
}
483485

484486
// NewWorkflowV2 creates a ServiceClient that may be used with the v2 workflow management package.
485487
func NewWorkflowV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
486-
return initClientOpts(client, eo, "workflowv2")
488+
return initClientOpts(client, eo, "workflow")
487489
}
488490

489491
// NewPlacementV1 creates a ServiceClient that may be used with the placement package.

0 commit comments

Comments
 (0)