Пример #1
0
        /// <summary>
        /// Returns the configuration information of the Lambda function and a presigned URL link
        /// to the .zip file you uploaded with <a>UploadFunction</a> so you can download the .zip
        /// file. Note that the URL is valid for up to 10 minutes. The configuration information
        /// is the same information you provided as parameters when uploading the function.
        ///
        ///
        /// <para>
        /// This operation requires permission for the <code>lambda:GetFunction</code> action.
        /// </para>
        /// </summary>
        /// <param name="functionName">The Lambda function name.</param>
        ///
        /// <returns>The response from the GetFunction service method, as returned by Lambda.</returns>
        /// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
        /// The function or the event source specified in the request does not exist.
        /// </exception>
        /// <exception cref="Amazon.Lambda.Model.ServiceException">
        /// The AWS Lambda service encountered an internal error.
        /// </exception>
        public GetFunctionResponse GetFunction(string functionName)
        {
            var request = new GetFunctionRequest();

            request.FunctionName = functionName;
            return(GetFunction(request));
        }
Пример #2
0
        async static Task InvokeViaSdk(Stream fileStream)
        {
            var lambdaConfig = new AmazonLambdaConfig
            {
                ServiceURL = "http://localhost:4566"
            };

            using var lambda       = new AmazonLambdaClient(lambdaConfig);
            using var memoryStream = new MemoryStream();
            fileStream.CopyTo(memoryStream);

            var getFunctionRequest = new GetFunctionRequest
            {
                FunctionName = "ConverterTronStack-ConverterTronLambda-V6ZBU97Z5XM0"
            };

            var invokeRequest = new InvokeRequest
            {
                FunctionName   = "ConverterTronStack-ConverterTronLambda-V6ZBU97Z5XM0",
                InvocationType = InvocationType.RequestResponse,
                PayloadStream  = memoryStream
            };

            var getThings = await lambda.GetFunctionAsync(getFunctionRequest);

            var response = await lambda.InvokeAsync(invokeRequest);
        }
Пример #3
0
        public async Task Invalidate()
        {
            var fbb = Debugger.BeginRequest();
            int requestDataOffset = GetFunctionRequest.CreateGetFunctionRequest(fbb, Identifier);
            var response          = await Debugger.CommitRequest(
                fbb, RequestData.GetFunctionRequest, requestDataOffset);

            var responseData = new GetFunctionResponse();

            response.GetResponseData(responseData);
            var functionData = responseData.Function;

            this.AddressEnd = functionData.AddressEnd;

            this.MachineCodeStart = functionData.MachineCodeStart;
            this.MachineCodeEnd   = functionData.MachineCodeEnd;

            this.DisasmHirUnoptimized = functionData.DisasmHirRaw;
            this.DisasmHirOptimized   = functionData.DisasmHirOpt;
            if (DisasmHirUnoptimized != null)
            {
                DisasmHirUnoptimized = DisasmHirUnoptimized.Replace("\n", "\r\n");
            }
            if (DisasmHirOptimized != null)
            {
                DisasmHirOptimized = DisasmHirOptimized.Replace("\n", "\r\n");
            }

            OnChanged();
        }
        /// <summary>
        /// Gets registered Azure Functions for a given title id and function name.
        /// </summary>
        public async Task <PlayFabResult <GetFunctionResult> > GetFunctionAsync(GetFunctionRequest request, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            await new PlayFabUtil.SynchronizationContextRemover();

            var requestContext  = request?.AuthenticationContext ?? authenticationContext;
            var requestSettings = apiSettings ?? PlayFabSettings.staticSettings;

            if (requestContext.EntityToken == null)
            {
                throw new PlayFabException(PlayFabExceptionCode.EntityTokenNotSet, "Must call Client Login or GetEntityToken before calling this method");
            }

            var httpResult = await PlayFabHttp.DoPost("/CloudScript/GetFunction", request, "X-EntityToken", requestContext.EntityToken, extraHeaders, requestSettings);

            if (httpResult is PlayFabError)
            {
                var error = (PlayFabError)httpResult;
                PlayFabSettings.GlobalErrorHandler?.Invoke(error);
                return(new PlayFabResult <GetFunctionResult> {
                    Error = error, CustomData = customData
                });
            }

            var resultRawJson = (string)httpResult;
            var resultData    = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject <PlayFabJsonSuccess <GetFunctionResult> >(resultRawJson);
            var result        = resultData.data;

            return(new PlayFabResult <GetFunctionResult> {
                Result = result, CustomData = customData
            });
        }
Пример #5
0
        /// <summary>
        /// Retrieves a function.
        /// </summary>
        /// <param name="request">The request object containing the details to send. Required.</param>
        /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
        /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
        /// <returns>A response object containing details about the completed operation</returns>
        /// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/functions/GetFunction.cs.html">here</a> to see an example of how to use GetFunction API.</example>
        public async Task <GetFunctionResponse> GetFunction(GetFunctionRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
        {
            logger.Trace("Called getFunction");
            Uri                uri            = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/functions/{functionId}".Trim('/')));
            HttpMethod         method         = new HttpMethod("GET");
            HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);

            requestMessage.Headers.Add("Accept", "application/json");
            GenericRetrier      retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
            HttpResponseMessage responseMessage;

            try
            {
                if (retryingClient != null)
                {
                    responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
                }
                else
                {
                    responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
                }
                this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);

                return(Converter.FromHttpResponseMessage <GetFunctionResponse>(responseMessage));
            }
            catch (Exception e)
            {
                logger.Error($"GetFunction failed with error: {e.Message}");
                throw;
            }
        }
Пример #6
0
        internal GetFunctionResponse GetFunction(GetFunctionRequest request)
        {
            var marshaller   = new GetFunctionRequestMarshaller();
            var unmarshaller = GetFunctionResponseUnmarshaller.Instance;

            return(Invoke <GetFunctionRequest, GetFunctionResponse>(request, marshaller, unmarshaller));
        }
Пример #7
0
        /// <summary>
        /// Returns the configuration information of the Lambda function and a presigned URL link
        /// to the .zip file you uploaded with <a>CreateFunction</a> so you can download the .zip
        /// file. Note that the URL is valid for up to 10 minutes. The configuration information
        /// is the same information you provided as parameters when uploading the function.
        ///
        ///
        /// <para>
        /// This operation requires permission for the <code>lambda:GetFunction</code> action.
        /// </para>
        /// </summary>
        /// <param name="functionName">The Lambda function name.   You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length. </param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the GetFunction service method, as returned by Lambda.</returns>
        /// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
        /// The resource (for example, a Lambda function or access policy statement) specified
        /// in the request does not exist.
        /// </exception>
        /// <exception cref="Amazon.Lambda.Model.ServiceException">
        /// The AWS Lambda service encountered an internal error.
        /// </exception>
        /// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
        ///
        /// </exception>
        public Task <GetFunctionResponse> GetFunctionAsync(string functionName, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var request = new GetFunctionRequest();

            request.FunctionName = functionName;
            return(GetFunctionAsync(request, cancellationToken));
        }
Пример #8
0
        /// <summary>
        /// Returns the configuration information of the Lambda function and a presigned URL link
        /// to the .zip file you uploaded with <a>CreateFunction</a> so you can download the .zip
        /// file. Note that the URL is valid for up to 10 minutes. The configuration information
        /// is the same information you provided as parameters when uploading the function.
        ///
        ///
        /// <para>
        /// This operation requires permission for the <code>lambda:GetFunction</code> action.
        /// </para>
        /// </summary>
        /// <param name="functionName">The Lambda function name.   You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length. </param>
        /// <param name="options">
        ///     A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///     procedure using the AsyncState property.
        /// </param>
        ///
        /// <returns>The response from the GetFunction service method, as returned by Lambda.</returns>
        /// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
        /// The resource (for example, a Lambda function or access policy statement) specified
        /// in the request does not exist.
        /// </exception>
        /// <exception cref="Amazon.Lambda.Model.ServiceException">
        /// The AWS Lambda service encountered an internal error.
        /// </exception>
        /// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
        ///
        /// </exception>
        public void GetFunctionAsync(string functionName, AmazonServiceCallback <GetFunctionRequest, GetFunctionResponse> callback, AsyncOptions options = null)
        {
            var request = new GetFunctionRequest();

            request.FunctionName = functionName;
            GetFunctionAsync(request, callback, options);
        }
Пример #9
0
        /**
         * Creates a Function and waits for the it to become available to use.
         *
         * @param fnManagementClient the service client to use to create the Application.
         * @param applicationId the OCID of the Application which owns the Function.
         * @param displayName the display name of created Function.
         * @param image an accessible OCI Registry image implementing the function to be executed.
         * @param memoryInMBs the maximum amount of memory available (128, 256, 512, 1024) to the function in MB.
         * @param timeoutInSeconds the maximum amount of time a function can execute (30 - 120) in seconds.
         * @return the created Function.
         */
        private static async Task <Function> CreateFunction(FunctionsManagementClient fnManagementClient, string applicationId, string image, long memoryInMBs, int timeoutInSeconds)
        {
            logger.Info("Creating function");

            // Create a new function
            var createFunctionDetails = new CreateFunctionDetails
            {
                ApplicationId    = applicationId,
                DisplayName      = FunctionName,
                Image            = image,
                MemoryInMBs      = memoryInMBs,
                TimeoutInSeconds = timeoutInSeconds
            };
            var createFunctionRequest = new CreateFunctionRequest
            {
                CreateFunctionDetails = createFunctionDetails
            };
            var createFunctionResponse = await fnManagementClient.CreateFunction(createFunctionRequest);

            logger.Info("Waiting for Function to be in Active state");
            var getFunctionRequest = new GetFunctionRequest
            {
                FunctionId = createFunctionResponse.Function.Id
            };
            var getFunctionResponse = fnManagementClient.Waiters.ForFunction(getFunctionRequest, Function.LifecycleStateEnum.Active).Execute();

            logger.Info($"Function: {FunctionName} is Active");

            return(getFunctionResponse.Function);
        }
Пример #10
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetFunction operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetFunction 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 <GetFunctionResponse> GetFunctionAsync(GetFunctionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new GetFunctionRequestMarshaller();
            var unmarshaller = GetFunctionResponseUnmarshaller.Instance;

            return(InvokeAsync <GetFunctionRequest, GetFunctionResponse>(request, marshaller,
                                                                         unmarshaller, cancellationToken));
        }
Пример #11
0
        public async stt::Task GetFunctionRequestObjectAsync()
        {
            moq::Mock <CloudFunctionsService.CloudFunctionsServiceClient> mockGrpcClient = new moq::Mock <CloudFunctionsService.CloudFunctionsServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetFunctionRequest request = new GetFunctionRequest
            {
                CloudFunctionName = CloudFunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
            };
            CloudFunction expectedResponse = new CloudFunction
            {
                CloudFunctionName   = CloudFunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
                Description         = "description2cf9da67",
                SourceArchiveUrl    = "source_archive_url88af9b91",
                SourceRepository    = new SourceRepository(),
                HttpsTrigger        = new HttpsTrigger(),
                EventTrigger        = new EventTrigger(),
                Status              = CloudFunctionStatus.Offline,
                EntryPoint          = "entry_pointb3d450a5",
                Timeout             = new wkt::Duration(),
                AvailableMemoryMb   = 1905057947,
                ServiceAccountEmail = "service_account_emailb0c3703d",
                UpdateTime          = new wkt::Timestamp(),
                VersionId           = 8696643459580522033L,
                Labels              =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                SourceUploadUrl      = "source_upload_urle9bc6ad5",
                EnvironmentVariables =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                Network      = "networkd22ce091",
                Runtime      = "runtime2519a6b4",
                MaxInstances = -1449803711,
                VpcConnector = "vpc_connectordc82c0cc",
                VpcConnectorEgressSettings = CloudFunction.Types.VpcConnectorEgressSettings.AllTraffic,
                IngressSettings            = CloudFunction.Types.IngressSettings.AllowAll,
                BuildId = "build_id2ab7699b",
            };

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

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            CloudFunction responseCancellationToken = await client.GetFunctionAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>
        /// Gets registered Azure Functions for a given title id and function name.
        /// </summary>
        public void GetFunction(GetFunctionRequest request, Action <GetFunctionResult> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            var context      = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
            var callSettings = apiSettings ?? PlayFabSettings.staticSettings;

            if (!context.IsEntityLoggedIn())
            {
                throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn, "Must be logged in to call this method");
            }
            PlayFabHttp.MakeApiCall("/CloudScript/GetFunction", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
        }
        /// <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 <GetFunctionRequest, GetFunctionResponse> ForFunction(GetFunctionRequest request, WaiterConfiguration config, params Function.LifecycleStateEnum[] targetStates)
        {
            var agent = new WaiterAgent <GetFunctionRequest, GetFunctionResponse>(
                request,
                request => client.GetFunction(request),
                response => targetStates.Contains(response.Function.LifecycleState.Value),
                targetStates.Contains(Function.LifecycleStateEnum.Deleted)
                );

            return(new Waiter <GetFunctionRequest, GetFunctionResponse>(config, agent));
        }
Пример #14
0
 /// <summary>Snippet for GetFunction</summary>
 public void GetFunctionRequestObject()
 {
     // Snippet: GetFunction(GetFunctionRequest, CallSettings)
     // Create client
     CloudFunctionsServiceClient cloudFunctionsServiceClient = CloudFunctionsServiceClient.Create();
     // Initialize request argument(s)
     GetFunctionRequest request = new GetFunctionRequest
     {
         CloudFunctionName = CloudFunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
     };
     // Make the request
     CloudFunction response = cloudFunctionsServiceClient.GetFunction(request);
     // End snippet
 }
        public override Task <GetFunctionResponse> GetFunction(GetFunctionRequest request,
                                                               ServerCallContext context)
        {
            var address  = addressStore.GetObject(request.Address.Id);
            var function = address.GetFunction();

            return(Task.FromResult(new GetFunctionResponse
            {
                Function = new GrpcSbFunction
                {
                    Id = functionStore.AddObject(function),
                }
            }));
        }
Пример #16
0
        /// <summary>
        /// GetFunction接口的同步版本,该接口获取某个函数的详细信息,包括名称、代码、处理方法、关联触发器和超时时间等字段。
        /// </summary>
        /// <param name="req">参考<see cref="GetFunctionRequest"/></param>
        /// <returns>参考<see cref="GetFunctionResponse"/>实例</returns>
        public GetFunctionResponse GetFunctionSync(GetFunctionRequest req)
        {
            JsonResponseModel <GetFunctionResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "GetFunction");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <GetFunctionResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
Пример #17
0
        public override Task <GetFunctionResponse> GetFunction(GetFunctionRequest request,
                                                               ServerCallContext context)
        {
            RemoteFrame frame    = frameStore.GetObject(request.Frame.Id);
            SbFunction  function = frame.GetFunction();

            var response = new GetFunctionResponse();

            if (function != null)
            {
                response.Function = new GrpcSbFunction {
                    Id = functionStore.AddObject(function)
                };
            }
            return(Task.FromResult(response));
        }
Пример #18
0
        /// <summary>Snippet for GetFunctionAsync</summary>
        public async Task GetFunctionRequestObjectAsync()
        {
            // Snippet: GetFunctionAsync(GetFunctionRequest, CallSettings)
            // Additional: GetFunctionAsync(GetFunctionRequest, CancellationToken)
            // Create client
            CloudFunctionsServiceClient cloudFunctionsServiceClient = await CloudFunctionsServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetFunctionRequest request = new GetFunctionRequest
            {
                CloudFunctionName = CloudFunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
            };
            // Make the request
            CloudFunction response = await cloudFunctionsServiceClient.GetFunctionAsync(request);

            // End snippet
        }
Пример #19
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetFunction operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetFunction operation on AmazonLambdaClient.</param>
        /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
        /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        public void GetFunctionAsync(GetFunctionRequest request, AmazonServiceCallback <GetFunctionRequest, GetFunctionResponse> callback, AsyncOptions options = null)
        {
            options = options == null?new AsyncOptions():options;
            var marshaller   = new GetFunctionRequestMarshaller();
            var unmarshaller = GetFunctionResponseUnmarshaller.Instance;
            Action <AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;

            if (callback != null)
            {
                callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => {
                    AmazonServiceResult <GetFunctionRequest, GetFunctionResponse> responseObject
                        = new AmazonServiceResult <GetFunctionRequest, GetFunctionResponse>((GetFunctionRequest)req, (GetFunctionResponse)res, ex, ao.State);
                    callback(responseObject);
                }
            }
            ;
            BeginInvoke <GetFunctionRequest>(request, marshaller, unmarshaller, options, callbackHelper);
        }
Пример #20
0
        private void HandleOutput(GetFunctionRequest request)
        {
            var waiterConfig = new WaiterConfiguration
            {
                MaxAttempts           = MaxWaitAttempts,
                GetNextDelayInSeconds = (_) => WaitIntervalSeconds
            };

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

            case Default:
                response = client.GetFunction(request).GetAwaiter().GetResult();
                break;
            }
            WriteOutput(response, response.Function);
        }
Пример #21
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            GetFunctionRequest request;

            try
            {
                request = new GetFunctionRequest
                {
                    FunctionId   = FunctionId,
                    OpcRequestId = OpcRequestId
                };

                HandleOutput(request);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Пример #22
0
        private async Task UpdateHandlerAsync(string handler)
        {
            var updateFunctionConfigurationRequest = new UpdateFunctionConfigurationRequest
            {
                FunctionName = _functionName,
                ImageConfig  = new ImageConfig()
                {
                    Command = { handler },
                }
            };
            await _lambdaClient.UpdateFunctionConfigurationAsync(updateFunctionConfigurationRequest);

            await WaitUntilHelper.WaitUntil(async() =>
            {
                var getFunctionRequest = new GetFunctionRequest()
                {
                    FunctionName = _functionName
                };
                var getFunctionResponse = await _lambdaClient.GetFunctionAsync(getFunctionRequest);
                return(getFunctionResponse.Configuration.LastUpdateStatus != LastUpdateStatus.Successful);
            }, TimeSpan.Zero, TimeSpan.FromMinutes(5), CancellationToken.None);
        }
 public void GetFunctionAsync(GetFunctionRequest request, AmazonServiceCallback <GetFunctionRequest, GetFunctionResponse> callback, AsyncOptions options = null)
 {
     throw new System.NotImplementedException();
 }
Пример #24
0
 /// <summary>
 ///  查询函数详情
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public GetFunctionResponse GetFunction(GetFunctionRequest request)
 {
     return(new GetFunctionExecutor().Client(this).Execute <GetFunctionResponse, GetFunctionResult, GetFunctionRequest>(request));
 }
Пример #25
0
 /// <summary>
 ///  查询函数详情
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public async Task <GetFunctionResponse> GetFunction(GetFunctionRequest request)
 {
     return(await new GetFunctionExecutor().Client(this).Execute <GetFunctionResponse, GetFunctionResult, GetFunctionRequest>(request).ConfigureAwait(false));
 }
Пример #26
0
 /// <summary>
 /// Gets the function.
 /// </summary>
 /// <returns>The function.</returns>
 /// <param name="getFunctionRequest">Get function request.</param>
 public GetFunctionResponse GetFunction(GetFunctionRequest getFunctionRequest)
 {
     return(this.DoRequestCommon <GetFunctionResponse>(getFunctionRequest.GenHttpRequest(Config)));
 }
Пример #27
0
        public void GetFunctionRequestObject()
        {
            moq::Mock <CloudFunctionsService.CloudFunctionsServiceClient> mockGrpcClient = new moq::Mock <CloudFunctionsService.CloudFunctionsServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetFunctionRequest request = new GetFunctionRequest
            {
                CloudFunctionName = CloudFunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
            };
            CloudFunction expectedResponse = new CloudFunction
            {
                CloudFunctionName   = CloudFunctionName.FromProjectLocationFunction("[PROJECT]", "[LOCATION]", "[FUNCTION]"),
                Description         = "description2cf9da67",
                SourceArchiveUrl    = "source_archive_url88af9b91",
                SourceRepository    = new SourceRepository(),
                HttpsTrigger        = new HttpsTrigger(),
                EventTrigger        = new EventTrigger(),
                Status              = CloudFunctionStatus.Offline,
                EntryPoint          = "entry_pointb3d450a5",
                Timeout             = new wkt::Duration(),
                AvailableMemoryMb   = 1905057947,
                ServiceAccountEmail = "service_account_emailb0c3703d",
                UpdateTime          = new wkt::Timestamp(),
                VersionId           = 8696643459580522033L,
                Labels              =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                SourceUploadUrl      = "source_upload_urle9bc6ad5",
                EnvironmentVariables =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                Network      = "networkd22ce091",
                Runtime      = "runtime2519a6b4",
                MaxInstances = -1449803711,
                VpcConnector = "vpc_connectordc82c0cc",
                VpcConnectorEgressSettings = CloudFunction.Types.VpcConnectorEgressSettings.AllTraffic,
                IngressSettings            = CloudFunction.Types.IngressSettings.AllowAll,
                KmsKeyNameAsCryptoKeyName  = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
                BuildWorkerPool            = "build_worker_pool4c1ad1a6",
                BuildId = "build_id2ab7699b",
                BuildEnvironmentVariables =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                SecretEnvironmentVariables = { new SecretEnvVar(), },
                SecretVolumes = { new SecretVolume(), },
                SourceToken   = "source_tokenecdd3693",
                MinInstances  = 445814344,
                BuildName     = "build_namead3cc4b7",
                DockerRepositoryAsRepositoryName = RepositoryName.FromProjectLocationRepository("[PROJECT]", "[LOCATION]", "[REPOSITORY]"),
            };

            mockGrpcClient.Setup(x => x.GetFunction(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CloudFunctionsServiceClient client = new CloudFunctionsServiceClientImpl(mockGrpcClient.Object, null);
            CloudFunction response             = client.GetFunction(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <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 <GetFunctionRequest, GetFunctionResponse> ForFunction(GetFunctionRequest request, params Function.LifecycleStateEnum[] targetStates)
 {
     return(this.ForFunction(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates));
 }