Documentation ¶
Index ¶
- type APIClient
- func Connect(config ClientConfig) (c *APIClient, err error)
- func ConnectContext(ctx context.Context, config ClientConfig) (c *APIClient, err error)
- func ConnectDefault(endpoint string) (c *APIClient, err error)
- func ConnectDefaultContext(ctx context.Context, endpoint string) (c *APIClient, err error)
- func (c *APIClient) CloneWithSession() (*APIClient, error)
- func (c *APIClient) Delete(url string) (*http.Response, error)
- func (c *APIClient) DeleteWithHeaders(url string, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) Get(url string) (*http.Response, error)
- func (c *APIClient) GetService() *Service
- func (c *APIClient) GetSession() (*Session, error)
- func (c *APIClient) GetWithHeaders(url string, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) Head(url string) (*http.Response, error)
- func (c *APIClient) HeadWithHeaders(url string, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) Logout()
- func (c *APIClient) Patch(url string, payload interface{}) (*http.Response, error)
- func (c *APIClient) PatchWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) Post(url string, payload interface{}) (*http.Response, error)
- func (c *APIClient) PostMultipart(url string, payload map[string]io.Reader) (*http.Response, error)
- func (c *APIClient) PostMultipartWithHeaders(url string, payload map[string]io.Reader, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) PostWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) Put(url string, payload interface{}) (*http.Response, error)
- func (c *APIClient) PutWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) RunRawRequestWithHeaders(method, url string, payloadBuffer io.ReadSeeker, contentType string, ...) (*http.Response, error)
- func (c *APIClient) SetDumpWriter(writer io.Writer)
- type ClientConfig
- type DeepOperations
- type Expand
- type ProtocolFeaturesSupported
- type Service
- func (serviceroot *Service) AccountService() (*redfish.AccountService, error)
- func (serviceroot *Service) AggregationService() (*redfish.AggregationService, error)
- func (serviceroot *Service) Cables() ([]*redfish.Cable, error)
- func (serviceroot *Service) CertificateService() (*redfish.CertificateService, error)
- func (serviceroot *Service) Chassis() ([]*redfish.Chassis, error)
- func (serviceroot *Service) ComponentIntegrity() ([]*redfish.ComponentIntegrity, error)
- func (serviceroot *Service) CompositionService() (*redfish.CompositionService, error)
- func (serviceroot *Service) CreateSession(username, password string) (*redfish.AuthToken, error)
- func (serviceroot *Service) DeleteSession(url string) error
- func (serviceroot *Service) EventService() (*redfish.EventService, error)
- func (serviceroot *Service) Fabrics() ([]*redfish.Fabric, error)
- func (serviceroot *Service) Facilities() ([]*redfish.Facility, error)
- func (serviceroot *Service) JobService() (*redfish.JobService, error)
- func (serviceroot *Service) KeyService() (*redfish.KeyService, error)
- func (serviceroot *Service) LicenseService() (*redfish.LicenseService, error)
- func (serviceroot *Service) ManagerProvidingService() (*redfish.Manager, error)
- func (serviceroot *Service) Managers() ([]*redfish.Manager, error)
- func (serviceroot *Service) MessageByLanguage(messageID, language string) (*redfish.MessageRegistryMessage, error)
- func (serviceroot *Service) MessageRegistries() ([]*redfish.MessageRegistry, error)
- func (serviceroot *Service) MessageRegistriesByLanguage(language string) ([]*redfish.MessageRegistry, error)
- func (serviceroot *Service) MessageRegistry(uri string) (*redfish.MessageRegistry, error)
- func (serviceroot *Service) MessageRegistryByLanguage(registry, language string) (*redfish.MessageRegistry, error)
- func (serviceroot *Service) PowerEquipment() (*redfish.PowerEquipment, error)
- func (serviceroot *Service) RegisteredClients() ([]*redfish.RegisteredClient, error)
- func (serviceroot *Service) Registries() ([]*redfish.MessageRegistryFile, error)
- func (serviceroot *Service) ResourceBlocks() ([]*redfish.ResourceBlock, error)
- func (serviceroot *Service) ServiceConditions() (*redfish.ServiceConditions, error)
- func (serviceroot *Service) SessionService() (*redfish.SessionService, error)
- func (serviceroot *Service) Sessions() ([]*redfish.Session, error)
- func (serviceroot *Service) Storage() ([]*redfish.Storage, error)
- func (serviceroot *Service) StorageServices() ([]*swordfish.StorageService, error)
- func (serviceroot *Service) StorageSystems() ([]*swordfish.StorageSystem, error)
- func (serviceroot *Service) Systems() ([]*redfish.ComputerSystem, error)
- func (serviceroot *Service) TaskService() (*redfish.TaskService, error)
- func (serviceroot *Service) Tasks() ([]*redfish.Task, error)
- func (serviceroot *Service) TelemetryService() (*redfish.TelemetryService, error)
- func (serviceroot *Service) ThermalEquipment() (*redfish.ThermalEquipment, error)
- func (serviceroot *Service) UnmarshalJSON(b []byte) error
- func (serviceroot *Service) UpdateService() (*redfish.UpdateService, error)
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct { // HTTPClient is for direct http actions HTTPClient *http.Client // Service is the ServiceRoot of this Redfish instance Service *Service // contains filtered or unexported fields }
APIClient represents a connection to a Redfish/Swordfish enabled service or device.
func Connect ¶
func Connect(config ClientConfig) (c *APIClient, err error)
Connect creates a new client connection to a Redfish service.
func ConnectContext ¶ added in v0.8.0
func ConnectContext(ctx context.Context, config ClientConfig) (c *APIClient, err error)
ConnectContext is the same as Connect, but sets the ctx.
func ConnectDefault ¶
ConnectDefault creates an unauthenticated connection to a Redfish service.
func ConnectDefaultContext ¶ added in v0.8.0
ConnectDefaultContext is the same as ConnectDefault, but sets the ctx.
func (*APIClient) CloneWithSession ¶ added in v0.8.0
CloneWithSession will create a new Client with a session instead of basic auth.
func (*APIClient) DeleteWithHeaders ¶ added in v0.10.0
func (c *APIClient) DeleteWithHeaders(url string, customHeaders map[string]string) (*http.Response, error)
DeleteWithHeaders performs a Delete request against the Redfish service but allowing custom headers
func (*APIClient) GetService ¶ added in v0.14.0
GetService returns the APIClient's service.
func (*APIClient) GetSession ¶ added in v0.6.0
GetSession retrieves the session data from an initialized APIClient. An error is returned if the client is not authenticated.
func (*APIClient) GetWithHeaders ¶ added in v0.10.0
func (c *APIClient) GetWithHeaders(url string, customHeaders map[string]string) (*http.Response, error)
GetWithHeaders performs a GET request against the Redfish service but allowing custom headers
func (*APIClient) HeadWithHeaders ¶ added in v0.15.0
func (c *APIClient) HeadWithHeaders(url string, customHeaders map[string]string) (*http.Response, error)
GetWithHeaders performs a HEAD request against the Redfish service but allowing custom headers
func (*APIClient) Logout ¶
func (c *APIClient) Logout()
Logout will delete any active session. Useful to defer logout when creating a new connection.
func (*APIClient) PatchWithHeaders ¶ added in v0.10.0
func (c *APIClient) PatchWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)
PatchWithHeaders performs a Patch request against the Redfish service but allowing custom headers
func (*APIClient) PostMultipart ¶ added in v0.8.0
PostMultipart performs a Post request against the Redfish service with multipart payload.
func (*APIClient) PostMultipartWithHeaders ¶ added in v0.10.0
func (c *APIClient) PostMultipartWithHeaders(url string, payload map[string]io.Reader, customHeaders map[string]string) (*http.Response, error)
PostMultipartWithHeadersperforms a Post request against the Redfish service with multipart payload but allowing custom headers
func (*APIClient) PostWithHeaders ¶ added in v0.10.0
func (c *APIClient) PostWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)
PostWithHeaders performs a Post request against the Redfish service but allowing custom headers
func (*APIClient) PutWithHeaders ¶ added in v0.10.0
func (c *APIClient) PutWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)
PutWithHeaders performs a Put request against the Redfish service but allowing custom headers
func (*APIClient) RunRawRequestWithHeaders ¶ added in v0.13.0
func (c *APIClient) RunRawRequestWithHeaders(method, url string, payloadBuffer io.ReadSeeker, contentType string, customHeaders map[string]string) (*http.Response, error)
RunRawRequestWithHeaders actually performs the REST calls but allowing custom headers
func (*APIClient) SetDumpWriter ¶ added in v0.8.0
SetDumpWriter sets the client the DumpWriter dynamically
type ClientConfig ¶
type ClientConfig struct { // Endpoint is the URL of the redfish service Endpoint string // Username is the optional user name to authenticate with. Username string // Password is the password to use for authentication. Password string // Session is an optional session ID+token obtained from a previous session // If this is set, it is preferred over Username and Password Session *Session // Insecure controls whether to enforce SSL certificate validity. Insecure bool // Controls TLS handshake timeout TLSHandshakeTimeout int // HTTPClient is the optional client to connect with. HTTPClient *http.Client // DumpWriter is an optional io.Writer to receive dumps of HTTP // requests and responses. DumpWriter io.Writer // BasicAuth tells the APIClient if basic auth should be used (true) or token based auth must be used (false) BasicAuth bool // The maximum number of concurrent HTTP requests that will be made (default: 1) MaxConcurrentRequests int64 // ReuseConnections can be useful if executing a lot of requests. Setting to `true` allows // the TCP sessions to remain open and reused betweeen subsequent calls. ReuseConnections bool }
ClientConfig holds the settings for establishing a connection.
type DeepOperations ¶ added in v0.16.0
type DeepOperations struct { // DeepPATCH shall indicate whether this service supports the Redfish Specification-defined deep PATCH operation. DeepPATCH bool // DeepPOST shall indicate whether this service supports the Redfish Specification-defined deep POST operation. DeepPOST bool // MaxLevels shall contain the maximum levels of resources allowed in deep operations. MaxLevels int }
DeepOperations shall contain information about deep operations that the service supports.
type Expand ¶
type Expand struct { // ExpandAll shall be a boolean indicating whether this service supports the // use of asterisk (expand all entries) as a value for the $expand query // parameter as described by the specification. ExpandAll bool // Levels shall be a boolean indicating whether this service supports the // use of $levels as a value for the $expand query parameter as described by // the specification. Levels bool // Links shall be a boolean indicating whether this service supports the use // of tilde (expand only entries in the Links section) as a value for the // $expand query parameter as described by the specification. Links bool // MaxLevels shall be the maximum value of the $levels qualifier supported // by the service and shall only be included if the value of the Levels // property is true. MaxLevels int // NoLinks shall be a boolean indicating whether this service supports the // use of period (expand only entries not in the Links section) as a value // for the $expand query parameter as described by the specification. NoLinks bool }
Expand shall contain information about the support of the $expand query parameter by the service.
type ProtocolFeaturesSupported ¶
type ProtocolFeaturesSupported struct { // ExcerptQuery shall be a boolean indicating whether this service supports // the use of the 'excerpt' query parameter as described by the // specification. ExcerptQuery bool // ExpandQuery shall contain information about the support of the $expand // query parameter by the service. ExpandQuery Expand // FilterQuery shall be a boolean indicating whether this service supports // the use of the $filter query parameter as described by the specification. FilterQuery bool // OnlyMemberQuery shall be a boolean indicating whether this service // supports the use of the 'only' query parameter as described by the // specification. OnlyMemberQuery bool // SelectQuery shall be a boolean indicating whether this service supports // the use of the $select query parameter as described by the specification. SelectQuery bool }
ProtocolFeaturesSupported contains information about protocol features supported by the service.
type Service ¶
type Service struct { common.Entity // ODataContext is the odata context. ODataContext string `json:"@odata.context"` // ODataID is the odata identifier. ODataID string `json:"@odata.id"` // ODataType is the odata type. ODataType string `json:"@odata.type"` // Description provides a description of this resource. Description string // Oem contains all the vendor specific actions. It is vendor responsibility to parse // this field accordingly Oem json.RawMessage // Product shall include the name of the product represented by this Redfish // service. Product string // ProtocolFeaturesSupported contains information about protocol features // supported by the service. ProtocolFeaturesSupported ProtocolFeaturesSupported // RedfishVersion shall represent the version of the Redfish service. The // format of this string shall be of the format // majorversion.minorversion.errata in compliance with Protocol Version // section of the Redfish specification. RedfishVersion string // ServiceIdentification shall contain a vendor-provided or user-provided value that identifies and associates a // discovered Redfish service with a particular product instance. The value of the property shall contain the value // of the ServiceIdentification property in the Manager resource providing the Redfish service root resource. The // value of this property is used in conjunction with the Product and Vendor properties to match user credentials // or other a priori product instance information necessary for initial deployment to the correct, matching Redfish // service. This property shall not be present if its value is an empty string or 'null'. ServiceIdentification string // UUID shall be an exact match of the UUID value returned in a 200OK from // an SSDP M-SEARCH request during discovery. RFC4122 describes methods that // can be used to create a UUID value. The value should be considered to be // opaque. Client software should only treat the overall value as a // universally unique identifier and should not interpret any sub-fields // within the UUID. UUID string // Vendor shall include the name of the manufacturer or vendor represented // by this Redfish service. If this property is supported, the vendor name // shall not be included in the value of the Product property. Vendor string // contains filtered or unexported fields }
Service represents the root Redfish service. All values for resources described by this schema shall comply to the requirements as described in the Redfish specification.
func ServiceRoot ¶
ServiceRoot will get a Service instance from the service.
func (*Service) AccountService ¶
func (serviceroot *Service) AccountService() (*redfish.AccountService, error)
AccountService gets the Redfish AccountService
func (*Service) AggregationService ¶ added in v0.16.0
func (serviceroot *Service) AggregationService() (*redfish.AggregationService, error)
AggregationService gets the aggregation service.
func (*Service) CertificateService ¶ added in v0.16.0
func (serviceroot *Service) CertificateService() (*redfish.CertificateService, error)
CertificateService gets the certificate service.
func (*Service) ComponentIntegrity ¶ added in v0.16.0
func (serviceroot *Service) ComponentIntegrity() ([]*redfish.ComponentIntegrity, error)
ComponentIntegrity gets a collection of cables.
func (*Service) CompositionService ¶
func (serviceroot *Service) CompositionService() (*redfish.CompositionService, error)
CompositionService gets the composition service.
func (*Service) CreateSession ¶
CreateSession creates a new session and returns the token and id
func (*Service) DeleteSession ¶
DeleteSession logout the specified session
func (*Service) EventService ¶
func (serviceroot *Service) EventService() (*redfish.EventService, error)
EventService gets the Redfish EventService
func (*Service) Facilities ¶ added in v0.16.0
Facilities gets a collection of facilities.
func (*Service) JobService ¶ added in v0.15.0
func (serviceroot *Service) JobService() (*redfish.JobService, error)
JobService gets the job service instance
func (*Service) KeyService ¶ added in v0.16.0
func (serviceroot *Service) KeyService() (*redfish.KeyService, error)
KeyService gets the key service.
func (*Service) LicenseService ¶ added in v0.16.0
func (serviceroot *Service) LicenseService() (*redfish.LicenseService, error)
LicenseService gets the license service.
func (*Service) ManagerProvidingService ¶ added in v0.16.0
ManagerProvidingService gets the manager for this Redfish service.
func (*Service) MessageByLanguage ¶ added in v0.8.0
func (serviceroot *Service) MessageByLanguage(messageID, language string) (*redfish.MessageRegistryMessage, error)
MessageByLanguage tries to find and get the message in the correct language from the informed messageID. messageID is the key used to find the registry, version and message, for example: "Alert.1.0.LanDisconnect"
- The segment before the 1st period is the Registry Name (Registry Prefix): Alert
- The segment between the 1st and 2nd period is the major version: 1
- The segment between the 2nd and 3rd period is the minor version: 0
- The segment after the 3rd period is the Message Identifier in the Registry: LanDisconnect
language is the RFC5646-conformant language code for the message registry, for example: "en".
func (*Service) MessageRegistries ¶ added in v0.8.0
func (serviceroot *Service) MessageRegistries() ([]*redfish.MessageRegistry, error)
MessageRegistries gets all the available message registries in all languages
func (*Service) MessageRegistriesByLanguage ¶ added in v0.8.0
func (serviceroot *Service) MessageRegistriesByLanguage(language string) ([]*redfish.MessageRegistry, error)
MessageRegistriesByLanguage gets the message registries by language. language is the RFC5646-conformant language code for the message registry, for example: "en".
func (*Service) MessageRegistry ¶ added in v0.8.0
func (serviceroot *Service) MessageRegistry(uri string) (*redfish.MessageRegistry, error)
MessageRegistry gets a specific message registry. uri is the uri for the message registry
func (*Service) MessageRegistryByLanguage ¶ added in v0.8.0
func (serviceroot *Service) MessageRegistryByLanguage(registry, language string) (*redfish.MessageRegistry, error)
MessageRegistryByLanguage gets a specific message registry by language. registry is used to identify the correct Message Registry file and it shall contain the Message Registry name and it major and minor versions, as defined by the Redfish Specification, for example: "Alert.1.0.0". language is the RFC5646-conformant language code for the message registry, for example: "en".
func (*Service) PowerEquipment ¶ added in v0.15.0
func (serviceroot *Service) PowerEquipment() (*redfish.PowerEquipment, error)
PowerEquipment gets the powerEquipment instances of this service.
func (*Service) RegisteredClients ¶ added in v0.16.0
func (serviceroot *Service) RegisteredClients() ([]*redfish.RegisteredClient, error)
RegisteredClients gets a collection of registered clients.
func (*Service) Registries ¶ added in v0.8.0
func (serviceroot *Service) Registries() ([]*redfish.MessageRegistryFile, error)
Registries gets the Redfish Registries
func (*Service) ResourceBlocks ¶ added in v0.16.0
func (serviceroot *Service) ResourceBlocks() ([]*redfish.ResourceBlock, error)
ResourceBlocks gets a collection of resource blocks.
func (*Service) ServiceConditions ¶ added in v0.16.0
func (serviceroot *Service) ServiceConditions() (*redfish.ServiceConditions, error)
ServiceConditions gets the service conditions.
func (*Service) SessionService ¶ added in v0.16.0
func (serviceroot *Service) SessionService() (*redfish.SessionService, error)
SessionService gets the session service.
func (*Service) StorageServices ¶
func (serviceroot *Service) StorageServices() ([]*swordfish.StorageService, error)
StorageServices gets the Swordfish storage services
func (*Service) StorageSystems ¶
func (serviceroot *Service) StorageSystems() ([]*swordfish.StorageSystem, error)
StorageSystems gets the storage system instances managed by this service.
func (*Service) Systems ¶
func (serviceroot *Service) Systems() ([]*redfish.ComputerSystem, error)
Systems get the system instances from the service
func (*Service) TaskService ¶ added in v0.14.0
func (serviceroot *Service) TaskService() (*redfish.TaskService, error)
TaskService gets the task service instance
func (*Service) TelemetryService ¶ added in v0.16.0
func (serviceroot *Service) TelemetryService() (*redfish.TelemetryService, error)
TelemetryService gets the telemetry service instance.
func (*Service) ThermalEquipment ¶ added in v0.16.0
func (serviceroot *Service) ThermalEquipment() (*redfish.ThermalEquipment, error)
ThermalEquipment gets the thermal equipment instance.
func (*Service) UnmarshalJSON ¶
UnmarshalJSON unmarshals a Service object from the raw JSON.
func (*Service) UpdateService ¶ added in v0.6.0
func (serviceroot *Service) UpdateService() (*redfish.UpdateService, error)
UpdateService gets the update service instance