reactive_graph_runtime_graphql_schema/
instance_address.rs1use async_graphql::InputObject;
2use serde::Deserialize;
3use serde::Serialize;
4
5use reactive_graph_remotes_model::DEFAULT_ENDPOINT_DYNAMIC_GRAPH;
6use reactive_graph_remotes_model::DEFAULT_ENDPOINT_GRAPHQL;
7use reactive_graph_remotes_model::DEFAULT_ENDPOINT_PLUGIN;
8use reactive_graph_remotes_model::DEFAULT_ENDPOINT_RUNTIME;
9use reactive_graph_remotes_model::DEFAULT_USER_AGENT;
10use reactive_graph_remotes_model::InstanceAddress;
11
12#[derive(Clone, Debug, Serialize, Deserialize, InputObject)]
13#[graphql(name = "InstanceAddress")]
14pub struct InstanceAddressDefinition {
15 pub hostname: String,
17
18 pub port: u16,
20
21 pub secure: Option<bool>,
23
24 pub user_agent: Option<String>,
26
27 pub endpoint_graphql: Option<String>,
29
30 pub endpoint_dynamic_graph: Option<String>,
32
33 pub endpoint_runtime: Option<String>,
35
36 pub endpoint_plugin: Option<String>,
38
39 pub bearer: Option<String>,
41
42 danger_accept_invalid_certs: Option<bool>,
52
53 danger_accept_invalid_hostnames: Option<bool>,
62}
63
64impl From<InstanceAddressDefinition> for InstanceAddress {
65 fn from(address: InstanceAddressDefinition) -> Self {
66 InstanceAddress {
67 hostname: address.hostname,
68 port: address.port,
69 secure: address.secure.unwrap_or(false),
70 user_agent: address.user_agent.unwrap_or(DEFAULT_USER_AGENT.to_owned()),
71 endpoint_graphql: address.endpoint_graphql.unwrap_or(DEFAULT_ENDPOINT_GRAPHQL.to_owned()),
72 endpoint_dynamic_graph: address.endpoint_dynamic_graph.unwrap_or(DEFAULT_ENDPOINT_DYNAMIC_GRAPH.to_owned()),
73 endpoint_runtime: address.endpoint_runtime.unwrap_or(DEFAULT_ENDPOINT_RUNTIME.to_owned()),
74 endpoint_plugin: address.endpoint_plugin.unwrap_or(DEFAULT_ENDPOINT_PLUGIN.to_owned()),
75 bearer: address.bearer,
76 danger_accept_invalid_certs: address.danger_accept_invalid_certs,
77 danger_accept_invalid_hostnames: address.danger_accept_invalid_hostnames,
78 }
79 }
80}