github.com/percona/percona-xtradb-cluster-operator@v1.14.0/version/client/models/protobuf_any.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package 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/strfmt" 12 "github.com/go-openapi/swag" 13 ) 14 15 // ProtobufAny `Any` contains an arbitrary serialized protocol buffer message along with a 16 // URL that describes the type of the serialized message. 17 // 18 // Protobuf library provides support to pack/unpack Any values in the form 19 // of utility functions or additional generated methods of the Any type. 20 // 21 // Example 1: Pack and unpack a message in C++. 22 // 23 // Foo foo = ...; 24 // Any any; 25 // any.PackFrom(foo); 26 // ... 27 // if (any.UnpackTo(&foo)) { 28 // ... 29 // } 30 // 31 // Example 2: Pack and unpack a message in Java. 32 // 33 // Foo foo = ...; 34 // Any any = Any.pack(foo); 35 // ... 36 // if (any.is(Foo.class)) { 37 // foo = any.unpack(Foo.class); 38 // } 39 // 40 // Example 3: Pack and unpack a message in Python. 41 // 42 // foo = Foo(...) 43 // any = Any() 44 // any.Pack(foo) 45 // ... 46 // if any.Is(Foo.DESCRIPTOR): 47 // any.Unpack(foo) 48 // ... 49 // 50 // Example 4: Pack and unpack a message in Go 51 // 52 // foo := &pb.Foo{...} 53 // any, err := ptypes.MarshalAny(foo) 54 // ... 55 // foo := &pb.Foo{} 56 // if err := ptypes.UnmarshalAny(any, foo); err != nil { 57 // ... 58 // } 59 // 60 // The pack methods provided by protobuf library will by default use 61 // 'type.googleapis.com/full.type.name' as the type URL and the unpack 62 // methods only use the fully qualified type name after the last '/' 63 // in the type URL, for example "foo.bar.com/x/y.z" will yield type 64 // name "y.z". 65 // 66 // JSON 67 // ==== 68 // The JSON representation of an `Any` value uses the regular 69 // representation of the deserialized, embedded message, with an 70 // additional field `@type` which contains the type URL. Example: 71 // 72 // package google.profile; 73 // message Person { 74 // string first_name = 1; 75 // string last_name = 2; 76 // } 77 // 78 // { 79 // "@type": "type.googleapis.com/google.profile.Person", 80 // "firstName": <string>, 81 // "lastName": <string> 82 // } 83 // 84 // If the embedded message type is well-known and has a custom JSON 85 // representation, that representation will be embedded adding a field 86 // `value` which holds the custom JSON in addition to the `@type` 87 // field. Example (for message [google.protobuf.Duration][]): 88 // 89 // { 90 // "@type": "type.googleapis.com/google.protobuf.Duration", 91 // "value": "1.212s" 92 // } 93 // 94 // swagger:model protobufAny 95 type ProtobufAny struct { 96 97 // A URL/resource name that uniquely identifies the type of the serialized 98 // protocol buffer message. This string must contain at least 99 // one "/" character. The last segment of the URL's path must represent 100 // the fully qualified name of the type (as in 101 // `path/google.protobuf.Duration`). The name should be in a canonical form 102 // (e.g., leading "." is not accepted). 103 // 104 // In practice, teams usually precompile into the binary all types that they 105 // expect it to use in the context of Any. However, for URLs which use the 106 // scheme `http`, `https`, or no scheme, one can optionally set up a type 107 // server that maps type URLs to message definitions as follows: 108 // 109 // * If no scheme is provided, `https` is assumed. 110 // * An HTTP GET on the URL must yield a [google.protobuf.Type][] 111 // value in binary format, or produce an error. 112 // * Applications are allowed to cache lookup results based on the 113 // URL, or have them precompiled into a binary to avoid any 114 // lookup. Therefore, binary compatibility needs to be preserved 115 // on changes to types. (Use versioned type names to manage 116 // breaking changes.) 117 // 118 // Note: this functionality is not currently available in the official 119 // protobuf release, and it is not used for type URLs beginning with 120 // type.googleapis.com. 121 // 122 // Schemes other than `http`, `https` (or the empty scheme) might be 123 // used with implementation specific semantics. 124 TypeURL string `json:"typeUrl,omitempty"` 125 126 // Must be a valid serialized protocol buffer of the above specified type. 127 // Format: byte 128 Value strfmt.Base64 `json:"value,omitempty"` 129 } 130 131 // Validate validates this protobuf any 132 func (m *ProtobufAny) Validate(formats strfmt.Registry) error { 133 return nil 134 } 135 136 // ContextValidate validates this protobuf any based on context it is used 137 func (m *ProtobufAny) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 138 return nil 139 } 140 141 // MarshalBinary interface implementation 142 func (m *ProtobufAny) MarshalBinary() ([]byte, error) { 143 if m == nil { 144 return nil, nil 145 } 146 return swag.WriteJSON(m) 147 } 148 149 // UnmarshalBinary interface implementation 150 func (m *ProtobufAny) UnmarshalBinary(b []byte) error { 151 var res ProtobufAny 152 if err := swag.ReadJSON(b, &res); err != nil { 153 return err 154 } 155 *m = res 156 return nil 157 }