Exemple #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (VariableName.Length != 0)
            {
                hash ^= VariableName.GetHashCode();
            }
            if (InitialValueName.Length != 0)
            {
                hash ^= InitialValueName.GetHashCode();
            }
            if (InitializerName.Length != 0)
            {
                hash ^= InitializerName.GetHashCode();
            }
            if (SnapshotName.Length != 0)
            {
                hash ^= SnapshotName.GetHashCode();
            }
            if (saveSliceInfoDef_ != null)
            {
                hash ^= SaveSliceInfoDef.GetHashCode();
            }
            if (IsResource != false)
            {
                hash ^= IsResource.GetHashCode();
            }
            return(hash);
        }
Exemple #2
0
        public async Task GetSnapshotAsync()
        {
            Mock <BigtableTableAdmin.BigtableTableAdminClient> mockGrpcClient = new Mock <BigtableTableAdmin.BigtableTableAdminClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            GetSnapshotRequest expectedRequest = new GetSnapshotRequest
            {
                SnapshotName = new SnapshotName("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"),
            };
            Snapshot expectedResponse = new Snapshot
            {
                SnapshotName  = new SnapshotName("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"),
                DataSizeBytes = 2110122398L,
                Description   = "description-1724546052",
            };

            mockGrpcClient.Setup(x => x.GetSnapshotAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Snapshot>(Task.FromResult(expectedResponse), null, null, null, null));
            BigtableTableAdminClient client = new BigtableTableAdminClientImpl(mockGrpcClient.Object, null);
            SnapshotName             name   = new SnapshotName("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
            Snapshot response = await client.GetSnapshotAsync(name);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #3
0
        /// <summary>Snippet for CreateTableFromSnapshotAsync</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 CreateTableFromSnapshotRequestObjectAsync()
        {
            // Create client
            BigtableTableAdminClient bigtableTableAdminClient = await BigtableTableAdminClient.CreateAsync();

            // Initialize request argument(s)
            CreateTableFromSnapshotRequest request = new CreateTableFromSnapshotRequest
            {
                ParentAsInstanceName = InstanceName.FromProjectInstance("[PROJECT]", "[INSTANCE]"),
                TableId = "",
                SourceSnapshotAsSnapshotName = SnapshotName.FromProjectInstanceClusterSnapshot("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"),
            };
            // Make the request
            Operation <Table, CreateTableFromSnapshotMetadata> response = await bigtableTableAdminClient.CreateTableFromSnapshotAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <Table, CreateTableFromSnapshotMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            Table result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Table, CreateTableFromSnapshotMetadata> retrievedResponse = await bigtableTableAdminClient.PollOnceCreateTableFromSnapshotAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Table retrievedResult = retrievedResponse.Result;
            }
        }
Exemple #4
0
        /// <summary>Snippet for CreateTableFromSnapshot</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void CreateTableFromSnapshotResourceNames()
        {
            // Create client
            BigtableTableAdminClient bigtableTableAdminClient = BigtableTableAdminClient.Create();
            // Initialize request argument(s)
            InstanceName parent         = InstanceName.FromProjectInstance("[PROJECT]", "[INSTANCE]");
            string       tableId        = "";
            SnapshotName sourceSnapshot = SnapshotName.FromProjectInstanceClusterSnapshot("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
            // Make the request
            Operation <Table, CreateTableFromSnapshotMetadata> response = bigtableTableAdminClient.CreateTableFromSnapshot(parent, tableId, sourceSnapshot);

            // Poll until the returned long-running operation is complete
            Operation <Table, CreateTableFromSnapshotMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Table result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Table, CreateTableFromSnapshotMetadata> retrievedResponse = bigtableTableAdminClient.PollOnceCreateTableFromSnapshot(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Table retrievedResult = retrievedResponse.Result;
            }
        }
 /// <summary>Snippet for GetSnapshot</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetSnapshotResourceNames()
 {
     // Create client
     BigtableTableAdminClient bigtableTableAdminClient = BigtableTableAdminClient.Create();
     // Initialize request argument(s)
     SnapshotName name = SnapshotName.FromProjectInstanceClusterSnapshot("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
     // Make the request
     Snapshot response = bigtableTableAdminClient.GetSnapshot(name);
 }
Exemple #6
0
        /// <summary>Snippet for DeleteSnapshotAsync</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 DeleteSnapshotResourceNamesAsync()
        {
            // Create client
            BigtableTableAdminClient bigtableTableAdminClient = await BigtableTableAdminClient.CreateAsync();

            // Initialize request argument(s)
            SnapshotName name = SnapshotName.FromProjectInstanceClusterSnapshot("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
            // Make the request
            await bigtableTableAdminClient.DeleteSnapshotAsync(name);
        }
Exemple #7
0
 /// <summary>Snippet for GetSnapshot</summary>
 public void GetSnapshot()
 {
     // Snippet: GetSnapshot(SnapshotName,CallSettings)
     // Create client
     BigtableTableAdminClient bigtableTableAdminClient = BigtableTableAdminClient.Create();
     // Initialize request argument(s)
     SnapshotName name = new SnapshotName("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
     // Make the request
     Snapshot response = bigtableTableAdminClient.GetSnapshot(name);
     // End snippet
 }
Exemple #8
0
        /// <summary>Snippet for GetSnapshotAsync</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 GetSnapshotRequestObjectAsync()
        {
            // Create client
            BigtableTableAdminClient bigtableTableAdminClient = await BigtableTableAdminClient.CreateAsync();

            // Initialize request argument(s)
            GetSnapshotRequest request = new GetSnapshotRequest
            {
                SnapshotName = SnapshotName.FromProjectInstanceClusterSnapshot("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"),
            };
            // Make the request
            Snapshot response = await bigtableTableAdminClient.GetSnapshotAsync(request);
        }
        /// <summary>Snippet for DeleteSnapshot</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DeleteSnapshotRequestObject()
        {
            // Create client
            BigtableTableAdminClient bigtableTableAdminClient = BigtableTableAdminClient.Create();
            // Initialize request argument(s)
            DeleteSnapshotRequest request = new DeleteSnapshotRequest
            {
                SnapshotName = SnapshotName.FromProjectInstanceClusterSnapshot("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"),
            };

            // Make the request
            bigtableTableAdminClient.DeleteSnapshot(request);
        }
Exemple #10
0
        /// <summary>Snippet for GetSnapshotAsync</summary>
        public async Task GetSnapshotAsync()
        {
            // Snippet: GetSnapshotAsync(SnapshotName,CallSettings)
            // Additional: GetSnapshotAsync(SnapshotName,CancellationToken)
            // Create client
            BigtableTableAdminClient bigtableTableAdminClient = await BigtableTableAdminClient.CreateAsync();

            // Initialize request argument(s)
            SnapshotName name = new SnapshotName("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
            // Make the request
            Snapshot response = await bigtableTableAdminClient.GetSnapshotAsync(name);

            // End snippet
        }
Exemple #11
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (VariableName.Length != 0)
            {
                hash ^= VariableName.GetHashCode();
            }
            if (InitialValueName.Length != 0)
            {
                hash ^= InitialValueName.GetHashCode();
            }
            if (InitializerName.Length != 0)
            {
                hash ^= InitializerName.GetHashCode();
            }
            if (SnapshotName.Length != 0)
            {
                hash ^= SnapshotName.GetHashCode();
            }
            if (saveSliceInfoDef_ != null)
            {
                hash ^= SaveSliceInfoDef.GetHashCode();
            }
            if (IsResource != false)
            {
                hash ^= IsResource.GetHashCode();
            }
            if (Trainable != false)
            {
                hash ^= Trainable.GetHashCode();
            }
            if (Synchronization != global::Tensorflow.VariableSynchronization.Auto)
            {
                hash ^= Synchronization.GetHashCode();
            }
            if (Aggregation != global::Tensorflow.VariableAggregation.None)
            {
                hash ^= Aggregation.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemple #12
0
        public async Task DeleteSnapshotAsync()
        {
            Mock <BigtableTableAdmin.BigtableTableAdminClient> mockGrpcClient = new Mock <BigtableTableAdmin.BigtableTableAdminClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            DeleteSnapshotRequest expectedRequest = new DeleteSnapshotRequest
            {
                SnapshotName = new SnapshotName("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteSnapshotAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            BigtableTableAdminClient client = new BigtableTableAdminClientImpl(mockGrpcClient.Object, null);
            SnapshotName             name   = new SnapshotName("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
            await client.DeleteSnapshotAsync(name);

            mockGrpcClient.VerifyAll();
        }