ó ¯&Z]c@s¿ddlZddlZddlmZddlmZddlmZmZddl m Z ej e ƒZ ee _dZdefd„ƒYZd d d „ƒYZd efd „ƒYZdS(iÿÿÿÿN(tBytesIO(tFunctionArnFields(t IPCClientt IPCException(tmocksL^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$tInvocationExceptioncBseZRS((t__name__t __module__(((sn/home/rvanderwerf/github/aws-greengrass-core-sdk-python/aws-greengrass-core-sdk-python/greengrasssdk/Lambda.pyRstClientcBs2eZddd„Zd„Zedd„ƒZRS(t localhosti@cCstd|d|ƒ|_dS(s :param endpoint: Endpoint used to connect to IPC. :type endpoint: str :param port: Port number used to connect to the :code:`endpoint`. :type port: int tendpointtportN(Rtipc(tselfR R ((sn/home/rvanderwerf/github/aws-greengrass-core-sdk-python/aws-greengrass-core-sdk-python/greengrasssdk/Lambda.pyt__init__sc Ksƒd|krtdƒ‚nt|dƒ}|j}|jddƒ}|rm|rm||krmtdƒ‚n|ry|n|}ytj|j|ƒ}Wntk r·tdƒ‚nXy|jddƒjƒ}Wn,tk r}tj |ƒtdƒ‚nX|r-t j t |ƒs-td ƒ‚q-n|jd dƒ} |jd d ƒ} tj d j|| |ƒƒ|j|| || ƒS(Nt FunctionNames\"FunctionName" argument of Lambda.Client.invoke is a required argument but was not provided.t QualifiertsTThe derived qualifier from the function name does not match the specified qualifier.sclass FunctionArnFields has no attribute 'build_function_arn'. build_function_arn is introduced in GGC v1.9.0. Please check your GGC version.t ClientContexts`"ClientContext" argument must be a byte string or support a decode method which returns a stringsH"ClientContext" argument of Lambda.Client.invoke must be base64 encoded.tPayloadtInvocationTypetRequestResponsesDInvoking local lambda "{}" with payload "{}" and client context "{}"(t ValueErrorRt qualifiertgettbuild_function_arntunqualified_arntAttributeErrortdecodetcustomer_loggert exceptiontretmatchtvalid_base64_regextdebugtformatt_invoke_internal( R tkwargst arn_fieldst arn_qualifiertextraneous_qualifiertfinal_qualifiert function_arntclient_contexttetpayloadtinvocation_type((sn/home/rvanderwerf/github/aws-greengrass-core-sdk-python/aws-greengrass-core-sdk-python/greengrasssdk/Lambda.pytinvoke's6       Rc Csçtjdj||ƒƒy‘|jj||||ƒ}|dkrUidd6dd6S|jj||ƒ}|js…t|jƒ}n |j}i|d6|jd6}|SWn6t k râ} tj | ƒt dt | ƒƒ‚nXdS(sh This private method is seperate from the main, public invoke method so that other code within this SDK can give this Lambda client a raw payload/client context to invoke with, rather than having it built for them. This lets you include custom ExtensionMap_ values like subject which are needed for our internal pinned Lambdas. s:Invoking Lambda function "{}" with Greengrass Message "{}"tEventRRt FunctionErrors!Failed to invoke function due to N( RR"R#R t post_worktget_work_resulttfunc_errt StreamingBodyR-RRRtstr( R R*R-R+R.t invocation_idtwork_result_outputtoutput_payloadt invoke_outputR,((sn/home/rvanderwerf/github/aws-greengrass-core-sdk-python/aws-greengrass-core-sdk-python/greengrasssdk/Lambda.pyR$Ys      (RRRR/RR$(((sn/home/rvanderwerf/github/aws-greengrass-core-sdk-python/aws-greengrass-core-sdk-python/greengrasssdk/Lambda.pyRs 2R5cBs,eZdZd„Zdd„Zd„ZRS(soWrapper class for http response payload This provides a consistent interface to AWS Lambda Python SDK cCst|ƒ|_d|_dS(Ni(Rt _raw_streamt _amount_read(R R-((sn/home/rvanderwerf/github/aws-greengrass-core-sdk-python/aws-greengrass-core-sdk-python/greengrasssdk/Lambda.pyR~scCs+|jj|ƒ}|jt|ƒ7_|S(sgRead at most amt bytes from the stream. If the amt argument is omitted, read all data. (R;treadR<tlen(R tamttchunk((sn/home/rvanderwerf/github/aws-greengrass-core-sdk-python/aws-greengrass-core-sdk-python/greengrasssdk/Lambda.pyR=‚scCs|jjƒdS(N(R;tclose(R ((sn/home/rvanderwerf/github/aws-greengrass-core-sdk-python/aws-greengrass-core-sdk-python/greengrasssdk/Lambda.pyRAŠsN(RRt__doc__RtNoneR=RA(((sn/home/rvanderwerf/github/aws-greengrass-core-sdk-python/aws-greengrass-core-sdk-python/greengrasssdk/Lambda.pyR5ys  ((tloggingRtioRt%greengrass_common.function_arn_fieldsRt$greengrass_ipc_python_sdk.ipc_clientRRtgreengrasssdk.utils.testingRt getLoggerRRtTruet propagateR!t ExceptionRRtobjectR5(((sn/home/rvanderwerf/github/aws-greengrass-core-sdk-python/aws-greengrass-core-sdk-python/greengrasssdk/Lambda.pyts   ]