/// <summary>
 ///
 /// </summary>
 /// <param name="request">
 /// The request object containing all of the parameters for the API call.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// The RPC response.
 /// </returns>
 public override GetSnapshotResponse GetSnapshot(
     GetSnapshotRequest request,
     gaxgrpc::CallSettings callSettings = null)
 {
     Modify_GetSnapshotRequest(ref request, ref callSettings);
     return(_callGetSnapshot.Sync(request, callSettings));
 }
        /**
         * Creates a point in time snapshot of a file system and waits for it to become available. Note that snapshot
         * names are immutable and must be unique amongst all non-DELETED snapshots for a file system.
         *
         * We recommend using a retry token on these requests so that if you receive a timeout or server error
         * and need to retry the request you won't run the risk of creating multiple resources.
         *
         * @param fsClient the service client used to communicate with the File Storage service
         * @param fileSystem the file system to create the snapshot of
         */
        private static async Task <Snapshot> CreateSnapshot(FileStorageClient fsClient, FileSystem fileSystem)
        {
            logger.Info("Creating Snapshot...");

            CreateSnapshotDetails createSnapshotDetails = new CreateSnapshotDetails
            {
                FileSystemId = fileSystem.Id,
                Name         = "example_snapshot"
            };
            CreateSnapshotRequest createRequest = new CreateSnapshotRequest
            {
                CreateSnapshotDetails = createSnapshotDetails
            };
            CreateSnapshotResponse createResponse = await fsClient.CreateSnapshot(createRequest);

            logger.Info($"Created snapshot: {createResponse.Snapshot.Name}");

            logger.Info($"Waiting for snapshot to become available");
            GetSnapshotRequest getRequest = new GetSnapshotRequest
            {
                SnapshotId = createResponse.Snapshot.Id
            };
            GetSnapshotResponse getResponse = fsClient.Waiters.ForSnapshot(getRequest, Snapshot.LifecycleStateEnum.Active).Execute();

            logger.Info($"Snapshot state: {getResponse.Snapshot.LifecycleState}");

            return(getResponse.Snapshot);
        }
Exemplo n.º 3
0
        public void GetSnapshotRequestObject()
        {
            moq::Mock <SnapshotsV1Beta3.SnapshotsV1Beta3Client> mockGrpcClient = new moq::Mock <SnapshotsV1Beta3.SnapshotsV1Beta3Client>(moq::MockBehavior.Strict);
            GetSnapshotRequest request = new GetSnapshotRequest
            {
                ProjectId  = "project_id43ad98b0",
                SnapshotId = "snapshot_id3456a275",
                Location   = "locatione09d18d5",
            };
            Snapshot expectedResponse = new Snapshot
            {
                Id             = "id74b70bb8",
                ProjectId      = "project_id43ad98b0",
                SourceJobId    = "source_job_id1406915d",
                CreationTime   = new wkt::Timestamp(),
                Ttl            = new wkt::Duration(),
                State          = SnapshotState.UnknownSnapshotState,
                PubsubMetadata =
                {
                    new PubsubSnapshotMetadata(),
                },
                Description   = "description2cf9da67",
                DiskSizeBytes = -5516951742914183668L,
                Region        = "regionedb20d96",
            };

            mockGrpcClient.Setup(x => x.GetSnapshot(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SnapshotsV1Beta3Client client = new SnapshotsV1Beta3ClientImpl(mockGrpcClient.Object, null);
            Snapshot response             = client.GetSnapshot(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 4
0
        public GetSnapshotRequestTests()
        {
            var request  = new GetSnapshotRequest("repos", "snap");
            var response = this._client.GetSnapshot(request);

            this._status = response.ConnectionStatus;
        }
Exemplo n.º 5
0
        public async Task GetSnapshotAsync2()
        {
            Mock <BigtableTableAdmin.BigtableTableAdminClient> mockGrpcClient = new Mock <BigtableTableAdmin.BigtableTableAdminClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            GetSnapshotRequest request = 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(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Snapshot>(Task.FromResult(expectedResponse), null, null, null, null));
            BigtableTableAdminClient client = new BigtableTableAdminClientImpl(mockGrpcClient.Object, null);
            Snapshot response = await client.GetSnapshotAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 6
0
        public void GetRequestObject()
        {
            moq::Mock <Snapshots.SnapshotsClient> mockGrpcClient = new moq::Mock <Snapshots.SnapshotsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetSnapshotRequest request = new GetSnapshotRequest
            {
                Project  = "projectaa6ff846",
                Snapshot = "snapshotded322c3",
            };
            Snapshot expectedResponse = new Snapshot
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp     = "creation_timestamp235e59a1",
                SnapshotEncryptionKey = new CustomerEncryptionKey(),
                LicenseCodes          =
                {
                    -3549522739643304114L,
                },
                ChainName        = "chain_name66f3d828",
                LabelFingerprint = "label_fingerprint06ccff3a",
                Status           = "status5444cb9a",
                DiskSizeGb       = 7103353205508136450L,
                StorageLocations =
                {
                    "storage_locationse772402d",
                },
                Licenses =
                {
                    "licensesd1cc2f9d",
                },
                LocationHint       = "location_hint666f366c",
                Description        = "description2cf9da67",
                StorageBytes       = 8453704516828373557L,
                DownloadBytes      = -6512123273633363558L,
                SourceDisk         = "source_disk0eec086f",
                SourceDiskId       = "source_disk_id020f9fb8",
                SelfLink           = "self_link7e87f12d",
                AutoCreated        = true,
                SatisfiesPzs       = false,
                StorageBytesStatus = "storage_bytes_statusfdb1e9b2",
                Labels             =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                SourceDiskEncryptionKey = new CustomerEncryptionKey(),
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SnapshotsClient client   = new SnapshotsClientImpl(mockGrpcClient.Object, null);
            Snapshot        response = client.Get(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="request">
 /// The request object containing all of the parameters for the API call.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// A Task containing the RPC response.
 /// </returns>
 public override stt::Task <GetSnapshotResponse> GetSnapshotAsync(
     GetSnapshotRequest request,
     gaxgrpc::CallSettings callSettings = null)
 {
     Modify_GetSnapshotRequest(ref request, ref callSettings);
     return(_callGetSnapshot.Async(request, callSettings));
 }
        public void Execute(Arguments arguments)
        {
            GetSnapshotRequest request  = CreateRequest(arguments);
            Snapshot           snapshot = mediator.Send(request).Result;

            SnapshotView snapshotView = new SnapshotView(snapshot);

            snapshotView.Display();
        }
        /// <summary>
        /// Creates a waiter using the provided configuration.
        /// </summary>
        /// <param name="request">Request to send.</param>
        /// <param name="config">Wait Configuration</param>
        /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param>
        /// <returns>a new Oci.common.Waiter instance</returns>
        public Waiter <GetSnapshotRequest, GetSnapshotResponse> ForSnapshot(GetSnapshotRequest request, WaiterConfiguration config, params Snapshot.LifecycleStateEnum[] targetStates)
        {
            var agent = new WaiterAgent <GetSnapshotRequest, GetSnapshotResponse>(
                request,
                request => client.GetSnapshot(request),
                response => targetStates.Contains(response.Snapshot.LifecycleState.Value),
                targetStates.Contains(Snapshot.LifecycleStateEnum.Deleted)
                );

            return(new Waiter <GetSnapshotRequest, GetSnapshotResponse>(config, agent));
        }
 /// <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 GetSnapshotRequestObject()
 {
     // Create client
     BigtableTableAdminClient bigtableTableAdminClient = BigtableTableAdminClient.Create();
     // Initialize request argument(s)
     GetSnapshotRequest request = new GetSnapshotRequest
     {
         SnapshotName = SnapshotName.FromProjectInstanceClusterSnapshot("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"),
     };
     // Make the request
     Snapshot response = bigtableTableAdminClient.GetSnapshot(request);
 }
        public async Task <SnapshotEntity> GetSnapshot(GetSnapshotRequest request)
        {
            var snapshotNoSql = _snapshotReader.Get(SnapshotNoSqlEntity.GeneratePartitionKey(request.WalletId),
                                                    SnapshotNoSqlEntity.GenerateRowKey(request.AssetId));

            if (snapshotNoSql.Entity != null)
            {
                return(snapshotNoSql.Entity);
            }

            var snapshot = await _snapshotGrpcService.GetSnapshot(request);

            return(snapshot);
        }
Exemplo n.º 12
0
 /// <summary>Snippet for GetSnapshot</summary>
 public void GetSnapshot_RequestObject()
 {
     // Snippet: GetSnapshot(GetSnapshotRequest,CallSettings)
     // Create client
     BigtableTableAdminClient bigtableTableAdminClient = BigtableTableAdminClient.Create();
     // Initialize request argument(s)
     GetSnapshotRequest request = new GetSnapshotRequest
     {
         SnapshotName = new SnapshotName("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"),
     };
     // Make the request
     Snapshot response = bigtableTableAdminClient.GetSnapshot(request);
     // End snippet
 }
 /// <summary>Snippet for Get</summary>
 public void GetRequestObject()
 {
     // Snippet: Get(GetSnapshotRequest, CallSettings)
     // Create client
     SnapshotsClient snapshotsClient = SnapshotsClient.Create();
     // Initialize request argument(s)
     GetSnapshotRequest request = new GetSnapshotRequest
     {
         Project  = "",
         Snapshot = "",
     };
     // Make the request
     Snapshot response = snapshotsClient.Get(request);
     // End snippet
 }
Exemplo n.º 14
0
        /**
         * Deletes a snapshot and waits for it to be deleted.
         *
         * @param fsClient the service client used to communicate with the File Storage service
         * @param snapshot the snapshot to delete
         */
        private static async Task DeleteSnapshot(FileStorageClient fsClient, Snapshot snapshot)
        {
            logger.Info("Deleting snapshot");

            DeleteSnapshotRequest deleteSnapshotRequest = new DeleteSnapshotRequest
            {
                SnapshotId = snapshot.Id
            };
            await fsClient.DeleteSnapshot(deleteSnapshotRequest);

            GetSnapshotRequest getSnapshotRequest = new GetSnapshotRequest
            {
                SnapshotId = snapshot.Id
            };

            fsClient.Waiters.ForSnapshot(getSnapshotRequest, Snapshot.LifecycleStateEnum.Deleted).Execute();
        }
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetSnapshotRequest, CallSettings)
            // Additional: GetAsync(GetSnapshotRequest, CancellationToken)
            // Create client
            SnapshotsClient snapshotsClient = await SnapshotsClient.CreateAsync();

            // Initialize request argument(s)
            GetSnapshotRequest request = new GetSnapshotRequest
            {
                Project  = "",
                Snapshot = "",
            };
            // Make the request
            Snapshot response = await snapshotsClient.GetAsync(request);

            // End snippet
        }
Exemplo n.º 16
0
        /// <summary>
        /// excute request
        /// </summary>
        /// <param name="cosRequest"></param>
        /// <param name="cosResult"></param>
        /// <param name="credentialProvider"></param>
        /// <exception cref="COSXML.CosException.CosClientException">CosClientException</exception>
        /// <exception cref="COSXML.CosException.CosServerException">CosServerException</exception>
        public void InternalExcute(CosRequest cosRequest, CosResult cosResult, QCloudCredentialProvider credentialProvider)
        {
            try
            {
                Request request = CreateRequest(cosRequest, credentialProvider);
                //extern informations exchange
                cosResult.ExternInfo(cosRequest);

                Response response;

                if (cosRequest is GetObjectRequest)
                {
                    GetObjectRequest getObjectRequest = cosRequest as GetObjectRequest;

                    response = new CosResponse(cosResult, getObjectRequest.GetSaveFilePath(), getObjectRequest.GetLocalFileOffset(),
                                               getObjectRequest.GetCosProgressCallback());
                }
                else if (cosRequest is GetSnapshotRequest)
                {
                    GetSnapshotRequest getSnapshotRequest = cosRequest as GetSnapshotRequest;
                    response = new CosResponse(cosResult, getSnapshotRequest.GetSaveFilePath(), 0, null);
                }
                else
                {
                    response = new CosResponse(cosResult, null, -1L, null);
                }

                cosRequest.BindRequest(request);
                CommandTask.Excute(request, response, config);
            }
            catch (CosServerException)
            {
                throw;
            }
            catch (CosClientException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new CosClientException((int)CosClientError.BadRequest, ex.Message, ex);
            }
        }
Exemplo n.º 17
0
        private void HandleOutput(GetSnapshotRequest request)
        {
            var waiterConfig = new WaiterConfiguration
            {
                MaxAttempts           = MaxWaitAttempts,
                GetNextDelayInSeconds = (_) => WaitIntervalSeconds
            };

            switch (ParameterSetName)
            {
            case LifecycleStateParamSet:
                response = client.Waiters.ForSnapshot(request, waiterConfig, WaitForLifecycleState).Execute();
                break;

            case Default:
                response = client.GetSnapshot(request).GetAwaiter().GetResult();
                break;
            }
            WriteOutput(response, response.Snapshot);
        }
Exemplo n.º 18
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            GetSnapshotRequest request;

            try
            {
                request = new GetSnapshotRequest
                {
                    SnapshotId   = SnapshotId,
                    OpcRequestId = OpcRequestId
                };

                HandleOutput(request);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Exemplo n.º 19
0
 public void TestGetSnapshot()
 {
     try
     {
         string             key     = videoKey;
         GetSnapshotRequest request = new GetSnapshotRequest(bucket, key, 1.5F, localSnapshotFilePath);
         GetSnapshotResult  result  = QCloudServer.Instance().cosXml.GetSnapshot(request);
         Assert.True(File.Exists(localSnapshotFilePath));
         Assert.AreEqual(result.httpCode, 200);
     }
     catch (COSXML.CosException.CosClientException clientEx)
     {
         Console.WriteLine("CosClientException: " + clientEx.Message);
         Assert.Fail();
     }
     catch (COSXML.CosException.CosServerException serverEx)
     {
         Console.WriteLine("CosServerException: " + serverEx.GetInfo());
         Assert.Fail();
     }
 }
 /// <summary>
 /// Gets information about a snapshot.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <Snapshot> GetSnapshotAsync(GetSnapshotRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
Exemplo n.º 21
0
 /// <summary>
 /// Creates a waiter using default wait configuration.
 /// </summary>
 /// <param name="request">Request to send.</param>
 /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param>
 /// <returns>a new Oci.common.Waiter instance</returns>
 public Waiter <GetSnapshotRequest, GetSnapshotResponse> ForSnapshot(GetSnapshotRequest request, params Snapshot.LifecycleStateEnum[] targetStates)
 {
     return(this.ForSnapshot(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates));
 }
Exemplo n.º 22
0
        public async stt::Task GetAsync()
        {
            moq::Mock <Snapshots.SnapshotsClient> mockGrpcClient = new moq::Mock <Snapshots.SnapshotsClient>(moq::MockBehavior.Strict);
            GetSnapshotRequest request = new GetSnapshotRequest
            {
                Project  = "projectaa6ff846",
                Snapshot = "snapshotded322c3",
            };
            Snapshot expectedResponse = new Snapshot
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp     = "creation_timestamp235e59a1",
                SnapshotEncryptionKey = new CustomerEncryptionKey(),
                LicenseCodes          =
                {
                    -3549522739643304114L,
                },
                ChainName        = "chain_name66f3d828",
                LabelFingerprint = "label_fingerprint06ccff3a",
                Status           = Snapshot.Types.Status.Deleting,
                DiskSizeGb       = 7103353205508136450L,
                StorageLocations =
                {
                    "storage_locationse772402d",
                },
                Licenses =
                {
                    "licensesd1cc2f9d",
                },
                LocationHint       = "location_hint666f366c",
                Description        = "description2cf9da67",
                StorageBytes       = 8453704516828373557L,
                DownloadBytes      = -6512123273633363558L,
                SourceDisk         = "source_disk0eec086f",
                SourceDiskId       = "source_disk_id020f9fb8",
                SelfLink           = "self_link7e87f12d",
                AutoCreated        = true,
                SatisfiesPzs       = false,
                StorageBytesStatus = Snapshot.Types.StorageBytesStatus.UndefinedStorageBytesStatus,
                Labels             =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                SourceDiskEncryptionKey = new CustomerEncryptionKey(),
            };

            mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Snapshot>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            SnapshotsClient client = new SnapshotsClientImpl(mockGrpcClient.Object, null);
            Snapshot        responseCallSettings = await client.GetAsync(request.Project, request.Snapshot, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Snapshot responseCancellationToken = await client.GetAsync(request.Project, request.Snapshot, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
		public GetSnapshotRequestTests()
		{
			var request = new GetSnapshotRequest("my-repository", "my-snap");
			var response = this._client.GetSnapshot(request);
			this._status = response.ConnectionStatus;
		}
 partial void Modify_GetSnapshotRequest(ref GetSnapshotRequest request, ref gaxgrpc::CallSettings settings);
 /// <summary>
 /// Gets information about a snapshot.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <Snapshot> GetSnapshotAsync(GetSnapshotRequest request, st::CancellationToken cancellationToken) =>
 GetSnapshotAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
 public Task <GetSnapshotResponse> GetAsync(GetSnapshotRequest request, CancellationToken cancellationToken = default)
 {
     request.BeforeRequest();
     return(DoRequestAsync <GetSnapshotRequest, GetSnapshotResponse>(request, cancellationToken));
 }
Exemplo n.º 27
0
 public async Task <SnapshotEntity> GetSnapshot(GetSnapshotRequest request) => await _cacheManager.GetSnapshot(request.WalletId, request.AssetId);
 /// <summary>
 /// Gets information about a snapshot.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public virtual Snapshot GetSnapshot(GetSnapshotRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
Exemplo n.º 29
0
 /// <summary>
 /// 获取媒体文件某个时间的截图
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public GetSnapshotResult GetSnapshot(GetSnapshotRequest request)
 {
     return(Execute(request, new GetSnapshotResult()));
 }
 public GetSnapshotResponse Get(GetSnapshotRequest request)
 {
     request.BeforeRequest();
     return(DoRequest <GetSnapshotRequest, GetSnapshotResponse>(request));
 }