blob: 0b956e4d949ae78310487d28cf6d500a2a6a1439 [file] [log] [blame]
Michal Kobusf6113582019-09-09 15:58:21 +02001package noauth
2
3import (
4 "fmt"
5
6 "gerrit.mcp.mirantis.net/debian/gophercloud.git"
7)
8
9// EndpointOpts specifies a "noauth" Ironic Endpoint.
10type EndpointOpts struct {
11 // IronicEndpoint [required] is currently only used with "noauth" Ironic.
12 // An Ironic endpoint with "auth_strategy=noauth" is necessary, for example:
13 // http://ironic.example.com:6385/v1.
14 IronicEndpoint string
15}
16
17func initClientOpts(client *gophercloud.ProviderClient, eo EndpointOpts) (*gophercloud.ServiceClient, error) {
18 sc := new(gophercloud.ServiceClient)
19 if eo.IronicEndpoint == "" {
20 return nil, fmt.Errorf("IronicEndpoint is required")
21 }
22
23 sc.Endpoint = gophercloud.NormalizeURL(eo.IronicEndpoint)
24 sc.ProviderClient = client
25 return sc, nil
26}
27
28// NewBareMetalNoAuth creates a ServiceClient that may be used to access a
29// "noauth" bare metal service.
30func NewBareMetalNoAuth(eo EndpointOpts) (*gophercloud.ServiceClient, error) {
31 sc, err := initClientOpts(&gophercloud.ProviderClient{}, eo)
32
33 // sc.Type = "baremetal"
34
35 return sc, err
36}