1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
package noauth
import (
"fmt"
"github.com/gophercloud/gophercloud"
)
// EndpointOpts specifies a "noauth" Ironic Inspector Endpoint.
type EndpointOpts struct {
// IronicInspectorEndpoint [required] is currently only used with "noauth" Ironic introspection.
// An Ironic inspector endpoint with "auth_strategy=noauth" is necessary, for example:
// http://ironic.example.com:5050/v1.
IronicInspectorEndpoint string
}
func initClientOpts(client *gophercloud.ProviderClient, eo EndpointOpts) (*gophercloud.ServiceClient, error) {
sc := new(gophercloud.ServiceClient)
if eo.IronicInspectorEndpoint == "" {
return nil, fmt.Errorf("IronicInspectorEndpoint is required")
}
sc.Endpoint = gophercloud.NormalizeURL(eo.IronicInspectorEndpoint)
sc.ProviderClient = client
return sc, nil
}
// NewBareMetalIntrospectionNoAuth creates a ServiceClient that may be used to access a
// "noauth" bare metal introspection service.
func NewBareMetalIntrospectionNoAuth(eo EndpointOpts) (*gophercloud.ServiceClient, error) {
sc, err := initClientOpts(&gophercloud.ProviderClient{}, eo)
if err != nil {
return nil, err
}
sc.Type = "baremetal-introspection"
return sc, nil
}
|