コード例 #1
0
        public async Task CheckAndMutateRow_With_AppProfileId()
        {
            var appProfileIdOnClient    = "csharp";
            var appProfileIdOnRequest   = "other";
            var requestWithAppProfileId = new CheckAndMutateRowRequest
            {
                TableNameAsTableName = new TableName("project", "instance", "table"),
                RowKey         = ByteString.CopyFromUtf8("abc"),
                FalseMutations = { new Mutation() },
                TrueMutations  = { new Mutation() },
                AppProfileId   = appProfileIdOnRequest
            };
            var client = BigtableClient.Create(NotImplementedCallInvoker.Instance,
                                               new BigtableServiceApiSettings {
                AppProfileId = appProfileIdOnClient
            });

            Assert.Throws <NotImplementedException>(() => client.CheckAndMutateRow(requestWithAppProfileId));
            Assert.NotEqual(appProfileIdOnClient, requestWithAppProfileId.AppProfileId);
            Assert.Equal(appProfileIdOnRequest, requestWithAppProfileId.AppProfileId);
            await Assert.ThrowsAsync <NotImplementedException>(() => client.CheckAndMutateRowAsync(requestWithAppProfileId));

            Assert.NotEqual(appProfileIdOnClient, requestWithAppProfileId.AppProfileId);
            Assert.Equal(appProfileIdOnRequest, requestWithAppProfileId.AppProfileId);
        }
コード例 #2
0
 public static async Task HasNoValuesAsync(
     BigtableClient client,
     TableName tableName,
     BigtableByteString rowKey)
 {
     Assert.Null(await client.ReadRowAsync(tableName, rowKey));
 }
コード例 #3
0
        private async Task InitBigtableInstanceAndTable()
        {
            if (EmulatorCallInvoker == null)
            {
                InstanceAdminClient = BigtableInstanceAdminClient.Create();
                TableAdminClient    = BigtableTableAdminClient.Create();
                TableClient         = BigtableClient.Create();

                try
                {
                    await InstanceAdminClient.GetInstanceAsync(InstanceName);
                }
                catch (RpcException e) when(e.Status.StatusCode == StatusCode.NotFound)
                {
                    Assert.True(false, $"The Bigtable instance for testing does not exist: {InstanceName}");
                }
            }
            else
            {
                TableAdminClient = new BigtableTableAdminClientBuilder {
                    CallInvoker = EmulatorCallInvoker
                }.Build();
                TableClient = new BigtableClientBuilder {
                    CallInvoker = EmulatorCallInvoker
                }.Build();
            }

            TableName = await CreateTable();
        }
コード例 #4
0
        public async Task SampleRowKeys()
        {
            // Snippet: SampleRowKeys(SampleRowKeysRequest,CallSettings)
            // Create client
            BigtableClient bigtableClient = BigtableClient.Create();
            // Initialize request argument
            SampleRowKeysRequest request = new SampleRowKeysRequest
            {
                TableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]").ToString(),
            };

            // Make the request, returning a streaming response
            BigtableClient.SampleRowKeysStream streamingResponse = bigtableClient.SampleRowKeys(request);

            // Read streaming responses from server until complete
            IAsyncEnumerator <SampleRowKeysResponse> responseStream = streamingResponse.ResponseStream;

            while (await responseStream.MoveNext())
            {
                SampleRowKeysResponse response = responseStream.Current;
                // Do something with streamed response
            }
            // The response stream has completed
            // End snippet
        }
コード例 #5
0
        /// <summary>Snippet for SampleRowKeys</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task SampleRowKeysRequestObject()
        {
            // Create client
            BigtableClient bigtableClient = BigtableClient.Create();
            // Initialize request argument(s)
            SampleRowKeysRequest request = new SampleRowKeysRequest
            {
                TableNameAsTableName = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]"),
                AppProfileId         = "",
            };

            // Make the request, returning a streaming response
            BigtableClient.SampleRowKeysStream response = bigtableClient.SampleRowKeys(request);

            // Read streaming responses from server until complete
            // Note that C# 8 code can use await foreach
            AsyncResponseStream <SampleRowKeysResponse> responseStream = response.GetResponseStream();

            while (await responseStream.MoveNextAsync())
            {
                SampleRowKeysResponse responseItem = responseStream.Current;
                // Do something with streamed response
            }
            // The response stream has completed
        }
        /// <summary>
        /// Add Test Data into Given Google Cloud Bigtable
        /// </summary>
        public void InsertTestDataToTable()
        {
            try
            {
                if (!IsTableExists())
                {
                    throw new Exception("No Such Table Found");
                }
                var             bigtableClient = BigtableClient.Create();
                List <Mutation> Cols           = new List <Mutation>();
                TableName       _table         = new TableName(ProjectId, InstanceId, TableName);

                var request = new MutateRowsRequest
                {
                    TableNameAsTableName = _table,
                };
                request.Entries.Add(Mutations.CreateEntry(Guid.NewGuid().ToString(),
                                                          Mutations.SetCell(ColumnFamily, "TestColumnName", "Test Column Value")));
                bigtableClient.MutateRows(request);
            }
            catch (RpcException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #7
0
        /// <summary>Snippet for ReadRows</summary>
        public async Task ReadRowsRequestObject()
        {
            // Snippet: ReadRows(ReadRowsRequest, CallSettings)
            // Create client
            BigtableClient bigtableClient = BigtableClient.Create();
            // Initialize request argument(s)
            ReadRowsRequest request = new ReadRowsRequest
            {
                TableNameAsTableName = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]"),
                Rows         = new RowSet(),
                Filter       = new RowFilter(),
                RowsLimit    = 0L,
                AppProfileId = "",
            };

            // Make the request, returning a streaming response
            BigtableClient.ReadRowsStream response = bigtableClient.ReadRows(request);

            // Read streaming responses from server until complete
            // Note that C# 8 code can use await foreach
            AsyncResponseStream <ReadRowsResponse> responseStream = response.GetResponseStream();

            while (await responseStream.MoveNextAsync())
            {
                ReadRowsResponse responseItem = responseStream.Current;
                // Do something with streamed response
            }
            // The response stream has completed
            // End snippet
        }
コード例 #8
0
        /// <summary>Snippet for MutateRows</summary>
        public async Task MutateRows1()
        {
            // Snippet: MutateRows(string, IEnumerable<MutateRowsRequest.Types.Entry>, CallSettings)
            // Create client
            BigtableClient bigtableClient = BigtableClient.Create();
            // Initialize request argument(s)
            string tableName = "projects/[PROJECT]/instances/[INSTANCE]/tables/[TABLE]";
            IEnumerable <MutateRowsRequest.Types.Entry> entries = new MutateRowsRequest.Types.Entry[]
            {
                new MutateRowsRequest.Types.Entry(),
            };

            // Make the request, returning a streaming response
            BigtableClient.MutateRowsStream response = bigtableClient.MutateRows(tableName, entries);

            // Read streaming responses from server until complete
            // Note that C# 8 code can use await foreach
            AsyncResponseStream <MutateRowsResponse> responseStream = response.GetResponseStream();

            while (await responseStream.MoveNextAsync())
            {
                MutateRowsResponse responseItem = responseStream.Current;
                // Do something with streamed response
            }
            // The response stream has completed
            // End snippet
        }
コード例 #9
0
        /// <summary>Snippet for MutateRows</summary>
        public async Task MutateRows2ResourceNames()
        {
            // Snippet: MutateRows(TableName, IEnumerable<MutateRowsRequest.Types.Entry>, string, CallSettings)
            // Create client
            BigtableClient bigtableClient = BigtableClient.Create();
            // Initialize request argument(s)
            TableName tableName = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]");
            IEnumerable <MutateRowsRequest.Types.Entry> entries = new MutateRowsRequest.Types.Entry[]
            {
                new MutateRowsRequest.Types.Entry(),
            };
            string appProfileId = "";

            // Make the request, returning a streaming response
            BigtableClient.MutateRowsStream response = bigtableClient.MutateRows(tableName, entries, appProfileId);

            // Read streaming responses from server until complete
            // Note that C# 8 code can use await foreach
            AsyncResponseStream <MutateRowsResponse> responseStream = response.GetResponseStream();

            while (await responseStream.MoveNextAsync())
            {
                MutateRowsResponse responseItem = responseStream.Current;
                // Do something with streamed response
            }
            // The response stream has completed
            // End snippet
        }
コード例 #10
0
        private async Task InitBigtableInstanceAndTable()
        {
            if (EmulatorChannel == null)
            {
                InstanceAdminClient = BigtableInstanceAdminClient.Create();
                TableAdminClient    = BigtableTableAdminClient.Create();
                TableClient         = BigtableClient.Create();

                try
                {
                    await InstanceAdminClient.GetInstanceAsync(InstanceName);
                }
                catch (RpcException e) when(e.Status.StatusCode == StatusCode.NotFound)
                {
                    Assert.True(false, $"The Bigtable instance for testing does not exist: {InstanceName}");
                }
            }
            else
            {
                TableAdminClient = BigtableTableAdminClient.Create(EmulatorChannel);
                TableClient      = BigtableClient.Create(EmulatorChannel);
            }

            TableName = new TableName(ProjectName.ProjectId, InstanceName.InstanceId, "default-table");
            await CreateTable(TableName);
        }
コード例 #11
0
        private async Task InitBigtableInstanceAndTable()
        {
            if (EmulatorChannel == null)
            {
                InstanceAdminClient = BigtableInstanceAdminClient.Create();
                TableAdminClient    = BigtableTableAdminClient.Create();
                TableClient         = BigtableClient.Create();

                try
                {
                    await InstanceAdminClient.GetInstanceAsync(InstanceName);
                }
                catch (RpcException e) when(e.Status.StatusCode == StatusCode.NotFound)
                {
                    Assert.True(false, $"The Bigtable instance for testing does not exist: {InstanceName}");
                }
            }
            else
            {
                TableAdminClient = BigtableTableAdminClient.Create(EmulatorChannel);
                TableClient      = BigtableClient.Create(BigtableClient.ClientCreationSettings.FromEndpointTarget(EmulatorChannel.Target));
            }

            TableName = await CreateTable();
        }
コード例 #12
0
 internal HelloWorld(HelloWorldSettings settings)
 {
     _settings = settings;
     _bigtableTableAdminClient = BigtableTableAdminClient.Create();
     _bigtableClient           = BigtableClient.Create();
     _tableNameAdmin           = new Google.Cloud.Bigtable.Admin.V2.TableName(_settings.ProjectId, _settings.InstanceId, _settings.TableName);
     _tableNameClient          = new Google.Cloud.Bigtable.V2.TableName(_settings.ProjectId, _settings.InstanceId, _settings.TableName);
 }
コード例 #13
0
        public BigtableClientFixture()
        {
            BigtableClient bigtableClient = BigtableClient.Create();

            _bigtableTableAdminClient = BigtableTableAdminClient.Create();
            Table table = new Table
            {
                Granularity = Table.Types.TimestampGranularity.Millis
            };

            table.ColumnFamilies.Add("stats_summary", new ColumnFamily());
            table.ColumnFamilies.Add("cell_plan", new ColumnFamily());
            CreateTableRequest createTableRequest = new CreateTableRequest
            {
                ParentAsInstanceName = new InstanceName(projectId, instanceId),
                Table   = table,
                TableId = tableId,
            };

            _bigtableTableAdminClient.CreateTable(createTableRequest);

            TableName       tableName          = new TableName(projectId, instanceId, tableId);
            BigtableVersion timestamp          = new BigtableVersion(new DateTime(2020, 1, 10, 14, 0, 0, DateTimeKind.Utc));
            BigtableVersion timestamp_minus_hr = new BigtableVersion(new DateTime(2020, 1, 10, 13, 0, 0, DateTimeKind.Utc));

            MutateRowsRequest.Types.Entry[] entries =
            {
                Mutations.CreateEntry(new BigtableByteString("phone#4c410523#20190501"),
                                      Mutations.SetCell("cell_plan",                                                "data_plan_01gb",  "false",           timestamp),
                                      Mutations.SetCell("cell_plan",                                                "data_plan_01gb",  "true",            timestamp_minus_hr),
                                      Mutations.SetCell("cell_plan",                                                "data_plan_05gb",  "true",            timestamp),
                                      Mutations.SetCell("stats_summary",                                            "connected_cell",  "1",               timestamp),
                                      Mutations.SetCell("stats_summary",                                            "connected_wifi",  "1",               timestamp),
                                      Mutations.SetCell("stats_summary",                                            "os_build",        "PQ2A.190405.003", timestamp)),
                Mutations.CreateEntry(new BigtableByteString("phone#4c410523#20190502"),
                                      Mutations.SetCell("cell_plan",                                                "data_plan_05gb",  "true",            timestamp),
                                      Mutations.SetCell("stats_summary",                                            "connected_cell",  "1",               timestamp),
                                      Mutations.SetCell("stats_summary",                                            "connected_wifi",  "1",               timestamp),
                                      Mutations.SetCell("stats_summary",                                            "os_build",        "PQ2A.190405.004", timestamp)),
                Mutations.CreateEntry(new BigtableByteString("phone#4c410523#20190505"),
                                      Mutations.SetCell("cell_plan",                                                "data_plan_05gb",  "true",            timestamp),
                                      Mutations.SetCell("stats_summary",                                            "connected_cell",  "0",               timestamp),
                                      Mutations.SetCell("stats_summary",                                            "connected_wifi",  "1",               timestamp),
                                      Mutations.SetCell("stats_summary",                                            "os_build",        "PQ2A.190406.000", timestamp)),
                Mutations.CreateEntry(new BigtableByteString("phone#5c10102#20190501"),
                                      Mutations.SetCell("cell_plan",                                                "data_plan_10gb",  "true",            timestamp),
                                      Mutations.SetCell("stats_summary",                                            "connected_cell",  "1",               timestamp),
                                      Mutations.SetCell("stats_summary",                                            "connected_wifi",  "1",               timestamp),
                                      Mutations.SetCell("stats_summary",                                            "os_build",        "PQ2A.190401.002", timestamp)),
                Mutations.CreateEntry(new BigtableByteString("phone#5c10102#20190502"),
                                      Mutations.SetCell("cell_plan",                                                "data_plan_10gb",  "true",            timestamp),
                                      Mutations.SetCell("stats_summary",                                            "connected_cell",  "1",               timestamp),
                                      Mutations.SetCell("stats_summary",                                            "connected_wifi",  "0",               timestamp),
                                      Mutations.SetCell("stats_summary",                                            "os_build",        "PQ2A.190406.000", timestamp))
            };

            bigtableClient.MutateRows(tableName, entries);
        }
コード例 #14
0
ファイル: Reads.cs プロジェクト: yyuumd/dotnet-docs-samples
        // Write your code here.
        // [START_EXCLUDE]
        // [START bigtable_reads_row]

        /// <summary>
        /// /// Reads one row from an existing table.
        ///</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 readRow(
            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);
            Row            row            = bigtableClient.ReadRow(tableName, rowKey: "phone#4c410523#20190501");

            return(printRow(row));
        }
コード例 #15
0
ファイル: Reads.cs プロジェクト: yyuumd/dotnet-docs-samples
        // [END bigtable_reads_row]


        // [START bigtable_reads_row_partial]

        /// <summary>
        /// /// Reads part of one row from an existing table.
        ///</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 readRowPartial(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);
            String         rowkey         = "phone#4c410523#20190501";
            RowFilter      filter         = RowFilters.ColumnQualifierExact("os_build");
            Row            row            = bigtableClient.ReadRow(tableName, rowkey, filter);

            return(printRow(row));
        }
 /// <summary>Snippet for MutateRow</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateRow1ResourceNames()
 {
     // Create client
     BigtableClient bigtableClient = BigtableClient.Create();
     // Initialize request argument(s)
     TableName              tableName = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]");
     ByteString             rowKey    = ByteString.Empty;
     IEnumerable <Mutation> mutations = new Mutation[] { new Mutation(), };
     // Make the request
     MutateRowResponse response = bigtableClient.MutateRow(tableName, rowKey, mutations);
 }
コード例 #17
0
 /// <summary>Snippet for MutateRow</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateRow1()
 {
     // Create client
     BigtableClient bigtableClient = BigtableClient.Create();
     // Initialize request argument(s)
     string                 tableName = "projects/[PROJECT]/instances/[INSTANCE]/tables/[TABLE]";
     ByteString             rowKey    = ByteString.Empty;
     IEnumerable <Mutation> mutations = new Mutation[] { new Mutation(), };
     // Make the request
     MutateRowResponse response = bigtableClient.MutateRow(tableName, rowKey, mutations);
 }
コード例 #18
0
        public static async Task HasNoValuesAsync(
            BigtableClient client,
            TableName tableName,
            BigtableByteString rowKey,
            string familyName = null)
        {
            var filter = familyName == null
                ? RowFilters.PassAllFilter()
                : RowFilters.FamilyNameExact(familyName);

            Assert.Null(await client.ReadRowAsync(tableName, rowKey, filter));
        }
コード例 #19
0
 /// <summary>Snippet for MutateRow</summary>
 public void MutateRow()
 {
     // Snippet: MutateRow(TableName,ByteString,IEnumerable<Mutation>,CallSettings)
     // Create client
     BigtableClient bigtableClient = BigtableClient.Create();
     // Initialize request argument(s)
     TableName              tableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]");
     ByteString             rowKey    = ByteString.CopyFromUtf8("");
     IEnumerable <Mutation> mutations = new List <Mutation>();
     // Make the request
     MutateRowResponse response = bigtableClient.MutateRow(tableName, rowKey, mutations);
     // End snippet
 }
コード例 #20
0
 public BigtableJournal(BigtableJournalSettings settings, BigtableTransportSerializationSettings transportSerializationSettings)
 {
     _log.Debug($"{nameof(BigtableJournal)}: constructing, with table name '{settings.TableName}'");
     _tableName      = TableName.Parse(settings.TableName);
     _family         = settings.FamilyName;
     _bigtableClient = BigtableClient.Create();
     _serializer     = Context.System.Serialization.FindSerializerForType(PersistentRepresentationType);
     _transportSerializationFallbackAddress = transportSerializationSettings.GetFallbackAddress(Context);
     _serializeWithTransport = settings.EnableSerializationWithTransport;
     _transportSerializationFallbackAddress = _serializeWithTransport ? transportSerializationSettings.GetFallbackAddress(Context) : null;
     _log.Debug($"EnableSerializationWithTransport: {_serializeWithTransport}");
     _log.Debug($"TransportSerializationFallbackAddress: {_transportSerializationFallbackAddress}");
 }
コード例 #21
0
        /// <summary>Snippet for MutateRowAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task MutateRow2ResourceNamesAsync()
        {
            // Create client
            BigtableClient bigtableClient = await BigtableClient.CreateAsync();

            // Initialize request argument(s)
            TableName              tableName = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]");
            ByteString             rowKey    = ByteString.Empty;
            IEnumerable <Mutation> mutations = new Mutation[] { new Mutation(), };
            string appProfileId = "";
            // Make the request
            MutateRowResponse response = await bigtableClient.MutateRowAsync(tableName, rowKey, mutations, appProfileId);
        }
コード例 #22
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);
 }
コード例 #23
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);
 }
        /// <summary>Snippet for MutateRowAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task MutateRow2Async()
        {
            // Create client
            BigtableClient bigtableClient = await BigtableClient.CreateAsync();

            // Initialize request argument(s)
            string                 tableName    = "projects/[PROJECT]/instances/[INSTANCE]/tables/[TABLE]";
            ByteString             rowKey       = ByteString.Empty;
            IEnumerable <Mutation> mutations    = new Mutation[] { new Mutation(), };
            string                 appProfileId = "";
            // Make the request
            MutateRowResponse response = await bigtableClient.MutateRowAsync(tableName, rowKey, mutations, appProfileId);
        }
コード例 #25
0
 public void ReadModifyWriteRow()
 {
     // Snippet: ReadModifyWriteRow(string,ByteString,IEnumerable<ReadModifyWriteRule>,CallSettings)
     // Create client
     BigtableClient bigtableClient = BigtableClient.Create();
     // Initialize request argument(s)
     string     formattedTableName           = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]").ToString();
     ByteString rowKey                       = ByteString.CopyFromUtf8("");
     IEnumerable <ReadModifyWriteRule> rules = new List <ReadModifyWriteRule>();
     // Make the request
     ReadModifyWriteRowResponse response = bigtableClient.ReadModifyWriteRow(formattedTableName, rowKey, rules);
     // End snippet
 }
コード例 #26
0
 /// <summary>Snippet for MutateRow</summary>
 public void MutateRow2()
 {
     // Snippet: MutateRow(string, ByteString, IEnumerable<Mutation>, string, CallSettings)
     // Create client
     BigtableClient bigtableClient = BigtableClient.Create();
     // Initialize request argument(s)
     string                 tableName    = "projects/[PROJECT]/instances/[INSTANCE]/tables/[TABLE]";
     ByteString             rowKey       = ByteString.Empty;
     IEnumerable <Mutation> mutations    = new Mutation[] { new Mutation(), };
     string                 appProfileId = "";
     // Make the request
     MutateRowResponse response = bigtableClient.MutateRow(tableName, rowKey, mutations, appProfileId);
     // End snippet
 }
コード例 #27
0
ファイル: Reads.cs プロジェクト: yyuumd/dotnet-docs-samples
        // [END bigtable_reads_row_partial]

        // [START bigtable_reads_rows]


        /// <summary>
        /// /// Reads multiple rows from an existing table.
        ///</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 readRows(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);

            RowSet         rowSet         = RowSet.FromRowKeys("phone#4c410523#20190501", "phone#4c410523#20190502");
            ReadRowsStream readRowsStream = bigtableClient.ReadRows(tableName, rowSet);

            string result = "";

            readRowsStream.ForEach(row => result += printRow(row));

            return(result);
        }
コード例 #28
0
 /// <summary>Snippet for MutateRow</summary>
 public void MutateRow2ResourceNames()
 {
     // Snippet: MutateRow(TableName, ByteString, 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;
     IEnumerable <Mutation> mutations = new Mutation[] { new Mutation(), };
     string appProfileId = "";
     // Make the request
     MutateRowResponse response = bigtableClient.MutateRow(tableName, rowKey, mutations, appProfileId);
     // End snippet
 }
コード例 #29
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
 }
コード例 #30
0
ファイル: Reads.cs プロジェクト: yyuumd/dotnet-docs-samples
        // [END bigtable_reads_prefix]

        // [START bigtable_reads_filter]

        /// <summary>
        /// /// Reads using a filter from an existing table.
        ///</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 readFilter(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);

            RowFilter filter = RowFilters.ValueRegex("PQ2A.*");

            ReadRowsStream readRowsStream = bigtableClient.ReadRows(tableName, filter: filter);
            string         result         = "";

            readRowsStream.ForEach(row => result += printRow(row));

            return(result);
        }