github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/signed_uri.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package mono_models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "context" 10 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/strfmt" 13 "github.com/go-openapi/swag" 14 "github.com/go-openapi/validate" 15 ) 16 17 // SignedURI signed URI 18 // 19 // swagger:model SignedURI 20 type SignedURI struct { 21 22 // URI 23 // Format: uri 24 URI strfmt.URI `json:"URI,omitempty"` 25 26 // expires 27 // Format: date-time 28 Expires strfmt.DateTime `json:"expires,omitempty"` 29 } 30 31 // Validate validates this signed URI 32 func (m *SignedURI) Validate(formats strfmt.Registry) error { 33 var res []error 34 35 if err := m.validateURI(formats); err != nil { 36 res = append(res, err) 37 } 38 39 if err := m.validateExpires(formats); err != nil { 40 res = append(res, err) 41 } 42 43 if len(res) > 0 { 44 return errors.CompositeValidationError(res...) 45 } 46 return nil 47 } 48 49 func (m *SignedURI) validateURI(formats strfmt.Registry) error { 50 if swag.IsZero(m.URI) { // not required 51 return nil 52 } 53 54 if err := validate.FormatOf("URI", "body", "uri", m.URI.String(), formats); err != nil { 55 return err 56 } 57 58 return nil 59 } 60 61 func (m *SignedURI) validateExpires(formats strfmt.Registry) error { 62 if swag.IsZero(m.Expires) { // not required 63 return nil 64 } 65 66 if err := validate.FormatOf("expires", "body", "date-time", m.Expires.String(), formats); err != nil { 67 return err 68 } 69 70 return nil 71 } 72 73 // ContextValidate validates this signed URI based on context it is used 74 func (m *SignedURI) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 75 return nil 76 } 77 78 // MarshalBinary interface implementation 79 func (m *SignedURI) MarshalBinary() ([]byte, error) { 80 if m == nil { 81 return nil, nil 82 } 83 return swag.WriteJSON(m) 84 } 85 86 // UnmarshalBinary interface implementation 87 func (m *SignedURI) UnmarshalBinary(b []byte) error { 88 var res SignedURI 89 if err := swag.ReadJSON(b, &res); err != nil { 90 return err 91 } 92 *m = res 93 return nil 94 }