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
43impl From<InstanceAddressDefinition> for InstanceAddress {
44 fn from(address: InstanceAddressDefinition) -> Self {
45 InstanceAddress {
46 hostname: address.hostname,
47 port: address.port,
48 secure: address.secure.unwrap_or(false),
49 user_agent: address.user_agent.unwrap_or(DEFAULT_USER_AGENT.to_owned()),
50 endpoint_graphql: address.endpoint_graphql.unwrap_or(DEFAULT_ENDPOINT_GRAPHQL.to_owned()),
51 endpoint_dynamic_graph: address.endpoint_dynamic_graph.unwrap_or(DEFAULT_ENDPOINT_DYNAMIC_GRAPH.to_owned()),
52 endpoint_runtime: address.endpoint_runtime.unwrap_or(DEFAULT_ENDPOINT_RUNTIME.to_owned()),
53 endpoint_plugin: address.endpoint_plugin.unwrap_or(DEFAULT_ENDPOINT_PLUGIN.to_owned()),
54 bearer: address.bearer,
55 }
56 }
57}