github.com/minio/console@v1.4.1/models/bucket_encryption_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  // BucketEncryptionType bucket encryption type
    35  //
    36  // swagger:model bucketEncryptionType
    37  type BucketEncryptionType string
    38  
    39  func NewBucketEncryptionType(value BucketEncryptionType) *BucketEncryptionType {
    40  	return &value
    41  }
    42  
    43  // Pointer returns a pointer to a freshly-allocated BucketEncryptionType.
    44  func (m BucketEncryptionType) Pointer() *BucketEncryptionType {
    45  	return &m
    46  }
    47  
    48  const (
    49  
    50  	// BucketEncryptionTypeSseDashS3 captures enum value "sse-s3"
    51  	BucketEncryptionTypeSseDashS3 BucketEncryptionType = "sse-s3"
    52  
    53  	// BucketEncryptionTypeSseDashKms captures enum value "sse-kms"
    54  	BucketEncryptionTypeSseDashKms BucketEncryptionType = "sse-kms"
    55  )
    56  
    57  // for schema
    58  var bucketEncryptionTypeEnum []interface{}
    59  
    60  func init() {
    61  	var res []BucketEncryptionType
    62  	if err := json.Unmarshal([]byte(`["sse-s3","sse-kms"]`), &res); err != nil {
    63  		panic(err)
    64  	}
    65  	for _, v := range res {
    66  		bucketEncryptionTypeEnum = append(bucketEncryptionTypeEnum, v)
    67  	}
    68  }
    69  
    70  func (m BucketEncryptionType) validateBucketEncryptionTypeEnum(path, location string, value BucketEncryptionType) error {
    71  	if err := validate.EnumCase(path, location, value, bucketEncryptionTypeEnum, true); err != nil {
    72  		return err
    73  	}
    74  	return nil
    75  }
    76  
    77  // Validate validates this bucket encryption type
    78  func (m BucketEncryptionType) Validate(formats strfmt.Registry) error {
    79  	var res []error
    80  
    81  	// value enum
    82  	if err := m.validateBucketEncryptionTypeEnum("", "body", m); err != nil {
    83  		return err
    84  	}
    85  
    86  	if len(res) > 0 {
    87  		return errors.CompositeValidationError(res...)
    88  	}
    89  	return nil
    90  }
    91  
    92  // ContextValidate validates this bucket encryption type based on context it is used
    93  func (m BucketEncryptionType) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    94  	return nil
    95  }