Documentation
¶
Index ¶
- func Deref[T any](v *T) T
- func ToRef[T any](v T) *T
- 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) GetSettings() schemas.ClientSettings
- 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 any) (*http.Response, error)
- func (c *APIClient) PatchWithHeaders(url string, payload any, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) Post(url string, payload any) (*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 any, customHeaders map[string]string) (*http.Response, error)
- func (c *APIClient) Put(url string, payload any) (*http.Response, error)
- func (c *APIClient) PutWithHeaders(url string, payload any, 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)
- func (c *APIClient) WithContext(ctx context.Context) *APIClient
- type ClientConfig
- type DeepOperations
- type Expand
- type ProtocolFeaturesSupported
- type Service
- func (s *Service) AccountService() (*schemas.AccountService, error)
- func (s *Service) AggregationService() (*schemas.AggregationService, error)
- func (s *Service) AutomationNodes() ([]*schemas.AutomationNode, error)
- func (s *Service) Cables() ([]*schemas.Cable, error)
- func (s *Service) CertificateService() (*schemas.CertificateService, error)
- func (s *Service) Chassis() ([]*schemas.Chassis, error)
- func (s *Service) ComponentIntegrity() ([]*schemas.ComponentIntegrity, error)
- func (s *Service) CompositionService() (*schemas.CompositionService, error)
- func (s *Service) CreateSession(username, password string) (*schemas.AuthToken, error)
- func (s *Service) DeleteSession(url string) error
- func (s *Service) EventService() (*schemas.EventService, error)
- func (s *Service) Fabrics() ([]*schemas.Fabric, error)
- func (s *Service) Facilities() ([]*schemas.Facility, error)
- func (s *Service) JSONSchemas() ([]*schemas.JSONSchemaFile, error)
- func (s *Service) JobService() (*schemas.JobService, error)
- func (s *Service) KeyService() (*schemas.KeyService, error)
- func (s *Service) LicenseService() (*schemas.LicenseService, error)
- func (s *Service) ManagerProvidingService() (*schemas.Manager, error)
- func (s *Service) Managers() ([]*schemas.Manager, error)
- func (s *Service) NVMeDomains() ([]*schemas.NVMeDomain, error)
- func (s *Service) PowerEquipment() (*schemas.PowerEquipment, error)
- func (s *Service) RegisteredClients() ([]*schemas.RegisteredClient, error)
- func (s *Service) Registries() ([]*schemas.MessageRegistryFile, error)
- func (s *Service) ResourceBlocks() ([]*schemas.ResourceBlock, error)
- func (s *Service) ServiceConditions() (*schemas.ServiceConditions, error)
- func (s *Service) SessionService() (*schemas.SessionService, error)
- func (s *Service) Sessions() (*schemas.Session, error)
- func (s *Service) Storage() ([]*schemas.Storage, error)
- func (s *Service) StorageServices() ([]*schemas.StorageService, error)
- func (s *Service) StorageSystems() ([]*schemas.ComputerSystem, error)
- func (s *Service) Systems() ([]*schemas.ComputerSystem, error)
- func (s *Service) Tasks() (*schemas.TaskService, error)
- func (s *Service) TelemetryService() (*schemas.TelemetryService, error)
- func (s *Service) ThermalEquipment() (*schemas.ThermalEquipment, error)
- func (s *Service) UnmarshalJSON(b []byte) error
- func (s *Service) UpdateService() (*schemas.UpdateService, error)
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deref ¶ added in v0.21.0
func Deref[T any](v *T) T
Deref is a convenience wrapper to get optional values from schema objects.
Pointer values in objects are optional values, so if you want to see if the service reported a value, then you need to explicitly check for nil:
// Did we get a display order?
if attribuate.DisplayOrder {
// Nothing reported
}
But if we don't care if it was reported by the service and we just want its value, being fine with its zero-value if it wasn't provided, we can do:
var value int value = Deref(attribute.DisplayOrder)
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
Settings schemas.ClientSettings
// 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) GetSettings ¶ added in v0.21.0
func (c *APIClient) GetSettings() schemas.ClientSettings
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 any, 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 any, 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 any, 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
// NoModifyTransport if set indicates that the API client won't attempt to make any changes to the transport
NoModifyTransport bool
// AutoExpand enables $expand if supported and automatically falls back if $expand fails.
AutoExpand 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.
//
// Version added: v1.7.0
DeepPATCH bool
// DeepPOST shall indicate whether this service supports the Redfish
// Specification-defined deep 'POST' operation.
//
// Version added: v1.7.0
DeepPOST bool
// MaxLevels shall contain the maximum levels of resources allowed in deep
// operations.
//
// Version added: v1.7.0
MaxLevels uint
}
DeepOperations shall contain information about deep operations that the service supports.
type Expand ¶
type Expand struct {
// ExpandAll shall indicate whether this service supports the asterisk ('*')
// option of the '$expand' query parameter.
//
// Version added: v1.3.0
ExpandAll bool
// Levels shall indicate whether the service supports the '$levels' option of
// the '$expand' query parameter.
//
// Version added: v1.3.0
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 contain the maximum '$levels' option value in the '$expand'
// query parameter. This property shall be present if the 'Levels' property
// contains 'true'.
//
// Version added: v1.3.0
MaxLevels uint
// NoLinks shall indicate whether the service supports the period ('.') option
// of the '$expand' query parameter.
//
// Version added: v1.3.0
NoLinks bool
// managerProvidingService is the URI for ManagerProvidingService.
ManagerProvidingService string
// sessions is the URI for Sessions.
Sessions string
}
Expand shall contain information about the support of the '$expand' query parameter by the service.
type ProtocolFeaturesSupported ¶
type ProtocolFeaturesSupported struct {
// DeepOperations shall contain information about deep operations that the
// service supports.
//
// Version added: v1.7.0
DeepOperations DeepOperations
// ExcerptQuery shall indicate whether this service supports the 'excerpt'
// query parameter.
//
// Version added: v1.4.0
ExcerptQuery bool
// ExpandQuery shall contain information about the support of the '$expand'
// query parameter by the service.
//
// Version added: v1.3.0
ExpandQuery Expand
// FilterQuery shall indicate whether this service supports the '$filter' query
// parameter.
//
// Version added: v1.3.0
FilterQuery bool
// FilterQueryComparisonOperations shall indicate whether the service supports
// the 'eq', 'ge', 'gt', 'le', 'lt', and 'ne' options for the '$filter' query
// parameter. This property shall not be present if 'FilterQuery' contains
// 'false'.
//
// Version added: v1.17.0
FilterQueryComparisonOperations bool
// FilterQueryCompoundOperations shall indicate whether the service supports
// the Redfish Specification-defined grouping operators '()', 'and', 'not', and
// 'or' options for the '$filter' query parameter. This property shall not be
// present if 'FilterQuery' contains 'false'.
//
// Version added: v1.17.0
FilterQueryCompoundOperations bool
// IncludeOriginOfConditionQuery shall indicate whether the service supports
// the 'includeoriginofcondition' query parameter.
//
// Version added: v1.18.0
IncludeOriginOfConditionQuery bool
// MultipleHTTPRequests shall indicate whether this service supports multiple
// outstanding HTTP requests.
//
// Version added: v1.14.0
MultipleHTTPRequests bool
// OnlyMemberQuery shall indicate whether this service supports the 'only'
// query parameter.
//
// Version added: v1.4.0
OnlyMemberQuery bool
// SelectQuery shall indicate whether this service supports the '$select' query
// parameter.
//
// Version added: v1.3.0
SelectQuery bool
// TopSkipQuery shall indicate whether this service supports both the '$top'
// and '$skip' query parameters.
//
// Version added: v1.17.0
TopSkipQuery bool
}
ProtocolFeaturesSupported shall contain information about protocol features that the service supports.
type Service ¶
type Service struct {
schemas.Entity
// ODataContext is the odata context.
ODataContext string `json:"@odata.context"`
// ODataType is the odata type.
ODataType string `json:"@odata.type"`
// OEM shall contain the OEM extensions. All values for properties that this
// object contains shall conform to the Redfish Specification-described
// requirements.
OEM json.RawMessage `json:"Oem"`
// Product shall include the name of the product represented by this Redfish
// service.
//
// Version added: v1.3.0
Product string
// ProtocolFeaturesSupported shall contain information about protocol features
// that the service supports.
//
// Version added: v1.3.0
ProtocolFeaturesSupported ProtocolFeaturesSupported
// RedfishVersion shall represent the Redfish protocol version, as specified in
// the 'Protocol version' clause of the Redfish Specification, to which this
// service conforms.
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 the value of the 'ServiceIdentification' property in
// the 'Manager' resource providing the Redfish service root resource is an
// empty string or 'null'.
//
// Version added: v1.14.0
ServiceIdentification string
// ServiceUseNotification shall contain the usage notification message for this
// service. The value of the property shall contain the value of the
// 'ServiceUseNotification' property in the 'Manager' resource providing the
// Redfish service root resource. This property shall not be present if the
// value of the 'ServiceUseNotification' property in the 'Manager' resource
// providing the Redfish service root resource is an empty string or 'null'.
//
// Version added: v1.20.0
ServiceUseNotification string
// UUID shall contain the identifier of the Redfish service instance. If SSDP
// is used, this value shall contain the same UUID returned in an HTTP '200 OK'
// response from an SSDP 'M-SEARCH' request during discovery. RFC4122 describes
// methods to use 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 subfields 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 'Product' property value.
//
// Version added: v1.5.0
Vendor string
// contains filtered or unexported fields
}
Service shall represent the root of the Redfish service.
func ServiceRoot ¶
ServiceRoot will get a Service instance from the service.
func (*Service) AccountService ¶
func (s *Service) AccountService() (*schemas.AccountService, error)
AccountService gets the AccountService linked resource.
func (*Service) AggregationService ¶ added in v0.16.0
func (s *Service) AggregationService() (*schemas.AggregationService, error)
AggregationService gets the AggregationService linked resource.
func (*Service) AutomationNodes ¶ added in v0.21.0
func (s *Service) AutomationNodes() ([]*schemas.AutomationNode, error)
AutomationNodes gets the AutomationNodes collection.
func (*Service) CertificateService ¶ added in v0.16.0
func (s *Service) CertificateService() (*schemas.CertificateService, error)
CertificateService gets the CertificateService linked resource.
func (*Service) ComponentIntegrity ¶ added in v0.16.0
func (s *Service) ComponentIntegrity() ([]*schemas.ComponentIntegrity, error)
ComponentIntegrity gets the ComponentIntegrity collection.
func (*Service) CompositionService ¶
func (s *Service) CompositionService() (*schemas.CompositionService, error)
CompositionService gets the CompositionService linked resource.
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 (s *Service) EventService() (*schemas.EventService, error)
EventService gets the EventService linked resource.
func (*Service) Facilities ¶ added in v0.16.0
Facilities gets the Facilities collection.
func (*Service) JSONSchemas ¶ added in v0.21.0
func (s *Service) JSONSchemas() ([]*schemas.JSONSchemaFile, error)
JSONSchemas gets the JSONSchemas collection.
func (*Service) JobService ¶ added in v0.15.0
func (s *Service) JobService() (*schemas.JobService, error)
JobService gets the JobService linked resource.
func (*Service) KeyService ¶ added in v0.16.0
func (s *Service) KeyService() (*schemas.KeyService, error)
KeyService gets the KeyService linked resource.
func (*Service) LicenseService ¶ added in v0.16.0
func (s *Service) LicenseService() (*schemas.LicenseService, error)
LicenseService gets the LicenseService linked resource.
func (*Service) ManagerProvidingService ¶ added in v0.16.0
ManagerProvidingService gets the ManagerProvidingService linked resource.
func (*Service) NVMeDomains ¶ added in v0.21.0
func (s *Service) NVMeDomains() ([]*schemas.NVMeDomain, error)
NVMeDomains gets the NVMeDomains collection.
func (*Service) PowerEquipment ¶ added in v0.15.0
func (s *Service) PowerEquipment() (*schemas.PowerEquipment, error)
PowerEquipment gets the PowerEquipment linked resource.
func (*Service) RegisteredClients ¶ added in v0.16.0
func (s *Service) RegisteredClients() ([]*schemas.RegisteredClient, error)
RegisteredClients gets the RegisteredClients collection.
func (*Service) Registries ¶ added in v0.8.0
func (s *Service) Registries() ([]*schemas.MessageRegistryFile, error)
Registries gets the Registries collection.
func (*Service) ResourceBlocks ¶ added in v0.16.0
func (s *Service) ResourceBlocks() ([]*schemas.ResourceBlock, error)
ResourceBlocks gets the ResourceBlocks collection.
func (*Service) ServiceConditions ¶ added in v0.16.0
func (s *Service) ServiceConditions() (*schemas.ServiceConditions, error)
ServiceConditions gets the ServiceConditions linked resource.
func (*Service) SessionService ¶ added in v0.16.0
func (s *Service) SessionService() (*schemas.SessionService, error)
SessionService gets the SessionService linked resource.
func (*Service) StorageServices ¶
func (s *Service) StorageServices() ([]*schemas.StorageService, error)
StorageServices gets the StorageServices collection.
func (*Service) StorageSystems ¶
func (s *Service) StorageSystems() ([]*schemas.ComputerSystem, error)
StorageSystems gets the StorageSystems collection.
func (*Service) Systems ¶
func (s *Service) Systems() ([]*schemas.ComputerSystem, error)
Systems gets the Systems collection.
func (*Service) Tasks ¶
func (s *Service) Tasks() (*schemas.TaskService, error)
Tasks gets the Tasks linked resource.
func (*Service) TelemetryService ¶ added in v0.16.0
func (s *Service) TelemetryService() (*schemas.TelemetryService, error)
TelemetryService gets the TelemetryService linked resource.
func (*Service) ThermalEquipment ¶ added in v0.16.0
func (s *Service) ThermalEquipment() (*schemas.ThermalEquipment, error)
ThermalEquipment gets the ThermalEquipment linked resource.
func (*Service) UnmarshalJSON ¶
UnmarshalJSON unmarshals a Service object from the raw JSON.
func (*Service) UpdateService ¶ added in v0.6.0
func (s *Service) UpdateService() (*schemas.UpdateService, error)
UpdateService gets the UpdateService linked resource.
