Documentation
¶
Index ¶
- func NewNotificationOps(arg NotificationArgs) (*batchv1.Job, error)
- func NotificationJobLabels(owner kmeta.OwnerRefable, action string) map[string]string
- func NotificationJobName(owner kmeta.OwnerRefable, action string) string
- type NotificationActionResult
- type NotificationArgs
- type NotificationOps
- type StorageOps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNotificationOps ¶
func NewNotificationOps(arg NotificationArgs) (*batchv1.Job, error)
NewNotificationOps returns a new batch Job resource.
func NotificationJobLabels ¶
func NotificationJobLabels(owner kmeta.OwnerRefable, action string) map[string]string
NotificationJobLabels creates a label to find a job again. keys is recommended to be (name, kind, action)
func NotificationJobName ¶
func NotificationJobName(owner kmeta.OwnerRefable, action string) string
NotificationJobName creates the name of a notification ops job.
Types ¶
type NotificationActionResult ¶
type NotificationActionResult struct {
// Result is the result the operation attempted.
Result bool `json:"result,omitempty"`
// Error is the error string if failure occurred
Error string `json:"error,omitempty"`
// NotificationId holds the notification ID for GCS
// and is filled in during create operation.
NotificationId string `json:"notificationId,omitempty"`
// Project is the project id that we used (this might have
// been defaulted, to we'll expose it).
ProjectId string `json:"projectId,omitempty"`
}
type NotificationArgs ¶
type NotificationArgs struct {
// UID of the resource that caused the action to be taken. Will
// be added as a label to the podtemplate.
UID string
// Image is the actual binary that we'll run to operate on the
// notification.
Image string
// Action is what the binary should do
Action string
ProjectID string
// Bucket
Bucket string
// TopicID we'll use for pubsub target.
TopicID string
// NotificationId is the notifification ID that GCS gives
// back to us. We need that to delete it.
NotificationId string
// EventTypes is an array of strings specifying which
// event types we want the notification to fire on.
EventTypes []string
// ObjectNamePrefix is an optional filter
ObjectNamePrefix string
// CustomAttributes is the list of additional attributes to have
// GCS supply back to us when it sends a notification.
CustomAttributes map[string]string
Secret corev1.SecretKeySelector
Owner kmeta.OwnerRefable
}
NotificationArgs are the configuration required to make a NewNotificationOps.
type NotificationOps ¶
type NotificationOps struct {
StorageOps
// Action is the operation the job should run.
// Options: [exists, create, delete]
Action string `envconfig:"ACTION" required:"true"`
// Topic is the environment variable containing the PubSub Topic being
// subscribed to's name. In the form that is unique within the project.
// E.g. 'laconia', not 'projects/my-gcp-project/topics/laconia'.
Topic string `envconfig:"PUBSUB_TOPIC_ID" required:"false"`
// Bucket to operate on
Bucket string `envconfig:"BUCKET" required:"true"`
// NotificationId is the environment variable containing the name of the
// subscription to use.
NotificationId string `envconfig:"NOTIFICATION_ID" required:"false" default:""`
// EventTypes is a : separated eventtypes, if omitted all will be used.
// TODO: Look at native envconfig list support
EventTypes string `envconfig:"EVENT_TYPES" required:"false" default:""`
// ObjectNamePrefix is an optional filter for the GCS
ObjectNamePrefix string `envconfig:"OBJECT_NAME_PREFIX" required:"false" default:""`
}
NotificationOps defines the configuration to use for this operation.
type StorageOps ¶
type StorageOps struct {
// Environment variable containing project id.
Project string `envconfig:"PROJECT_ID"`
// Client is the GCS client used by Ops.
Client *storage.Client
}
func (*StorageOps) CreateClient ¶
func (s *StorageOps) CreateClient(ctx context.Context) error
Click to show internal directories.
Click to hide internal directories.