Beispiel #1
0
        private static void ValidateIncludedPaths(IEnumerable <ClientEncryptionIncludedPath> clientEncryptionIncludedPath)
        {
            List <string> includedPathsList = new List <string>();

            foreach (ClientEncryptionIncludedPath path in clientEncryptionIncludedPath)
            {
                ClientEncryptionPolicy.ValidateClientEncryptionIncludedPath(path);
                if (includedPathsList.Contains(path.Path))
                {
                    throw new ArgumentException("Duplicate Path found.", nameof(clientEncryptionIncludedPath));
                }

                includedPathsList.Add(path.Path);
            }
        }
        private static void ValidateIncludedPaths(
            IEnumerable<ClientEncryptionIncludedPath> clientEncryptionIncludedPath,
            int policyFormatVersion)
        {
            List<string> includedPathsList = new List<string>();
            foreach (ClientEncryptionIncludedPath path in clientEncryptionIncludedPath)
            {
                ClientEncryptionPolicy.ValidateClientEncryptionIncludedPath(path, policyFormatVersion);
                if (includedPathsList.Contains(path.Path))
                {
                    throw new ArgumentException($"Duplicate Path found: {path.Path}.");
                }

                includedPathsList.Add(path.Path);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClientEncryptionPolicy"/> class.
 /// </summary>
 /// <param name="includedPaths">List of paths to include in the policy definition.</param>
 public ClientEncryptionPolicy(IEnumerable <ClientEncryptionIncludedPath> includedPaths)
 {
     ClientEncryptionPolicy.ValidateIncludedPaths(includedPaths);
     this.IncludedPaths       = includedPaths;
     this.PolicyFormatVersion = 1;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ClientEncryptionPolicy"/> class.
 /// Note: If you need to include partition key or id field paths as part of <see cref="ClientEncryptionPolicy"/>, please set <see cref="PolicyFormatVersion"/> to 2.
 /// </summary>
 /// <param name="includedPaths">List of paths to include in the policy definition.</param>
 /// <param name="policyFormatVersion"> Version of the client encryption policy definition. Current supported versions are 1 and 2.</param>
 public ClientEncryptionPolicy(IEnumerable<ClientEncryptionIncludedPath> includedPaths, int policyFormatVersion)
 {
     this.PolicyFormatVersion = (policyFormatVersion > 2 || policyFormatVersion < 1) ? throw new ArgumentException($"Supported versions of client encryption policy are 1 and 2. ") : policyFormatVersion;
     ClientEncryptionPolicy.ValidateIncludedPaths(includedPaths, policyFormatVersion);
     this.IncludedPaths = includedPaths;
 }