コード例 #1
0
        internal static Logging DeserializeLogging(XElement element)
        {
            string          version         = default;
            bool            delete          = default;
            bool            read            = default;
            bool            write           = default;
            RetentionPolicy retentionPolicy = default;

            if (element.Element("Version") is XElement versionElement)
            {
                version = (string)versionElement;
            }
            if (element.Element("Delete") is XElement deleteElement)
            {
                delete = (bool)deleteElement;
            }
            if (element.Element("Read") is XElement readElement)
            {
                read = (bool)readElement;
            }
            if (element.Element("Write") is XElement writeElement)
            {
                write = (bool)writeElement;
            }
            if (element.Element("RetentionPolicy") is XElement retentionPolicyElement)
            {
                retentionPolicy = RetentionPolicy.DeserializeRetentionPolicy(retentionPolicyElement);
            }
            return(new Logging(version, delete, read, write, retentionPolicy));
        }
コード例 #2
0
        internal static Metrics DeserializeMetrics(XElement element)
        {
            string          version         = default;
            bool            enabled         = default;
            bool?           includeAPIs     = default;
            RetentionPolicy retentionPolicy = default;

            if (element.Element("Version") is XElement versionElement)
            {
                version = (string)versionElement;
            }
            if (element.Element("Enabled") is XElement enabledElement)
            {
                enabled = (bool)enabledElement;
            }
            if (element.Element("IncludeAPIs") is XElement includeAPIsElement)
            {
                includeAPIs = (bool?)includeAPIsElement;
            }
            if (element.Element("RetentionPolicy") is XElement retentionPolicyElement)
            {
                retentionPolicy = RetentionPolicy.DeserializeRetentionPolicy(retentionPolicyElement);
            }
            return(new Metrics(version, enabled, includeAPIs, retentionPolicy));
        }
コード例 #3
0
        public Logging(string version, bool delete, bool read, bool write, RetentionPolicy retentionPolicy)
        {
            if (version == null)
            {
                throw new ArgumentNullException(nameof(version));
            }
            if (retentionPolicy == null)
            {
                throw new ArgumentNullException(nameof(retentionPolicy));
            }

            Version         = version;
            Delete          = delete;
            Read            = read;
            Write           = write;
            RetentionPolicy = retentionPolicy;
        }