1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
use indexmap::IndexMap;
use serde::{Deserialize, Serialize};
use crate::Schema;
/// Map describing protocol-specific definitions for a message.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
pub struct ChannelBinding {
/// Protocol-specific information for an HTTP channel.
#[serde(skip_serializing_if = "Option::is_none")]
http: Option<HTTPChannelBinding>,
/// Protocol-specific information for a WebSockets channel.
#[serde(skip_serializing_if = "Option::is_none")]
ws: Option<WebsocketsChannelBinding>,
/// Protocol-specific information for a Kafka channel.
#[serde(skip_serializing_if = "Option::is_none")]
kafka: Option<KafkaChannelBinding>,
/// Protocol-specific information for an AMQP 0-9-1 channel.
#[serde(skip_serializing_if = "Option::is_none")]
amqp: Option<AMQPChannelBinding>,
/// Protocol-specific information for an AMQP 1.0 channel.
#[serde(skip_serializing_if = "Option::is_none")]
amqp1: Option<AMQPChannelBinding>,
/// Protocol-specific information for an MQTT channel.
#[serde(skip_serializing_if = "Option::is_none")]
mqtt: Option<MQTTChannelBinding>,
/// Protocol-specific information for an MQTT 5 channel.
#[serde(skip_serializing_if = "Option::is_none")]
mqtt5: Option<MQTT5ChannelBinding>,
/// Protocol-specific information for a NATS channel.
#[serde(skip_serializing_if = "Option::is_none")]
nats: Option<NATSChannelBinding>,
/// Protocol-specific information for a JMS channel.
#[serde(skip_serializing_if = "Option::is_none")]
jms: Option<JMSChannelBinding>,
/// Protocol-specific information for an SNS channel.
#[serde(skip_serializing_if = "Option::is_none")]
sns: Option<SNSChannelBinding>,
/// Protocol-specific information for an SQS channel.
#[serde(skip_serializing_if = "Option::is_none")]
sqs: Option<SQSChannelBinding>,
/// Protocol-specific information for a STOMP channel.
#[serde(skip_serializing_if = "Option::is_none")]
stomp: Option<STOMPChannelBinding>,
/// Protocol-specific information for a Redis channel.
#[serde(skip_serializing_if = "Option::is_none")]
redis: Option<RedisChannelBinding>,
/// Protocol-specific information for a Mercure channel.
#[serde(skip_serializing_if = "Option::is_none")]
mercure: Option<MercureChannelBinding>,
/// Protocol-specific information for an IBM MQ channel.
#[serde(skip_serializing_if = "Option::is_none")]
ibmmq: Option<IBMMQChannelBinding>,
/// This object can be extended with
/// [Specification Extensions](https://www.asyncapi.com/docs/specifications/v2.1.0#specificationExtensions).
#[serde(flatten)]
pub extensions: IndexMap<String, serde_json::Value>,
}
/// This object MUST NOT contain any properties. Its name is reserved for future use.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
pub struct HTTPChannelBinding {}
/// When using WebSockets, the channel represents the connection. Unlike other protocols
/// that support multiple virtual channels (topics, routing keys, etc.) per connection,
/// WebSockets doesn't support virtual channels or, put it another way, there's only one
/// channel and its characteristics are strongly related to the protocol used for the
/// handshake, i.e., HTTP.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct WebsocketsChannelBinding {
/// The HTTP method to use when establishing the connection.
/// Its value MUST be either `GET` or `POST`.
#[serde(skip_serializing_if = "Option::is_none")]
method: Option<String>,
/// A Schema object containing the definitions for each query parameter.
/// This schema MUST be of type `object` and have a `properties` key.
#[serde(skip_serializing_if = "Option::is_none")]
query: Option<Schema>,
/// A Schema object containing the definitions of the HTTP headers to use when
/// establishing the connection. This schema MUST be of type `object` and have
/// a `properties` key.
#[serde(skip_serializing_if = "Option::is_none")]
headers: Option<Schema>,
/// The version of this binding. If omitted, "latest" MUST be assumed.
#[serde(skip_serializing_if = "Option::is_none")]
binding_version: Option<String>,
}
/// This object MUST NOT contain any properties. Its name is reserved for future use.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
pub struct KafkaChannelBinding {}
/// This object contains information about the channel representation in AMQP.
///
/// # Examples
///
/// ```yaml
/// channels:
/// user/signedup:
/// bindings:
/// amqp:
/// is: routingKey
/// queue:
/// name: my-queue-name
/// durable: true
/// exclusive: true
/// autoDelete: false
/// vhost: /
/// exchange:
/// name: myExchange
/// type: topic
/// durable: true
/// autoDelete: false
/// vhost: /
/// bindingVersion: 0.2.0
///
/// ```
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct AMQPChannelBinding {
/// Defines what type of channel is it. Can be either `queue` or `routingKey` (default).
#[serde(skip_serializing_if = "Option::is_none")]
is: Option<String>,
/// When `is`=`routingKey`, this object defines the exchange properties.
#[serde(skip_serializing_if = "Option::is_none")]
exchange: Option<AMQPChannelBindingExchange>,
/// When `is`=`queue`, this object defines the queue properties.
#[serde(skip_serializing_if = "Option::is_none")]
queue: Option<AMQPChannelBindingQueue>,
/// The version of this binding. If omitted, "latest" MUST be assumed.
#[serde(skip_serializing_if = "Option::is_none")]
binding_version: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct AMQPChannelBindingExchange {
/// The name of the exchange. It MUST NOT exceed 255 characters long.
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<String>,
/// The type of the exchange. Can be either
/// `topic`, `direct`, `fanout`, `default` or `headers`.
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
typ: Option<String>,
/// Whether the exchange should survive broker restarts or not.
#[serde(skip_serializing_if = "Option::is_none")]
durable: Option<bool>,
/// Whether the exchange should be deleted when the last queue is unbound from it.
#[serde(skip_serializing_if = "Option::is_none")]
auto_delete: Option<bool>,
/// The virtual host of the exchange. Defaults to `/`.
#[serde(skip_serializing_if = "Option::is_none")]
vhost: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct AMQPChannelBindingQueue {
/// The name of the queue. It MUST NOT exceed 255 characters long.
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<String>,
/// Whether the queue should survive broker restarts or not.
#[serde(skip_serializing_if = "Option::is_none")]
durable: Option<bool>,
/// Whether the queue should be used only by one connection or not.
#[serde(skip_serializing_if = "Option::is_none")]
exclusive: Option<bool>,
/// Whether the queue should be deleted when the last consumer unsubscribes.
#[serde(skip_serializing_if = "Option::is_none")]
auto_delete: Option<bool>,
/// The virtual host of the queue. Defaults to `/`.
#[serde(skip_serializing_if = "Option::is_none")]
vhost: Option<String>,
}
/// This object MUST NOT contain any properties. Its name is reserved for future use.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct AMQP1ChannelBinding {}
/// This object MUST NOT contain any properties. Its name is reserved for future use.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct MQTTChannelBinding {}
/// This object MUST NOT contain any properties. Its name is reserved for future use.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct MQTT5ChannelBinding {}
/// This object MUST NOT contain any properties. Its name is reserved for future use.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct NATSChannelBinding {}
/// This object MUST NOT contain any properties. Its name is reserved for future use.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct JMSChannelBinding {}
/// This object MUST NOT contain any properties. Its name is reserved for future use.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SNSChannelBinding {}
/// This object MUST NOT contain any properties. Its name is reserved for future use.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SQSChannelBinding {}
/// This object MUST NOT contain any properties. Its name is reserved for future use.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct STOMPChannelBinding {}
/// This object MUST NOT contain any properties. Its name is reserved for future use.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct RedisChannelBinding {}
/// This object MUST NOT contain any properties. Its name is reserved for future use.
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct MercureChannelBinding {}
/// This object contains information about the channel representation in IBM MQ. Each channel corresponds to a Queue or Topic within IBM MQ.
///
/// # Examples
///
/// Example for an IBM MQ Topic where topic string is defined by AsyncAPI channel
/// ```yaml
/// channels:
/// user/signedup:
/// ```
///
/// Example for AsyncAPI channel mapping to an IBM MQ topic with a specified MQ Topic object
/// ```yaml
/// channels:
/// user/signedup:
/// bindings:
/// ibmmq:
/// destinationType: topic
/// topic:
/// objectName: myTopicName
/// bindingVersion: 0.1.0
/// ```
///
/// Example for AsyncAPI channel mapping to an IBM MQ Queue
/// ```yaml
/// channels:
/// user/signedup:
/// bindings:
/// ibmmq:
/// destinationType: queue
/// queue:
/// objectName: myQueueName
/// exclusive: true
/// bindingVersion: 0.1.0
/// ```
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct IBMMQChannelBinding {
/// Defines the type of AsyncAPI channel.
///
/// MUST be either `topic` or `queue`. For type `topic`,
/// the AsyncAPI channel name MUST be assumed for the
/// IBM MQ topic string unless overridden.
#[serde(skip_serializing_if = "Option::is_none")]
destination_type: Option<String>,
/// Defines the properties of a queue.
///
/// `queue` and `topic` fields MUST NOT coexist within a channel binding
#[serde(skip_serializing_if = "Option::is_none")]
queue: Option<IBMMQChannelBindingQueue>,
/// Defines the properties of a topic.
///
/// `queue` and `topic` fields MUST NOT coexist within a channel binding.
#[serde(skip_serializing_if = "Option::is_none")]
topic: Option<IBMMQChannelBindingTopic>,
/// The maximum length of the physical message (in bytes) accepted
/// by the Topic or Queue. Messages produced that are greater in size
/// than this value may fail to be delivered. More information on the
/// maximum message length can be found on this
/// [page](https://www.ibm.com/support/knowledgecenter/SSFKSJ_latest/com.ibm.mq.ref.adm.doc/q085520_.html#q085520___maxmsgl)
/// in the IBM MQ Knowledge Center.
///
/// MUST be `0-104,857,600` bytes (100 MB).
#[serde(skip_serializing_if = "Option::is_none")]
max_msg_length: Option<i32>,
/// The version of this binding.
#[serde(skip_serializing_if = "Option::is_none")]
binding_version: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct IBMMQChannelBindingQueue {
/// Defines the name of the IBM MQ queue associated with the channel.
///
/// A value MUST be specified. MUST NOT exceed 48 characters in length.
/// MUST be a valid IBM MQ queue name
object_name: String,
/// Defines if the queue is a cluster queue and therefore partitioned.
/// If true, a binding option MAY be specified when accessing the queue.
/// More information on binding options can be found on this
/// [page](https://www.ibm.com/support/knowledgecenter/SSFKSJ_latest/com.ibm.mq.ref.dev.doc/q101870_.html#q101870___BIND_ON_OPEN)
/// in the IBM MQ Knowledge Center.
///
/// If `false`, binding options SHOULD NOT be specified when accessing the queue.
#[serde(skip_serializing_if = "Option::is_none")]
is_partitioned: Option<bool>,
/// Specifies if it is recommended to open the queue exclusively.
#[serde(skip_serializing_if = "Option::is_none")]
exclusive: Option<bool>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct IBMMQChannelBindingTopic {
/// The value of the IBM MQ topic string to be used.
///
/// Note: if specified, SHALL override AsyncAPI channel name.
///
/// MUST NOT exceed 10240 characters in length.
/// MAY coexist with `topic.objectName`
#[serde(skip_serializing_if = "Option::is_none")]
string: Option<String>,
/// The name of the IBM MQ topic object.
///
/// Note: if specified, SHALL override AsyncAPI channel name.
///
/// MUST NOT exceed 48 characters in length.
/// MAY coexist with `topic.string`
#[serde(skip_serializing_if = "Option::is_none")]
object_name: Option<String>,
/// Defines if the subscription may be durable.
#[serde(skip_serializing_if = "Option::is_none")]
durable_permitted: Option<bool>,
/// Defines if the last message published will be made
/// available to new subscriptions.
#[serde(skip_serializing_if = "Option::is_none")]
last_msg_retained: Option<bool>,
}