github.com/minio/console@v1.4.1/models/notification_event_type.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // This file is part of MinIO Console Server
     4  // Copyright (c) 2023 MinIO, Inc.
     5  //
     6  // This program is free software: you can redistribute it and/or modify
     7  // it under the terms of the GNU Affero General Public License as published by
     8  // the Free Software Foundation, either version 3 of the License, or
     9  // (at your option) any later version.
    10  //
    11  // This program is distributed in the hope that it will be useful,
    12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  // GNU Affero General Public License for more details.
    15  //
    16  // You should have received a copy of the GNU Affero General Public License
    17  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    18  //
    19  
    20  package models
    21  
    22  // This file was generated by the swagger tool.
    23  // Editing this file might prove futile when you re-run the swagger generate command
    24  
    25  import (
    26  	"context"
    27  	"encoding/json"
    28  
    29  	"github.com/go-openapi/errors"
    30  	"github.com/go-openapi/strfmt"
    31  	"github.com/go-openapi/validate"
    32  )
    33  
    34  // NotificationEventType notification event type
    35  //
    36  // swagger:model notificationEventType
    37  type NotificationEventType string
    38  
    39  func NewNotificationEventType(value NotificationEventType) *NotificationEventType {
    40  	return &value
    41  }
    42  
    43  // Pointer returns a pointer to a freshly-allocated NotificationEventType.
    44  func (m NotificationEventType) Pointer() *NotificationEventType {
    45  	return &m
    46  }
    47  
    48  const (
    49  
    50  	// NotificationEventTypePut captures enum value "put"
    51  	NotificationEventTypePut NotificationEventType = "put"
    52  
    53  	// NotificationEventTypeDelete captures enum value "delete"
    54  	NotificationEventTypeDelete NotificationEventType = "delete"
    55  
    56  	// NotificationEventTypeGet captures enum value "get"
    57  	NotificationEventTypeGet NotificationEventType = "get"
    58  
    59  	// NotificationEventTypeReplica captures enum value "replica"
    60  	NotificationEventTypeReplica NotificationEventType = "replica"
    61  
    62  	// NotificationEventTypeIlm captures enum value "ilm"
    63  	NotificationEventTypeIlm NotificationEventType = "ilm"
    64  
    65  	// NotificationEventTypeScanner captures enum value "scanner"
    66  	NotificationEventTypeScanner NotificationEventType = "scanner"
    67  )
    68  
    69  // for schema
    70  var notificationEventTypeEnum []interface{}
    71  
    72  func init() {
    73  	var res []NotificationEventType
    74  	if err := json.Unmarshal([]byte(`["put","delete","get","replica","ilm","scanner"]`), &res); err != nil {
    75  		panic(err)
    76  	}
    77  	for _, v := range res {
    78  		notificationEventTypeEnum = append(notificationEventTypeEnum, v)
    79  	}
    80  }
    81  
    82  func (m NotificationEventType) validateNotificationEventTypeEnum(path, location string, value NotificationEventType) error {
    83  	if err := validate.EnumCase(path, location, value, notificationEventTypeEnum, true); err != nil {
    84  		return err
    85  	}
    86  	return nil
    87  }
    88  
    89  // Validate validates this notification event type
    90  func (m NotificationEventType) Validate(formats strfmt.Registry) error {
    91  	var res []error
    92  
    93  	// value enum
    94  	if err := m.validateNotificationEventTypeEnum("", "body", m); err != nil {
    95  		return err
    96  	}
    97  
    98  	if len(res) > 0 {
    99  		return errors.CompositeValidationError(res...)
   100  	}
   101  	return nil
   102  }
   103  
   104  // ContextValidate validates this notification event type based on context it is used
   105  func (m NotificationEventType) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   106  	return nil
   107  }