Ejemplo n.º 1
0
 /// <summary>Snippet for CheckAndMutateRow</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void CheckAndMutateRow1ResourceNames()
 {
     // Create client
     BigtableClient bigtableClient = BigtableClient.Create();
     // Initialize request argument(s)
     TableName              tableName       = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]");
     ByteString             rowKey          = ByteString.Empty;
     RowFilter              predicateFilter = new RowFilter();
     IEnumerable <Mutation> trueMutations   = new Mutation[] { new Mutation(), };
     IEnumerable <Mutation> falseMutations  = new Mutation[] { new Mutation(), };
     // Make the request
     CheckAndMutateRowResponse response = bigtableClient.CheckAndMutateRow(tableName, rowKey, predicateFilter, trueMutations, falseMutations);
 }
Ejemplo n.º 2
0
 /// <summary>Snippet for CheckAndMutateRow</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void CheckAndMutateRow1()
 {
     // Create client
     BigtableClient bigtableClient = BigtableClient.Create();
     // Initialize request argument(s)
     string                 tableName       = "projects/[PROJECT]/instances/[INSTANCE]/tables/[TABLE]";
     ByteString             rowKey          = ByteString.Empty;
     RowFilter              predicateFilter = new RowFilter();
     IEnumerable <Mutation> trueMutations   = new Mutation[] { new Mutation(), };
     IEnumerable <Mutation> falseMutations  = new Mutation[] { new Mutation(), };
     // Make the request
     CheckAndMutateRowResponse response = bigtableClient.CheckAndMutateRow(tableName, rowKey, predicateFilter, trueMutations, falseMutations);
 }
Ejemplo n.º 3
0
 public void CheckAndMutateRow()
 {
     // Snippet: CheckAndMutateRow(string,ByteString,IEnumerable<Mutation>,IEnumerable<Mutation>,CallSettings)
     // Create client
     BigtableClient bigtableClient = BigtableClient.Create();
     // Initialize request argument(s)
     string                 formattedTableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]").ToString();
     ByteString             rowKey             = ByteString.CopyFromUtf8("");
     IEnumerable <Mutation> trueMutations      = new List <Mutation>();
     IEnumerable <Mutation> falseMutations     = new List <Mutation>();
     // Make the request
     CheckAndMutateRowResponse response = bigtableClient.CheckAndMutateRow(formattedTableName, rowKey, trueMutations, falseMutations);
     // End snippet
 }
Ejemplo n.º 4
0
 public void CheckAndMutateRow_RequestObject()
 {
     // Snippet: CheckAndMutateRow(CheckAndMutateRowRequest,CallSettings)
     // Create client
     BigtableClient bigtableClient = BigtableClient.Create();
     // Initialize request argument(s)
     CheckAndMutateRowRequest request = new CheckAndMutateRowRequest
     {
         TableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]").ToString(),
         RowKey    = ByteString.CopyFromUtf8(""),
     };
     // Make the request
     CheckAndMutateRowResponse response = bigtableClient.CheckAndMutateRow(request);
     // End snippet
 }
Ejemplo n.º 5
0
 /// <summary>Snippet for CheckAndMutateRow</summary>
 public void CheckAndMutateRow2ResourceNames()
 {
     // Snippet: CheckAndMutateRow(TableName, ByteString, RowFilter, IEnumerable<Mutation>, IEnumerable<Mutation>, string, CallSettings)
     // Create client
     BigtableClient bigtableClient = BigtableClient.Create();
     // Initialize request argument(s)
     TableName              tableName       = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]");
     ByteString             rowKey          = ByteString.Empty;
     RowFilter              predicateFilter = new RowFilter();
     IEnumerable <Mutation> trueMutations   = new Mutation[] { new Mutation(), };
     IEnumerable <Mutation> falseMutations  = new Mutation[] { new Mutation(), };
     string appProfileId = "";
     // Make the request
     CheckAndMutateRowResponse response = bigtableClient.CheckAndMutateRow(tableName, rowKey, predicateFilter, trueMutations, falseMutations, appProfileId);
     // End snippet
 }
 /// <summary>Snippet for CheckAndMutateRow</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void CheckAndMutateRowRequestObject()
 {
     // Create client
     BigtableClient bigtableClient = BigtableClient.Create();
     // Initialize request argument(s)
     CheckAndMutateRowRequest request = new CheckAndMutateRowRequest
     {
         TableNameAsTableName = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]"),
         RowKey          = ByteString.Empty,
         TrueMutations   = { new Mutation(), },
         FalseMutations  = { new Mutation(), },
         PredicateFilter = new RowFilter(),
         AppProfileId    = "",
     };
     // Make the request
     CheckAndMutateRowResponse response = bigtableClient.CheckAndMutateRow(request);
 }
        /// <summary>
        /// Check if a row has a certain value then mutate the row if it does.
        ///</summary>
        /// <param name="projectId">Your Google Cloud Project ID.</param>
        /// <param name="instanceId">Your Google Cloud Bigtable Instance ID.</param>
        /// <param name="tableId">Your Google Cloud Bigtable table ID.</param>
        public string writeConditional(
            string projectId  = "YOUR-PROJECT-ID",
            string instanceId = "YOUR-INSTANCE-ID",
            string tableId    = "YOUR-TABLE-ID")
        {
            BigtableClient bigtableClient = BigtableClient.Create();

            TableName          tableName     = new TableName(projectId, instanceId, tableId);
            BigtableByteString rowkey        = new BigtableByteString("phone#4c410523#20190501");
            BigtableVersion    timestamp     = new BigtableVersion(DateTime.UtcNow);
            String             COLUMN_FAMILY = "stats_summary";

            CheckAndMutateRowResponse checkAndMutateRowResponse = bigtableClient.CheckAndMutateRow(
                tableName,
                rowkey,
                RowFilters.Chain(
                    RowFilters.FamilyNameExact(COLUMN_FAMILY),
                    RowFilters.ColumnQualifierExact("os_build"),
                    RowFilters.ValueRegex("PQ2A\\..*")),
                Mutations.SetCell(COLUMN_FAMILY, "os_name", "android", timestamp));

            return($"Successfully updated row's os_name: {checkAndMutateRowResponse.PredicateMatched}");
        }