github.com/minio/console@v1.3.0/models/set_notification_endpoint_response.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  
    28  	"github.com/go-openapi/errors"
    29  	"github.com/go-openapi/strfmt"
    30  	"github.com/go-openapi/swag"
    31  	"github.com/go-openapi/validate"
    32  )
    33  
    34  // SetNotificationEndpointResponse set notification endpoint response
    35  //
    36  // swagger:model setNotificationEndpointResponse
    37  type SetNotificationEndpointResponse struct {
    38  
    39  	// account id
    40  	// Required: true
    41  	AccountID *string `json:"account_id"`
    42  
    43  	// properties
    44  	// Required: true
    45  	Properties map[string]string `json:"properties"`
    46  
    47  	// restart
    48  	Restart bool `json:"restart,omitempty"`
    49  
    50  	// service
    51  	// Required: true
    52  	Service *NofiticationService `json:"service"`
    53  }
    54  
    55  // Validate validates this set notification endpoint response
    56  func (m *SetNotificationEndpointResponse) Validate(formats strfmt.Registry) error {
    57  	var res []error
    58  
    59  	if err := m.validateAccountID(formats); err != nil {
    60  		res = append(res, err)
    61  	}
    62  
    63  	if err := m.validateProperties(formats); err != nil {
    64  		res = append(res, err)
    65  	}
    66  
    67  	if err := m.validateService(formats); err != nil {
    68  		res = append(res, err)
    69  	}
    70  
    71  	if len(res) > 0 {
    72  		return errors.CompositeValidationError(res...)
    73  	}
    74  	return nil
    75  }
    76  
    77  func (m *SetNotificationEndpointResponse) validateAccountID(formats strfmt.Registry) error {
    78  
    79  	if err := validate.Required("account_id", "body", m.AccountID); err != nil {
    80  		return err
    81  	}
    82  
    83  	return nil
    84  }
    85  
    86  func (m *SetNotificationEndpointResponse) validateProperties(formats strfmt.Registry) error {
    87  
    88  	if err := validate.Required("properties", "body", m.Properties); err != nil {
    89  		return err
    90  	}
    91  
    92  	return nil
    93  }
    94  
    95  func (m *SetNotificationEndpointResponse) validateService(formats strfmt.Registry) error {
    96  
    97  	if err := validate.Required("service", "body", m.Service); err != nil {
    98  		return err
    99  	}
   100  
   101  	if err := validate.Required("service", "body", m.Service); err != nil {
   102  		return err
   103  	}
   104  
   105  	if m.Service != nil {
   106  		if err := m.Service.Validate(formats); err != nil {
   107  			if ve, ok := err.(*errors.Validation); ok {
   108  				return ve.ValidateName("service")
   109  			} else if ce, ok := err.(*errors.CompositeError); ok {
   110  				return ce.ValidateName("service")
   111  			}
   112  			return err
   113  		}
   114  	}
   115  
   116  	return nil
   117  }
   118  
   119  // ContextValidate validate this set notification endpoint response based on the context it is used
   120  func (m *SetNotificationEndpointResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   121  	var res []error
   122  
   123  	if err := m.contextValidateService(ctx, formats); err != nil {
   124  		res = append(res, err)
   125  	}
   126  
   127  	if len(res) > 0 {
   128  		return errors.CompositeValidationError(res...)
   129  	}
   130  	return nil
   131  }
   132  
   133  func (m *SetNotificationEndpointResponse) contextValidateService(ctx context.Context, formats strfmt.Registry) error {
   134  
   135  	if m.Service != nil {
   136  
   137  		if err := m.Service.ContextValidate(ctx, formats); err != nil {
   138  			if ve, ok := err.(*errors.Validation); ok {
   139  				return ve.ValidateName("service")
   140  			} else if ce, ok := err.(*errors.CompositeError); ok {
   141  				return ce.ValidateName("service")
   142  			}
   143  			return err
   144  		}
   145  	}
   146  
   147  	return nil
   148  }
   149  
   150  // MarshalBinary interface implementation
   151  func (m *SetNotificationEndpointResponse) MarshalBinary() ([]byte, error) {
   152  	if m == nil {
   153  		return nil, nil
   154  	}
   155  	return swag.WriteJSON(m)
   156  }
   157  
   158  // UnmarshalBinary interface implementation
   159  func (m *SetNotificationEndpointResponse) UnmarshalBinary(b []byte) error {
   160  	var res SetNotificationEndpointResponse
   161  	if err := swag.ReadJSON(b, &res); err != nil {
   162  		return err
   163  	}
   164  	*m = res
   165  	return nil
   166  }