forked from ODIM-Project/ODIM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
251 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,12 +30,29 @@ type EventType string | |
// defined in the message registry with a value more applicable to the implementation. | ||
type MessageSeverity string | ||
|
||
//The subscription type for events. | ||
// The authentication protocol for SNMPv3. | ||
type SNMPAuthenticationProtocols string | ||
|
||
// the SNMPv3 encryption protocol. | ||
type SNMPEncryptionProtocols string | ||
|
||
// The subscription type for events. | ||
type SubscriptionType string | ||
|
||
//DeliveryRetryPolicy - The subscription delivery retry policy for events, where the subscription type is RedfishEvent. | ||
type DeliveryRetryPolicy string | ||
|
||
// This property shall contain the types of programs that can log messages. | ||
// If this property contains an empty array or is absent, all facilities | ||
// shall be indicated. Facility values are described in the RFC5424. | ||
type SyslogFacility string | ||
|
||
// This property shall contain the lowest syslog severity level | ||
// that will be forwarded. The service shall forward all messages | ||
// equal to or greater than the value in this property. The value | ||
// `All` shall indicate all severities. | ||
type SyslogSeverity string | ||
|
||
const ( | ||
// EventTypeAlert - "Alert": "A condition requires attention." | ||
EventTypeAlert EventType = "Alert" | ||
|
@@ -68,6 +85,39 @@ const ( | |
// MessageSeverityWarning - "Warning": "A condition requires attention." | ||
MessageSeverityWarning MessageSeverity = "Warning" | ||
|
||
// authentication using SNMP community strings and the value of TrapCommunity. | ||
SNMPAuthenticationProtocolsCommunityString SNMPAuthenticationProtocols = "CommunityString" | ||
|
||
// authentication for SNMPv3 access conforms to the RFC7860-defined usmHMAC128SHA224AuthProtocol. | ||
SNMPAuthenticationProtocolsHMAC128_SHA224 SNMPAuthenticationProtocols = "HMAC128_SHA224" | ||
|
||
// authentication for SNMPv3 access conforms to the RFC7860-defined usmHMAC192SHA256AuthProtocol. | ||
SNMPAuthenticationProtocolsHMAC192_SHA256 SNMPAuthenticationProtocols = "HMAC192_SHA256" | ||
|
||
// authentication for SNMPv3 access conforms to the RFC7860-defined usmHMAC256SHA384AuthProtocol. | ||
SNMPAuthenticationProtocolsHMAC256_SHA384 SNMPAuthenticationProtocols = "HMAC256_SHA384" | ||
|
||
// authentication for SNMPv3 access conforms to the RFC7860-defined usmHMAC384SHA512AuthProtocol. | ||
SNMPAuthenticationProtocolsHMAC384_SHA512 SNMPAuthenticationProtocols = "HMAC384_SHA512" | ||
|
||
// authentication conforms to the RFC1321-defined HMAC-MD5-96 authentication protocol. | ||
SNMPAuthenticationProtocolsHMAC_MD5 SNMPAuthenticationProtocols = "HMAC_MD5" | ||
|
||
// authentication conforms to the RFC3414-defined HMAC-SHA-96 authentication protocol. | ||
SNMPAuthenticationProtocolsHMAC_SHA96 SNMPAuthenticationProtocols = "HMAC_SHA96" | ||
|
||
// authentication is not required. | ||
SNMPAuthenticationProtocolsNone SNMPAuthenticationProtocols = "None" | ||
|
||
// encryption conforms to the RFC3414-defined CBC-DES encryption protocol. | ||
SNMPEncryptionProtocolsCBC_DES SNMPEncryptionProtocols = "CBC_DES" | ||
|
||
// encryption conforms to the RFC3414-defined CFB128-AES-128 encryption protocol. | ||
SNMPEncryptionProtocolsCFB128_AES128 SNMPEncryptionProtocols = "CFB128_AES128" | ||
|
||
// there is no encryption. | ||
SNMPEncryptionProtocolsNone SNMPEncryptionProtocols = "None" | ||
|
||
// Subscription Types for events. Currently ODIM only support subscriptions | ||
// of type RedFishTypeEvent. | ||
// SubscriptionTypeRedFishEvent - The subscription follows the Redfish | ||
|
@@ -114,6 +164,105 @@ const ( | |
// DeliveryTerminateAfterRetries : The subscription is terminated after the | ||
// maximum number of retries is reached. | ||
DeliveryTerminateAfterRetries DeliveryRetryPolicy = "TerminateAfterRetries" | ||
|
||
// Security/authentication messages. | ||
SyslogFacilityAuth SyslogFacility = "Auth" | ||
|
||
// Security/authentication messages. | ||
SyslogFacilityAuthpriv SyslogFacility = "Authpriv" | ||
|
||
//Log alert. | ||
SyslogFacilityConsole SyslogFacility = "Console" | ||
|
||
//Clock daemon. | ||
SyslogFacilityCron SyslogFacility = "Cron" | ||
|
||
//System daemons. | ||
SyslogFacilityDaemon SyslogFacility = "Daemon" | ||
|
||
//FTP daemon. | ||
SyslogFacilityFTP SyslogFacility = "FTP" | ||
|
||
//Kernel messages. | ||
SyslogFacilityKern SyslogFacility = "Kern" | ||
|
||
//Line printer subsystem. | ||
SyslogFacilityLPR SyslogFacility = "LPR" | ||
|
||
//Locally used facility 0. | ||
SyslogFacilityLocal0 SyslogFacility = "Local0" | ||
|
||
//Locally used facility 1. | ||
SyslogFacilityLocal1 SyslogFacility = "Local1" | ||
|
||
//Locally used facility 2. | ||
SyslogFacilityLocal2 SyslogFacility = "Local2" | ||
|
||
//Locally used facility 3. | ||
SyslogFacilityLocal3 SyslogFacility = "Local3" | ||
|
||
//Locally used facility 4. | ||
SyslogFacilityLocal4 SyslogFacility = "Local4" | ||
|
||
//Locally used facility 5. | ||
SyslogFacilityLocal5 SyslogFacility = "Local5" | ||
|
||
//Locally used facility 6. | ||
SyslogFacilityLocal6 SyslogFacility = "Local6" | ||
|
||
//Locally used facility 7. | ||
SyslogFacilityLocal7 SyslogFacility = "Local7" | ||
|
||
//Mail system. | ||
SyslogFacilityMail SyslogFacility = "Mail" | ||
|
||
//NTP subsystem. | ||
SyslogFacilityNTP SyslogFacility = "NTP" | ||
|
||
//Network news subsystem. | ||
SyslogFacilityNews SyslogFacility = "News" | ||
|
||
//Log audit. | ||
SyslogFacilitySecurity SyslogFacility = "Security" | ||
|
||
//Scheduling daemon. | ||
SyslogFacilitySolarisCron SyslogFacility = "SolarisCron" | ||
|
||
//Messages generated internally by syslogd. | ||
SyslogFacilitySyslog SyslogFacility = "Syslog" | ||
|
||
//UUCP subsystem. | ||
SyslogFacilityUUCP SyslogFacility = "UUCP" | ||
|
||
//User-level messages. | ||
SyslogFacilityUser SyslogFacility = "User" | ||
|
||
// A condition that should be corrected immediately, such as a corrupted system database. | ||
SyslogSeverityAlert SyslogSeverity = "Alert" | ||
|
||
// A message of any severity. | ||
SyslogSeverityAll SyslogSeverity = "All" | ||
|
||
// Hard device errors. | ||
SyslogSeverityCritical SyslogSeverity = "Critical" | ||
|
||
// Messages that contain information normally of use only when debugging a program. | ||
SyslogSeverityDebug SyslogSeverity = "Debug" | ||
|
||
// A panic condition. | ||
SyslogSeverityEmergency SyslogSeverity = "Emergency" | ||
|
||
// An Error. | ||
SyslogSeverityError SyslogSeverity = "Error" | ||
|
||
// Informational only. | ||
SyslogSeverityInformational SyslogSeverity = "Informational" | ||
|
||
// Conditions that are not error conditions, but that may require special handling. | ||
SyslogSeverityNotice SyslogSeverity = "Notice" | ||
|
||
// A Warning. | ||
SyslogSeverityWarning SyslogSeverity = "Warning" | ||
) | ||
|
||
func (subscriptionType SubscriptionType) IsValidSubscriptionType() bool { | ||
|
@@ -204,23 +353,97 @@ type EventRecord struct { | |
LogEntry *Link `json:"LogEntry,omitempty"` | ||
} | ||
|
||
// This Resource shall represent the target of an event subscription, including | ||
// the event types and context to provide to the target in the Event payload. | ||
// Refer to EventDestination.v1_11_2.json of the redfish spec for more details | ||
// EventDestination represents the target of an event subscription, | ||
// including the event types and context to provide to the target | ||
// in the Event payload. | ||
// Reference : EventDestination.v1_12_0.json | ||
type EventDestination struct { | ||
Context string `json:"Context"` | ||
EventTypes []string `json:"EventTypes"` | ||
EventFormatType string `json:"EventFormatType"` | ||
ExcludeMessageIds []string `json:"ExcludeMessageIds,omitempty"` | ||
ExcludeRegistryPrefixes []string `json:"ExcludeRegistryPrefixes,omitempty"` | ||
DeliveryRetryPolicy DeliveryRetryPolicy `json:"DeliveryRetryPolicy"` | ||
Destination string `json:"Destination"` | ||
Id string `json:"id"` | ||
MessageIds []string `json:"MessageIds"` | ||
Name string `json:"Name"` | ||
OriginResources []string `json:"OriginResources"` | ||
Protocol string `json:"Protocol"` | ||
ResourceTypes []string `json:"ResourceTypes"` | ||
SubscriptionType SubscriptionType `json:"SubscriptionType"` | ||
SubordinateResources bool `json:"SubordinateResources"` | ||
ODataContext string `json:"@odata.context,omitempty"` | ||
ODataEtag string `json:"@odata.etag,omitempty"` | ||
ODataId string `json:"@odata.id"` | ||
ODataType string `json:"@odata.type"` | ||
Actions *Actions `json:"Actions,omitempty"` | ||
Certificates *Link `json:"Certificates,omitempty"` | ||
ClientCertificates *Link `json:"ClientCertificates,omitempty"` | ||
Context string `json:"Context"` | ||
DeliveryRetryPolicy DeliveryRetryPolicy `json:"DeliveryRetryPolicy,omitempty"` | ||
Description string `json:"Description,omitempty"` | ||
Destination string `json:"Destination"` | ||
EventFormatType string `json:"EventFormatType,omitempty"` | ||
EventTypes []string `json:"EventTypes,omitempty"` | ||
ExcludeMessageIds []string `json:"ExcludeMessageIds,omitempty"` | ||
ExcludeRegistryPrefixes []string `json:"ExcludeRegistryPrefixes,omitempty"` | ||
HeartbeatIntervalMins int `json:"HeartbeatIntervalMinutes,omitempty"` | ||
HttpHeaders []string `json:"HttpHeaders,omitempty"` | ||
ID string `json:"Id"` | ||
IncludeOriginOfCondition bool `json:"IncludeOriginOfCondition,omitempty"` | ||
MessageIds []string `json:"MessageIds,omitempty"` | ||
MetricReportDefinitions *Link `json:"MetricReportDefinitions,omitempty"` | ||
MetricReportDefinitionsCount int `json:[email protected],omitempty` | ||
Name string `json:"Name"` | ||
OEMProtocol string `json:"OEMProtocol,omitempty"` | ||
OEMSubscriptionType string `json:"OEMSubscriptionType"` | ||
Oem interface{} `json:"Oem,omitempty"` | ||
OriginResources []string `json:"OriginResources,omitempty"` | ||
OriginResourcesCount int `json:[email protected],omitempty` | ||
Protocol string `json:"Protocol"` | ||
RegistryPrefixes []string `json:"RegistryPrefixes,omitempty"` | ||
ResourceTypes []string `json:"ResourceTypes,omitempty"` | ||
SNMP SNMPSettings `json:"SNMP,omitempty"` | ||
SendHeartbeat bool `json:"SendHeartbeat,omitempty"` | ||
Status Status `json:"Status,omitempty"` | ||
SubordinateResources bool `json:"SubordinateResources,omitempty"` | ||
SubscriptionType SubscriptionType `json:"SubscriptionType,omitempty"` | ||
SyslogFilters SyslogFilter `json:"SyslogFilters,omitempty"` | ||
VerifyCertificate bool `json:"VerifyCertificate,omitempty"` | ||
} | ||
|
||
// EventDestinationAction contain the available | ||
// actions for this resource.. | ||
// Reference : EventDestination.v1_12_0.json | ||
type EventDestinationAction struct { | ||
ResumeSubscription *ResumeSubscription `json:"ResumeSubscription,omitempty"` | ||
SuspendSubscription *SuspendSubscription `json:"SuspendSubscription,omitempty"` | ||
Oem *OemActions `json:"OemActions,omitempty"` | ||
} | ||
|
||
// This action shall resume a suspended event subscription, | ||
// which affects the subscription status. The service may deliver | ||
// buffered events when the subscription is resumed. | ||
// Reference : EventDestination.v1_12_0.json | ||
type ResumeSubscription struct { | ||
Target string `json:"target,omitempty"` | ||
Title string `json:"title,omitempty"` | ||
} | ||
|
||
// This type shall contain the settings for an SNMP event destination. | ||
// Reference : EventDestination.v1_12_0.json | ||
type SNMPSettings struct { | ||
AuthenticationKey string `json:"AuthenticationKey,omitempty"` | ||
AuthenticationKeySet bool `json:"AuthenticationKeySet,omitempty"` | ||
AuthenticationProtocol SNMPAuthenticationProtocols `json:"AuthenticationProtocol,omitempty"` | ||
EncryptionKey string `json:"EncryptionKey,omitempty"` | ||
EncryptionKeySet bool `json:"EncryptionKeySet,omitempty"` | ||
EncryptionProtocol SNMPEncryptionProtocols `json:"EncryptionProtocol,omitempty"` | ||
TrapCommunity string `json:"TrapCommunity,omitempty"` | ||
} | ||
|
||
// This action shall suspend an event subscription. No events shall be | ||
// sent to the event destination until invocation of the ResumeSubscription | ||
// action. The value of the State property within Status shall contain | ||
// `Disabled` for a suspended subscription. The service may buffer | ||
// events while the subscription is suspended. | ||
// Reference : EventDestination.v1_12_0.json | ||
type SuspendSubscription struct { | ||
Target string `json:"target,omitempty"` | ||
Title string `json:"title,omitempty"` | ||
} | ||
|
||
// A list of filters applied to syslog messages before sending | ||
// to a remote syslog server. An empty list indicates all | ||
// syslog messages are sent. | ||
// Reference : EventDestination.v1_12_0.json | ||
type SyslogFilter struct { | ||
LogFacilities SyslogFacility `json:"LogFacilities,omitempty"` | ||
LowestSeverity SyslogSeverity `json:"LowestSeverity,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters