Exemplo n.º 1
0
        /// <summary>
        /// Serializes this instance of <see cref="NetworkRule" /> 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="NetworkRule" /> 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);
            }
            AddIf(null != ExpirationTime ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(ExpirationTime) : null, "expiration_time", container.Add);
            AddIf(null != Filter ? (Carbon.Json.JsonNode)Filter.ToJson(null) : null, "filter", container.Add);
            if (null != IcmpTypeCodeList)
            {
                var __w = new Carbon.Json.XNodeArray();
                foreach (var __x in IcmpTypeCodeList)
                {
                    AddIf(__x?.ToJson(null), __w.Add);
                }
                container.Add("icmp_type_code_list", __w);
            }
            AddIf(null != IpSubnet ? (Carbon.Json.JsonNode)IpSubnet.ToJson(null) : null, "ip_subnet", container.Add);
            AddIf(null != NetworkFunctionChainReference ? (Carbon.Json.JsonNode)NetworkFunctionChainReference.ToJson(null) : null, "network_function_chain_reference", container.Add);
            AddIf(null != PeerSpecificationType ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(PeerSpecificationType) : null, "peer_specification_type", container.Add);
            AddIf(null != Protocol ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(Protocol) : null, "protocol", container.Add);
            if (null != TcpPortRangeList)
            {
                var __r = new Carbon.Json.XNodeArray();
                foreach (var __s in TcpPortRangeList)
                {
                    AddIf(__s?.ToJson(null), __r.Add);
                }
                container.Add("tcp_port_range_list", __r);
            }
            if (null != UdpPortRangeList)
            {
                var __m = new Carbon.Json.XNodeArray();
                foreach (var __n in UdpPortRangeList)
                {
                    AddIf(__n?.ToJson(null), __m.Add);
                }
                container.Add("udp_port_range_list", __m);
            }
            AfterToJson(ref container);
            return(container);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Serializes this instance of <see cref="SubnetResources" /> 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="SubnetResources" /> 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);
            }
            AddIf(null != IpConfig ? (Carbon.Json.JsonNode)IpConfig.ToJson(null) : null, "ip_config", container.Add);
            AddIf(null != NetworkFunctionChainReference ? (Carbon.Json.JsonNode)NetworkFunctionChainReference.ToJson(null) : null, "network_function_chain_reference", container.Add);
            AddIf(null != SubnetType ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(SubnetType) : null, "subnet_type", container.Add);
            AddIf(null != VlanId ? (Carbon.Json.JsonNode) new Carbon.Json.JsonNumber((int)VlanId) : null, "vlan_id", container.Add);
            AddIf(null != VswitchName ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(VswitchName) : null, "vswitch_name", container.Add);
            AfterToJson(ref container);
            return(container);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Serializes this instance of <see cref="VmNic" /> 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="VmNic" /> 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);
            }
            AddIf(null != IpEndpointList ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(IpEndpointList) : null, "ip_endpoint_list", container.Add);
            AddIf(null != MacAddress ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(MacAddress) : null, "mac_address", container.Add);
            AddIf(null != Model ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(Model) : null, "model", container.Add);
            AddIf(null != NetworkFunctionChainReference ? (Carbon.Json.JsonNode)NetworkFunctionChainReference.ToJson(null) : null, "network_function_chain_reference", container.Add);
            AddIf(null != NetworkFunctionNicType ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(NetworkFunctionNicType) : null, "network_function_nic_type", container.Add);
            AddIf(null != NicType ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(NicType) : null, "nic_type", container.Add);
            AddIf(null != SubnetReference ? (Carbon.Json.JsonNode)SubnetReference.ToJson(null) : null, "subnet_reference", container.Add);
            AddIf(null != Uuid ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(Uuid) : null, "uuid", container.Add);
            AfterToJson(ref container);
            return(container);
        }