static public CassandraSchema ConvertPSCassandraSchemaToCassandraSchema(PSCassandraSchema pSCassandraSchema)
        {
            List <Column> column = new List <Column>();

            foreach (PSColumn pSColumn in pSCassandraSchema.Columns)
            {
                column.Add(PSColumn.ConvertPSColumnToColumn(pSColumn));
            }

            List <CassandraPartitionKey> partitionKeys = new List <CassandraPartitionKey>();

            foreach (PSCassandraPartitionKey pSCassandraPartitionKey in pSCassandraSchema.PartitionKeys)
            {
                partitionKeys.Add(PSCassandraPartitionKey.ConvertPSCassandraPartitionKeyToCassandraPartitionKey(pSCassandraPartitionKey));
            }

            List <ClusterKey> clusterKeys = new List <ClusterKey>();

            foreach (PSClusterKey pSClusterKey in pSCassandraSchema.ClusterKeys)
            {
                clusterKeys.Add(PSClusterKey.ConvertPSCassandraSchemaToCassandraSchema(pSClusterKey));
            }

            return(new CassandraSchema
            {
                Columns = column,
                PartitionKeys = partitionKeys,
                ClusterKeys = clusterKeys
            });
        }
        static public CassandraPartitionKey ToSDKModel(PSCassandraPartitionKey psCassandraPartitionKey)
        {
            if (psCassandraPartitionKey == null)
            {
                return(null);
            }

            return(new CassandraPartitionKey
            {
                Name = psCassandraPartitionKey.Name
            });
        }
Exemplo n.º 3
0
        static public CassandraSchema ToSDKModel(PSCassandraSchema pSCassandraSchema)
        {
            if (pSCassandraSchema == null)
            {
                return(null);
            }

            CassandraSchema schema = new CassandraSchema();

            if (ModelHelper.IsNotNullOrEmpty(pSCassandraSchema.Columns))
            {
                List <Column> column = new List <Column>();
                foreach (PSColumn pSColumn in pSCassandraSchema.Columns)
                {
                    column.Add(PSColumn.ToSDKModel(pSColumn));
                }
                schema.Columns = column;
            }

            if (ModelHelper.IsNotNullOrEmpty(pSCassandraSchema.PartitionKeys))
            {
                List <CassandraPartitionKey> partitionKeys = new List <CassandraPartitionKey>();
                foreach (PSCassandraPartitionKey pSCassandraPartitionKey in pSCassandraSchema.PartitionKeys)
                {
                    partitionKeys.Add(PSCassandraPartitionKey.ToSDKModel(pSCassandraPartitionKey));
                }
                schema.PartitionKeys = partitionKeys;
            }

            if (ModelHelper.IsNotNullOrEmpty(pSCassandraSchema.ClusterKeys))
            {
                List <ClusterKey> clusterKeys = new List <ClusterKey>();
                foreach (PSClusterKey pSClusterKey in pSCassandraSchema.ClusterKeys)
                {
                    clusterKeys.Add(PSClusterKey.ToSDKModel(pSClusterKey));
                }
                schema.ClusterKeys = clusterKeys;
            }

            return(schema);
        }
 static public CassandraPartitionKey ConvertPSCassandraPartitionKeyToCassandraPartitionKey(PSCassandraPartitionKey psCassandraPartitionKey)
 {
     return(new CassandraPartitionKey
     {
         Name = psCassandraPartitionKey.Name
     });
 }