public YamlNode ToYaml()
        {
            var node = new YamlMappingNode();

            node.Add("enabled", Enabled.ToString().ToLower());
            node.Add("database-url", DatabaseUrl);
            node.Add("store-measurement", StoreMeasurement.ToString().ToLower());
            node.Add("table-name", TableName);
            node.Add("store-raw-message", StoreRawMessage.ToString().ToLower());
            node.Add("raw-table-name", RawTableName);
            node.Add("raw-data-format", ((int)RawDataFormat).ToString());
            node.Add("max-queued-messages", MaxQueuedMessages.ToString());
            node.Add("connect-retry-seconds", ConnectRetrySeconds.ToString());

            return(node);
        }
        public YamlNode ToYaml()
        {
            var node = new YamlMappingNode();

            node.Add("enabled", Enabled.ToString().ToLower());
            node.Add("max-queued-messages", MaxQueuedMessages.ToString());
            node.Add("server-address", ConnectUrl);
            node.Add("client-id", ClientId);
            node.Add("connect-retry-delay-ms", ConnectRetryMs.ToString());

            node.Add("security", new YamlMappingNode(
                         new YamlScalarNode("security-type"), new YamlScalarNode(Security.SecurityType.ToString().ToLower()),
                         new YamlScalarNode("ca-trusted-cert-file"), new YamlScalarNode(Security.CertFile),
                         new YamlScalarNode("client-private-key-file"), new YamlScalarNode(Security.ClientKey),
                         new YamlScalarNode("client-cert-chain-file"), new YamlScalarNode(Security.ClientCert),
                         new YamlScalarNode("username"), new YamlScalarNode(Security.Username),
                         new YamlScalarNode("password"), new YamlScalarNode(Security.Password)));

            var publish = new YamlSequenceNode();

            node.Add("publish", publish);

            foreach (var p in Publishes)
            {
                publish.Add(new YamlMappingNode(
                                new YamlScalarNode("profile"), new YamlScalarNode(p.Profile),
                                new YamlScalarNode("topic-suffix"), new YamlScalarNode(p.Subject)));
            }

            var subscribe = new YamlSequenceNode();

            node.Add("subscribe", subscribe);

            foreach (var p in Subscribes)
            {
                subscribe.Add(new YamlMappingNode(
                                  new YamlScalarNode("profile"), new YamlScalarNode(p.Profile),
                                  new YamlScalarNode("topic-suffix"), new YamlScalarNode(p.Subject)));
            }

            return(node);
        }
Beispiel #3
0
        public YamlNode ToYaml()
        {
            var node = new YamlMappingNode();

            node.Add("enabled", Enabled.ToString().ToLower());
            node.Add("max-queued-messages", MaxQueuedMessages.ToString());
            node.Add("connect-url", ConnectUrl);
            node.Add("connect-retry-seconds", ConnectRetrySeconds.ToString());

            node.Add("security", new YamlMappingNode(
                         new YamlScalarNode("security-type"), new YamlScalarNode(Security.SecurityType.ToString().ToLower()),
                         new YamlScalarNode("ca-trusted-cert-file"), new YamlScalarNode(Security.CertFile),
                         new YamlScalarNode("client-private-key-file"), new YamlScalarNode(Security.ClientKey),
                         new YamlScalarNode("client-cert-chain-file"), new YamlScalarNode(Security.ClientCert),
                         new YamlScalarNode("jwt-creds-file"), new YamlScalarNode(Security.JwtCredsFile)));

            var publish = new YamlSequenceNode();

            node.Add("publish", publish);

            foreach (var p in Publishes)
            {
                publish.Add(new YamlMappingNode(
                                new YamlScalarNode("profile"), new YamlScalarNode(p.Profile),
                                new YamlScalarNode("subject"), new YamlScalarNode(p.Subject)));
            }

            var subscribe = new YamlSequenceNode();

            node.Add("subscribe", subscribe);

            foreach (var p in Subscribes)
            {
                subscribe.Add(new YamlMappingNode(
                                  new YamlScalarNode("profile"), new YamlScalarNode(p.Profile),
                                  new YamlScalarNode("subject"), new YamlScalarNode(p.Subject)));
            }

            return(node);
        }