public async stt::Task GetRepositoryRequestObjectAsync() { moq::Mock <ArtifactRegistry.ArtifactRegistryClient> mockGrpcClient = new moq::Mock <ArtifactRegistry.ArtifactRegistryClient>(moq::MockBehavior.Strict); GetRepositoryRequest request = new GetRepositoryRequest { RepositoryName = RepositoryName.FromProjectLocationRepository("[PROJECT]", "[LOCATION]", "[REPOSITORY]"), }; Repository expectedResponse = new Repository { RepositoryName = RepositoryName.FromProjectLocationRepository("[PROJECT]", "[LOCATION]", "[REPOSITORY]"), Format = Repository.Types.Format.Yum, Description = "description2cf9da67", Labels = { { "key8a0b6e3c", "value60c16320" }, }, CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), KmsKeyName = "kms_key_name06bd122b", }; mockGrpcClient.Setup(x => x.GetRepositoryAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Repository>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ArtifactRegistryClient client = new ArtifactRegistryClientImpl(mockGrpcClient.Object, null); Repository responseCallSettings = await client.GetRepositoryAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Repository responseCancellationToken = await client.GetRepositoryAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
internal GetRepositoryResponse GetRepository(GetRepositoryRequest request) { var marshaller = new GetRepositoryRequestMarshaller(); var unmarshaller = GetRepositoryResponseUnmarshaller.Instance; return(Invoke <GetRepositoryRequest, GetRepositoryResponse>(request, marshaller, unmarshaller)); }
public void GetRepository() { moq::Mock <ArtifactRegistry.ArtifactRegistryClient> mockGrpcClient = new moq::Mock <ArtifactRegistry.ArtifactRegistryClient>(moq::MockBehavior.Strict); GetRepositoryRequest request = new GetRepositoryRequest { RepositoryName = RepositoryName.FromProjectLocationRepository("[PROJECT]", "[LOCATION]", "[REPOSITORY]"), }; Repository expectedResponse = new Repository { RepositoryName = RepositoryName.FromProjectLocationRepository("[PROJECT]", "[LOCATION]", "[REPOSITORY]"), Format = Repository.Types.Format.Yum, Description = "description2cf9da67", Labels = { { "key8a0b6e3c", "value60c16320" }, }, CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), KmsKeyName = "kms_key_name06bd122b", }; mockGrpcClient.Setup(x => x.GetRepository(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ArtifactRegistryClient client = new ArtifactRegistryClientImpl(mockGrpcClient.Object, null); Repository response = client.GetRepository(request.Name); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary> /// Initiates the asynchronous execution of the GetRepository operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetRepository operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task <GetRepositoryResponse> GetRepositoryAsync(GetRepositoryRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetRepositoryRequestMarshaller(); var unmarshaller = GetRepositoryResponseUnmarshaller.Instance; return(InvokeAsync <GetRepositoryRequest, GetRepositoryResponse>(request, marshaller, unmarshaller, cancellationToken)); }
/// <summary> /// gets the Repository information /// </summary> /// <param name="codeCommit"></param> /// <param name="repositoryName"></param> /// <param name="commitId"></param> /// <returns></returns> private GetRepositoryResponse GetRepositoryInfo(AmazonCodeCommitClient codeCommit, string repositoryName) { GetRepositoryRequest repoRequest = new GetRepositoryRequest() { RepositoryName = repositoryName }; GetRepositoryResponse returnValue = codeCommit.GetRepositoryAsync(repoRequest).GetAwaiter().GetResult(); return(returnValue); }
/// <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 <GetRepositoryRequest, GetRepositoryResponse> ForRepository(GetRepositoryRequest request, WaiterConfiguration config, params Repository.LifecycleStateEnum[] targetStates) { var agent = new WaiterAgent <GetRepositoryRequest, GetRepositoryResponse>( request, request => client.GetRepository(request), response => targetStates.Contains(response.Repository.LifecycleState.Value), targetStates.Contains(Repository.LifecycleStateEnum.Deleted) ); return(new Waiter <GetRepositoryRequest, GetRepositoryResponse>(config, agent)); }
/// <summary>Snippet for GetRepository</summary> public void GetRepositoryRequestObject() { // Snippet: GetRepository(GetRepositoryRequest, CallSettings) // Create client ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.Create(); // Initialize request argument(s) GetRepositoryRequest request = new GetRepositoryRequest { RepositoryName = RepositoryName.FromProjectLocationRepository("[PROJECT]", "[LOCATION]", "[REPOSITORY]"), }; // Make the request Repository response = artifactRegistryClient.GetRepository(request); // End snippet }
/// <summary>Snippet for GetRepositoryAsync</summary> public async Task GetRepositoryRequestObjectAsync() { // Snippet: GetRepositoryAsync(GetRepositoryRequest, CallSettings) // Additional: GetRepositoryAsync(GetRepositoryRequest, CancellationToken) // Create client ArtifactRegistryClient artifactRegistryClient = await ArtifactRegistryClient.CreateAsync(); // Initialize request argument(s) GetRepositoryRequest request = new GetRepositoryRequest { RepositoryName = RepositoryName.FromProjectLocationRepository("[PROJECT]", "[LOCATION]", "[REPOSITORY]"), }; // Make the request Repository response = await artifactRegistryClient.GetRepositoryAsync(request); // End snippet }
private void HandleOutput(GetRepositoryRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForRepository(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetRepository(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.Repository); }
protected override void ProcessRecord() { base.ProcessRecord(); GetRepositoryRequest request; try { request = new GetRepositoryRequest { RepositoryId = RepositoryId, OpcRequestId = OpcRequestId }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Gets a repository. /// </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 Repository GetRepository(GetRepositoryRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
partial void Modify_GetRepositoryRequest(ref GetRepositoryRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Gets a repository. /// </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 <Repository> GetRepositoryAsync(GetRepositoryRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <summary> /// Gets a repository. /// </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 <Repository> GetRepositoryAsync(GetRepositoryRequest request, st::CancellationToken cancellationToken) => GetRepositoryAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Gets a repository. /// </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 Repository GetRepository(GetRepositoryRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetRepositoryRequest(ref request, ref callSettings); return(_callGetRepository.Sync(request, callSettings)); }
/// <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 <GetRepositoryRequest, GetRepositoryResponse> ForRepository(GetRepositoryRequest request, params Repository.LifecycleStateEnum[] targetStates) { return(this.ForRepository(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }
/// <summary> /// Gets a repository. /// </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 <Repository> GetRepositoryAsync(GetRepositoryRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetRepositoryRequest(ref request, ref callSettings); return(_callGetRepository.Async(request, callSettings)); }