github.com/minio/console@v1.4.1/api/operations/bucket/delete_bucket_event_parameters.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 bucket
    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  	"io"
    27  	"net/http"
    28  
    29  	"github.com/go-openapi/errors"
    30  	"github.com/go-openapi/runtime"
    31  	"github.com/go-openapi/runtime/middleware"
    32  	"github.com/go-openapi/strfmt"
    33  	"github.com/go-openapi/validate"
    34  
    35  	"github.com/minio/console/models"
    36  )
    37  
    38  // NewDeleteBucketEventParams creates a new DeleteBucketEventParams object
    39  //
    40  // There are no default values defined in the spec.
    41  func NewDeleteBucketEventParams() DeleteBucketEventParams {
    42  
    43  	return DeleteBucketEventParams{}
    44  }
    45  
    46  // DeleteBucketEventParams contains all the bound params for the delete bucket event operation
    47  // typically these are obtained from a http.Request
    48  //
    49  // swagger:parameters DeleteBucketEvent
    50  type DeleteBucketEventParams struct {
    51  
    52  	// HTTP Request Object
    53  	HTTPRequest *http.Request `json:"-"`
    54  
    55  	/*
    56  	  Required: true
    57  	  In: path
    58  	*/
    59  	Arn string
    60  	/*
    61  	  Required: true
    62  	  In: body
    63  	*/
    64  	Body *models.NotificationDeleteRequest
    65  	/*
    66  	  Required: true
    67  	  In: path
    68  	*/
    69  	BucketName string
    70  }
    71  
    72  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    73  // for simple values it will use straight method calls.
    74  //
    75  // To ensure default values, the struct must have been initialized with NewDeleteBucketEventParams() beforehand.
    76  func (o *DeleteBucketEventParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    77  	var res []error
    78  
    79  	o.HTTPRequest = r
    80  
    81  	rArn, rhkArn, _ := route.Params.GetOK("arn")
    82  	if err := o.bindArn(rArn, rhkArn, route.Formats); err != nil {
    83  		res = append(res, err)
    84  	}
    85  
    86  	if runtime.HasBody(r) {
    87  		defer r.Body.Close()
    88  		var body models.NotificationDeleteRequest
    89  		if err := route.Consumer.Consume(r.Body, &body); err != nil {
    90  			if err == io.EOF {
    91  				res = append(res, errors.Required("body", "body", ""))
    92  			} else {
    93  				res = append(res, errors.NewParseError("body", "body", "", err))
    94  			}
    95  		} else {
    96  			// validate body object
    97  			if err := body.Validate(route.Formats); err != nil {
    98  				res = append(res, err)
    99  			}
   100  
   101  			ctx := validate.WithOperationRequest(r.Context())
   102  			if err := body.ContextValidate(ctx, route.Formats); err != nil {
   103  				res = append(res, err)
   104  			}
   105  
   106  			if len(res) == 0 {
   107  				o.Body = &body
   108  			}
   109  		}
   110  	} else {
   111  		res = append(res, errors.Required("body", "body", ""))
   112  	}
   113  
   114  	rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name")
   115  	if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil {
   116  		res = append(res, err)
   117  	}
   118  	if len(res) > 0 {
   119  		return errors.CompositeValidationError(res...)
   120  	}
   121  	return nil
   122  }
   123  
   124  // bindArn binds and validates parameter Arn from path.
   125  func (o *DeleteBucketEventParams) bindArn(rawData []string, hasKey bool, formats strfmt.Registry) error {
   126  	var raw string
   127  	if len(rawData) > 0 {
   128  		raw = rawData[len(rawData)-1]
   129  	}
   130  
   131  	// Required: true
   132  	// Parameter is provided by construction from the route
   133  	o.Arn = raw
   134  
   135  	return nil
   136  }
   137  
   138  // bindBucketName binds and validates parameter BucketName from path.
   139  func (o *DeleteBucketEventParams) bindBucketName(rawData []string, hasKey bool, formats strfmt.Registry) error {
   140  	var raw string
   141  	if len(rawData) > 0 {
   142  		raw = rawData[len(rawData)-1]
   143  	}
   144  
   145  	// Required: true
   146  	// Parameter is provided by construction from the route
   147  	o.BucketName = raw
   148  
   149  	return nil
   150  }