Esempio n. 1
0
        /// <summary>
        /// Serializes this instance of <see cref="ClusterConfigSpec" /> into a <see cref="Carbon.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Carbon.Json.JsonObject"/> container to serialize this object into. If the caller
        /// passes in <c>null</c>, a new instance will be created and returned to the caller.</param>
        /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Microsoft.Rest.ClientRuntime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="ClusterConfigSpec" /> as a <see cref="Carbon.Json.JsonNode" />.
        /// </returns>
        public Carbon.Json.JsonNode ToJson(Carbon.Json.JsonObject container, Microsoft.Rest.ClientRuntime.SerializationMode serializationMode)
        {
            container = container ?? new Carbon.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            if (null != AuthorizedPublicKeyList)
            {
                var __w = new Carbon.Json.XNodeArray();
                foreach (var __x in AuthorizedPublicKeyList)
                {
                    AddIf(__x?.ToJson(null), __w.Add);
                }
                container.Add("authorized_public_key_list", __w);
            }
            AddIf(null != CertificationSigningInfo ? (Carbon.Json.JsonNode)CertificationSigningInfo.ToJson(null) : null, "certification_signing_info", container.Add);
            AddIf(null != ClientAuth ? (Carbon.Json.JsonNode)ClientAuth.ToJson(null) : null, "client_auth", container.Add);
            if (null != EnabledFeatureList)
            {
                var __r = new Carbon.Json.XNodeArray();
                foreach (var __s in EnabledFeatureList)
                {
                    AddIf(null != __s ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(__s) : null, __r.Add);
                }
                container.Add("enabled_feature_list", __r);
            }
            AddIf(null != EncryptionStatus ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(EncryptionStatus) : null, "encryption_status", container.Add);
            AddIf(null != ExternalConfigurations ? (Carbon.Json.JsonNode)ExternalConfigurations.ToJson(null) : null, "external_configurations", container.Add);
            AddIf(null != GpuDriverVersion ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(GpuDriverVersion) : null, "gpu_driver_version", container.Add);
            AddIf(null != OperationMode ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(OperationMode) : null, "operation_mode", container.Add);
            AddIf(null != RedundancyFactor ? (Carbon.Json.JsonNode) new Carbon.Json.JsonNumber((int)RedundancyFactor) : null, "redundancy_factor", container.Add);
            if (null != SoftwareMap)
            {
                foreach (var __n in SoftwareMap)
                {
                    AddIf(__n.Value?.ToJson(null), (__m) => container.Add(__n.Key, __m));
                }
            }
            AddIf(null != SupportedInformationVerbosity ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(SupportedInformationVerbosity) : null, "supported_information_verbosity", container.Add);
            AddIf(null != Timezone ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(Timezone) : null, "timezone", container.Add);
            AfterToJson(ref container);
            return(container);
        }
Esempio n. 2
0
        /// <summary>
        /// Serializes this instance of <see cref="ClusterConfig" /> into a <see cref="Carbon.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Carbon.Json.JsonObject"/> container to serialize this object into. If the caller
        /// passes in <c>null</c>, a new instance will be created and returned to the caller.</param>
        /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Microsoft.Rest.ClientRuntime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="ClusterConfig" /> as a <see cref="Carbon.Json.JsonNode" />.
        /// </returns>
        public Carbon.Json.JsonNode ToJson(Carbon.Json.JsonObject container, Microsoft.Rest.ClientRuntime.SerializationMode serializationMode)
        {
            container = container ?? new Carbon.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            if (null != AuthorizedPublicKeyList)
            {
                var __w = new Carbon.Json.XNodeArray();
                foreach (var __x in AuthorizedPublicKeyList)
                {
                    AddIf(__x?.ToJson(null), __w.Add);
                }
                container.Add("authorized_public_key_list", __w);
            }
            AddIf(null != Build ? (Carbon.Json.JsonNode)Build.ToJson(null) : null, "build", container.Add);
            if (null != CaCertificateList)
            {
                var __r = new Carbon.Json.XNodeArray();
                foreach (var __s in CaCertificateList)
                {
                    AddIf(__s?.ToJson(null), __r.Add);
                }
                container.Add("ca_certificate_list", __r);
            }
            AddIf(null != CertificationSigningInfo ? (Carbon.Json.JsonNode)CertificationSigningInfo.ToJson(null) : null, "certification_signing_info", container.Add);
            AddIf(null != ClientAuth ? (Carbon.Json.JsonNode)ClientAuth.ToJson(null) : null, "client_auth", container.Add);
            AddIf(null != ClusterArch ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(ClusterArch) : null, "cluster_arch", container.Add);
            if (null != EnabledFeatureList)
            {
                var __m = new Carbon.Json.XNodeArray();
                foreach (var __n in EnabledFeatureList)
                {
                    AddIf(null != __n ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(__n) : null, __m.Add);
                }
                container.Add("enabled_feature_list", __m);
            }
            AddIf(null != EncryptionStatus ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(EncryptionStatus) : null, "encryption_status", container.Add);
            AddIf(null != ExternalConfigurations ? (Carbon.Json.JsonNode)ExternalConfigurations.ToJson(null) : null, "external_configurations", container.Add);
            AddIf(null != GpuDriverVersion ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(GpuDriverVersion) : null, "gpu_driver_version", container.Add);
            AddIf(null != IsAvailable ? (Carbon.Json.JsonNode) new Carbon.Json.JsonBoolean((bool)IsAvailable) : null, "is_available", container.Add);
            if (null != ManagementServerList)
            {
                var __h = new Carbon.Json.XNodeArray();
                foreach (var __i in ManagementServerList)
                {
                    AddIf(__i?.ToJson(null), __h.Add);
                }
                container.Add("management_server_list", __h);
            }
            AddIf(null != OperationMode ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(OperationMode) : null, "operation_mode", container.Add);
            AddIf(null != RedundancyFactor ? (Carbon.Json.JsonNode) new Carbon.Json.JsonNumber((int)RedundancyFactor) : null, "redundancy_factor", container.Add);
            if (null != ServiceList)
            {
                var __c = new Carbon.Json.XNodeArray();
                foreach (var __d in ServiceList)
                {
                    AddIf(null != __d ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(__d) : null, __c.Add);
                }
                container.Add("service_list", __c);
            }
            if (null != SoftwareMap)
            {
                foreach (var ___y in SoftwareMap)
                {
                    AddIf(___y.Value?.ToJson(null), (___x) => container.Add(___y.Key, ___x));
                }
            }
            AddIf(null != SslKey ? (Carbon.Json.JsonNode)SslKey.ToJson(null) : null, "ssl_key", container.Add);
            AddIf(null != SupportedInformationVerbosity ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(SupportedInformationVerbosity) : null, "supported_information_verbosity", container.Add);
            AddIf(null != Timezone ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(Timezone) : null, "timezone", container.Add);
            AfterToJson(ref container);
            return(container);
        }