- Visão geral de serviço
-
Guia de usuário
- Antes de começar
- Construção de uma função de FunctionGraph
-
Configuração da função
- Configuração da inicialização
- Configuração das configurações básicas
- Configuração das permissões de agência
- Configuração da rede
- Configuração da montagem de disco
- Configuração dos variáveis de ambiente
- Configurações da encriptação
- Configuração da notificação de execução assíncrona
- Configuração da multi-corrência de instância única
- Gerenciamento das versões
- Gerenciamento dos aliases
- Configuração da memória dinâmica
-
Criação de gatilhos
- Gerenciamento de gatilhos
- Uso de um gatilho de Timer
- Uso de um gatilho de APIG (dedicado)
- Uso de um gatilho de OBS
- Uso de um gatilho de Kafka
- Uso de um gatilho de DIS
- Uso de um gatilho de SMN
- Uso de um gatilho de LTS
- Uso de um gatilho de CTS
- Uso de um gatilho de DDS
- Uso de um gatilho de GaussDB(para Mongo)
- Uso de um gatilho de APIG (compartilhado)
- Uso de um gatilho de APIC
- Uso de um gatilho de DMS (para RabbitMQ)
- Apêndice: expressões Cron para um gatilho de Timer de função
- Depuração da função
- Invocação da função
- Monitoramento
- Gerenciamento de funções
- Gestão de dependências
- Gerenciamento de instâncias reservadas
- Aumento de cotas de recursos
- Auditoria
-
Referência de API
- Antes de começar
- Visão geral da API
- Chamada das API
-
Exemplos
- Exemplo 1: Uso de um gatilho timer para fazer download periódico de arquivos de um bucket do OBS
- Exemplo 2: Uso de um gatilho APIG para obter uma página de web estática
- Exemplo 3: Criação de uma função por carregamento de código em um bucket do OBS
- Exemplo 4: Uso de uma função para chamar uma subfunção
-
As API
- Invocação de função
- Cotas de função
- Dependências
- Eventos de teste
- Rastreamento de função
- Gerenciamento do ciclo de vida da função
-
Versões e aliases
- Consulta de todas as versões e aliases de uma função
- Criação de um alias para uma versão de função
- Exclusão de um alias de uma versão de função
- Consulta do alias de uma versão de função
- Modificação do alias de uma versão de função
- Consulta das versões de uma função
- Publicação de uma versão de função
- Métricas de função
- Registros de função
- Instâncias reservadas
- Importação e exportação da função
- Gatilhos de função
-
Notificação de execução assíncrona
- Consulta das configurações de notificação de execução assíncrona de uma versão de função
- Exclusão das configurações de notificação de execução assíncrona
- Configuração da notificação de execução assíncrona
- Consulta das configurações de notificação de execução assíncrona de todas as versões de função
- Consulta das solicitações de invocação assíncrona
- Interrupção de uma solicitação da invocação assíncrona
- Políticas de permissões e ações suportadas
- Apêndice
- Aumento de cotas de recursos
- Primeiros passos
-
Perguntas frequentes
-
Perguntas frequentes gerais
- O que é o FunctionGraph?
- Preciso solicitar serviços de computação, armazenamento ou rede ao usar o FunctionGraph?
- Preciso implementar meu código após a programação?
- Como obter um token?
- Quais são os tempos de execução compatíveis com o FunctionGraph?
- Quanto espaço em disco é atribuído a cada função do FunctionGraph?
- O FunctionGraph oferece suporte ao controle de versão de função?
- Como uma função lê ou grava arquivos?
- Como definir um proxy ao usar a CLI?
- O FunctionGraph oferece suporte à extensão de função?
- Quais permissões são necessárias para um usuário do IAM usar o FunctionGraph?
- Como criar um pacote de dependência Python baseado em unidade ODBC para consulta de banco de dados?
- O que é a cota do FunctionGraph?
- Quais fontes chinesas são compatíveis com o FunctionGraph?
- Como o FunctionGraph resolve um nome de domínio do DNS privado?
- Como uma função baseada em imagem de contêiner resolve um nome de domínio do DNS privado?
- Como usar um nome de domínio para acessar uma API registrada com o API Gateway (dedicado)?
- Quais são os cenários comuns de aplicações do FunctionGraph?
- Por que o nome de domínio do API Gateway vinculado a um serviço não pode ser resolvido durante a invocação de função?
- O FunctionGraph oferece suporte à transmissão síncrona na largura de banda máxima da intranet?
- O que acontece se a cota da VPC for usada?
- Como imprimir logs de Info, Error ou Warn?
- Posso definir o nome de domínio de uma API para o meu próprio nome de domínio?
- Posso alterar o tempo de execução?
- Posso mudar o nome de uma função?
- Por que a mensagem "failed to mount exist system path" é exibida?
- Como obter arquivos carregados?
- Por que não consigo receber respostas para invocação síncrona?
- O que fazer se os logs de execução de os.system("command &") não forem coletados?
- Quais diretórios podem ser acessados quando um tempo de execução personalizado é usado?
- Quais versões secundárias do Python 3.6 e 3.9 são compatíveis?
- Quais ações podem ser usadas em vez de uma agência de administrador de VPC para acesso à VPC?
- Quais são as possíveis causas para o tempo limite de função?
- Como obter o código de uma função?
- Tem código de amostra para inicializadores?
- Como ativar a consulta de log estruturada?
- Perguntas frequentes sobre criação de função
-
Perguntas frequentes sobre gerenciamento de gatilhos
- Quais eventos podem acionar uma função do FunctionGraph?
- E se o código de erro 500 for reportado quando funções que usam gatilhos de APIG retornam cadeias?
- O que significam LATEST e TRIM_HORIZON na configuração de gatilho do DIS?
- Por que não consigo ativar ou desativar os gatilhos do OBS chamando APIs?
- Como usar um gatilho de APIG para chamar uma função?
- Como uma função obtém o caminho ou os parâmetros da solicitação ao usar um gatilho de APIG?
- Posso criar um gatilho do OBS com um bucket existente?
-
Perguntas frequentes sobre gerenciamento de dependências
- O que é uma dependência?
- Quando preciso de dependência?
- Quais são as precauções para usar uma dependência?
- Quais dependências são compatíveis com o FunctionGraph?
- O FunctionGraph oferece suporte a bibliotecas de classe?
- Como usar dependências de terceiros no FunctionGraph?
- Como criar dependências de função?
- Como criar uma dependência no console do FunctionGraph?
- Como adicionar uma dependência a uma função?
-
Perguntas frequentes sobre execução de funções
- Quanto tempo leva para executar uma função do FunctionGraph?
- Quais etapas estão incluídas na execução da função?
- Como o FunctionGraph processa solicitações simultâneas?
- O que acontece se as instâncias de função não forem executadas por muito tempo?
- Como acelerar o acesso inicial a uma função?
- Como saber a memória atual usada para a execução da função?
- Por que a minha primeira solicitação é lenta?
- O que fazer se ocorrer um erro ao chamar uma API?
- Como ler o cabeçalho da solicitação de uma função?
- Uma função pode invocar outra função?
- A interface de execução síncrona pode ser invocada em uma rede privada?
- Por que uma função usa mais memória do que estimada e até aciona o alarme de falta de memória?
- Como verificar o uso da memória ao ver "runtime memory limit exceeded"?
- Como resolver problema de "CrashLoopBackOff"?
- Depois que atualizar uma imagem com o mesmo nome, as instâncias reservadas ainda usam a imagem antiga. O que devo fazer?
- Perguntas frequentes sobre configuração da função
- Perguntas frequentes sobre acesso a recursos externos
-
Outras perguntas frequentes
- Como visualizar as regras de alarme configuradas para uma função?
- O FunctionGraph oferece suporte à descompilação de ZIP durante a transcodificação de vídeo?
- Os recursos criados durante o FunctionGraph OBT 2.0 serão liberados automaticamente quando expirarem? Serão cobrados?
- O que é uma aplicação no FunctionGraph?
- Preciso pagar pelo tempo de inicialização a frio?
- Por que uma mensagem é exibida indicando que minha conta foi suspensa ao criar uma função?
- As solicitações de todas as minhas funções em diferentes regiões serão cobradas?
- Migração do FunctionGraph V1 para V2
-
Perguntas frequentes gerais
- No momento, o conteúdo não está disponível no seu idioma selecionado. Consulte a versão em inglês.
- What's New
- Function Overview
- Billing
-
User Guide
- Replacing the Temporary AK/SK
- Before You Start
- Building Functions
-
Configuring Functions
- Configuring Initialization
- Configuring Basic Settings
- Configuring Agency Permissions
- Configuring the Network
- Configuring Disk Mounting
- Configuring Environment Variables
- Configuring Asynchronous Execution Notification
- Configuring Single-Instance Multi-Concurrency
- Managing Versions
- Managing Aliases
- Configuring Dynamic Memory
- Configuring Heartbeat Function
- Configuring Tags
- Configuring Snapshot-based Cold Start
- Configuring a Log Group and Log Stream
- Shared VPC
- Online Debugging
-
Creating Triggers
- Managing Triggers
- Using a Timer Trigger
- Using an APIG (Dedicated) Trigger
- Using a Kafka Trigger
- Using a DIS Trigger
- Using an SMN Trigger
- Using an LTS Trigger
- Using a CTS Trigger
- Using a DDS Trigger
- Using a GeminiDB Mongo Trigger
- Using an APIG Trigger
- Using an APIC Trigger
- Using a DMS (for RabbitMQ) Trigger
- Using an Open-Source Kafka Trigger
- Cron Expressions for a Function Timer Trigger
- Using an EG Trigger
- Invoking the Function
- Monitoring
- Function Management
- Dependency Management
- Reserved Instance Management (Old)
- Reserved Instance Management
- Flow Management
- Increasing Resource Quota
- GPU Function Management
- Application Center
- Sharing
- Programmable CDN Function
- CLI Command Reference
- Audit
-
Best Practices
- FunctionGraph Best Practices
- Processing DIS Data
- Integrating with LTS to Analyze Logs in Real Time
- Integrating with CTS to Analyze Login/Logout Security
- Periodically Starting or Stopping Huawei Cloud ECSs
- Building an HTTP Function with Spring Boot
- Creating a FunctionGraph Backend API That Uses a Custom Authorizer
- Uploading Files with FunctionGraph and APIG
- Processing IoT Data
- Workflow + Function: Automatically Processing Data in OBS
- Filtering Logs in Real Time by Using FunctionGraph and LTS
- Building an HTTP Function with Go
- Using FunctionGraph HTTP Functions to Process gRPC Requests
- Cold Start Optimization Practices
-
Developer Guide
- Overview
- Initializer
- Node.js
- Python
- Java
- Go
- C#
- PHP
- Development Tools
- SDK Reference
-
More Documents
-
User Guide (ME-Abu Dhabi Region)
- Service Overview
- Getting Started
- Before You Start
- Building Functions
-
Configuring Functions
- Configuring Initialization
- Configuring Basic Settings
- Configuring Agency Permissions
- Configuring the Network
- Configuring Disk Mounting
- Configuring Environment Variables
- Configuring Asynchronous Execution Notification
- Configuring Single-Instance Multi-Concurrency
- Managing Versions
- Managing Aliases
- Configuring Dynamic Memory
- Configuring Heartbeat Function
- Online Debugging
- Creating Triggers
- Invoking the Function
- Monitoring
- Function Management
- Dependency Management
- Reserved Instance Management
- Increasing Resource Quota
- Audit
-
FAQs
-
General FAQs
- What Is FunctionGraph?
- Do I Need to Apply for Any Compute, Storage, or Network Services When Using FunctionGraph?
- Do I Need to Deploy My Code After Programming?
- What Runtimes Does FunctionGraph Support?
- How Much Disk Space Is Allocated to Each FunctionGraph Function?
- Does FunctionGraph Support Function Versioning?
- How Does a Function Read or Write Files?
- Does FunctionGraph Support Function Extension?
- Which Permissions Are Required for an IAM User to Use FunctionGraph?
- How Can I Create an ODBC Drive-based Python Dependency Package for Database Query?
- What Is the Quota of FunctionGraph?
- How Does FunctionGraph Resolve a Private DNS Domain Name?
- How Does a Container Image–based Function Resolve a Private DNS Domain Name?
- How Do I Use a Domain Name to Access an API Registered with API Gateway (Dedicated)?
- What Are the Common Application Scenarios of FunctionGraph?
- Why Can't the API Gateway Domain Name Bound to a Service Be Resolved During Function Invocation?
- Does FunctionGraph Support Synchronous Transmission at the Maximum Intranet Bandwidth?
- What If the VPC Quota Is Used Up?
- How Can I Print Info, Error, or Warn Logs?
- Can I Set the Domain Name of an API to My Own Domain Name?
- Can I Change the Runtime?
- Can I Change a Function's Name?
- Why Is Message "failed to mount exist system path" Displayed?
- How Do I Obtain Uploaded Files?
- Why Can't I Receive Responses for Synchronous Invocation?
- What Should I Do If the os.system("command &") Execution Logs Are Not Collected?
- Which Directories Can Be Accessed When a Custom Runtime Is Used?
- Which Minor Versions of Python 3.6 and 3.9 Are Supported?
- Which Actions Can Be Used Instead of a VPC Administrator Agency for VPC Access?
- What Are the Possible Causes for Function Timeout?
- How Do I Obtain the Code of a Function?
- Do You Have Sample Code for Initializers?
- How Do I Enable Structured Log Query?
- Can I Enable a Listening Port in a Function to Receive External TCP Requests via EIP?
- Function Creation FAQs
-
Trigger Management FAQs
- What Events Can Trigger a FunctionGraph Function?
- What If Error Code 500 Is Reported When Functions that Use APIG Triggers Return Strings?
- What Do LATEST and TRIM_HORIZON Mean in DIS Trigger Configuration?
- Why Can't I Enable or Disable OBS Triggers by Calling APIs?
- How Do I Use an APIG Trigger to Invoke a Function?
- How Does a Function Obtain the Request Path or Parameters When Using an APIG Trigger?
- Can I Create an OBS Trigger with an Existing Bucket?
-
Dependency Management FAQs
- What Is a Dependency?
- When Do I Need a Dependency?
- What Are the Precautions for Using a Dependency?
- What Dependencies Does FunctionGraph Support?
- Does FunctionGraph Support Class Libraries?
- How Do I Use Third-Party Dependencies on FunctionGraph?
- How Do I Create Function Dependencies?
- How Do I Create a Dependency on the FunctionGraph Console?
- How Do I Add a Dependency to a Function?
-
Function Execution FAQs
- How Long Does It Take to Execute a FunctionGraph Function?
- Which Steps Are Included in Function Execution?
- How Does FunctionGraph Process Concurrent Requests?
- What If Function Instances Have Not Been Executed for a Long Time?
- How Can I Speed Up Initial Access to a Function?
- How Do I Know the Actual Memory Used for Function Execution?
- Why Is My First Request Slow?
- What Do I Do If an Error Occurs When Calling an API?
- How Do I Read the Request Header of a Function?
- Why Does a Function Use More Memory Than Estimated and Even Trigger the Out of Memory Alarm?
- How Do I Check the Memory Usage When Seeing "runtime memory limit exceeded"?
- How Do I Troubleshoot "CrashLoopBackOff"?
- After I Updated an Image with the Same Name, Reserved Instances Still Use the Old Image. What Can I Do?
- Function Configuration FAQs
- External Resource Access FAQs
- Other FAQs
-
General FAQs
-
API Reference (ME-Abu Dhabi Region)
- Before You Start
- API Overview
- Calling APIs
- Function Model Definition
-
Function Management Zone APIs
- Querying a Function List
- Querying the Metadata of a Function
- Querying the Code of a Function
- Creating a Function
- Deleting a Function or Function Version
- Modifying the Code of a Function
- Modifying the Metadata of a Function
- Publishing a Function Version
- Querying the Versions of a Function
- Creating an Alias for a Function Version
- Modifying the Alias Information About a Function Version
- Deleting an Alias of a Function Version
- Querying the Alias Information About a Function Version
- Querying the Version Alias List of a Function
- Querying All Triggers of a Function
- Querying the Information About a Trigger
- Deleting All Triggers of a Function
- Creating a Trigger
- Deleting a Trigger
- Function Data Zone APIs
- Permissions Policies and Supported Actions
- Appendix
- Change History
- Developer Guide (ME-Abu Dhabi Region)
-
User Guide (Kuala Lumpur Region)
- Service Overview
- Getting Started
- Before You Start
- Building Functions
-
Configuring Functions
- Configuring Initialization
- Configuring Basic Settings
- Configuring Agency Permissions
- Configuring the Network
- Configuring Disk Mounting
- Configuring Environment Variables
- Configuring Asynchronous Execution Notification
- Configuring Single-Instance Multi-Concurrency
- Managing Versions
- Managing Aliases
- Configuring Dynamic Memory
- Online Debugging
- Creating Triggers
- Invoking the Function
- Monitoring
- Function Management
- Dependency Management
- Reserved Instance Management
- Audit
-
FAQs
-
General FAQs
- What Is FunctionGraph?
- Do I Need to Apply for Any Compute, Storage, or Network Services When Using FunctionGraph?
- Do I Need to Deploy My Code After Programming?
- What Runtimes Does FunctionGraph Support?
- How Much Disk Space Is Allocated to Each FunctionGraph Function?
- Does FunctionGraph Support Function Versioning?
- How Does a Function Read or Write Files?
- Does FunctionGraph Support Function Extension?
- Which Permissions Are Required for an IAM User to Use FunctionGraph?
- How Can I Create an ODBC Drive-based Python Dependency Package for Database Query?
- What Is the Quota of FunctionGraph?
- How Does a Container Image–based Function Resolve a Private DNS Domain Name?
- How Do I Use a Domain Name to Access an API Registered with API Gateway (Dedicated)?
- What Are the Common Application Scenarios of FunctionGraph?
- Why Can't the API Gateway Domain Name Bound to a Service Be Resolved During Function Invocation?
- Does FunctionGraph Support Synchronous Transmission at the Maximum Intranet Bandwidth?
- What If the VPC Quota Is Used Up?
- How Can I Print Info, Error, or Warn Logs?
- Can I Set the Domain Name of an API to My Own Domain Name?
- Can I Change the Runtime?
- Can I Change a Function's Name?
- Why Is Message "failed to mount exist system path" Displayed?
- How Do I Obtain Uploaded Files?
- Why Can't I Receive Responses for Synchronous Invocation?
- What Should I Do If the os.system("command &") Execution Logs Are Not Collected?
- Which Directories Can Be Accessed When a Custom Runtime Is Used?
- Which Minor Versions of Python 3.6 and 3.9 Are Supported?
- Which Actions Can Be Used Instead of a VPC Administrator Agency for VPC Access?
- What Are the Possible Causes for Function Timeout?
- How Do I Obtain the Code of a Function?
- Do You Have Sample Code for Initializers?
- How Do I Enable Structured Log Query?
- Can I Enable a Listening Port in a Function to Receive External TCP Requests via EIP?
- Function Creation FAQs
-
Trigger Management FAQs
- What If Error Code 500 Is Reported When Functions that Use APIG Triggers Return Strings?
- What Do LATEST and TRIM_HORIZON Mean in DIS Trigger Configuration?
- Why Can't I Enable or Disable OBS Triggers by Calling APIs?
- How Do I Use an APIG Trigger to Invoke a Function?
- How Does a Function Obtain the Request Path or Parameters When Using an APIG Trigger?
- Can I Create an OBS Trigger with an Existing Bucket?
-
Dependency Management FAQs
- What Is a Dependency?
- When Do I Need a Dependency?
- What Are the Precautions for Using a Dependency?
- What Dependencies Does FunctionGraph Support?
- Does FunctionGraph Support Class Libraries?
- How Do I Use Third-Party Dependencies on FunctionGraph?
- How Do I Create Function Dependencies?
- How Do I Create a Dependency on the FunctionGraph Console?
- How Do I Add a Dependency to a Function?
-
Function Execution FAQs
- How Long Does It Take to Execute a FunctionGraph Function?
- Which Steps Are Included in Function Execution?
- How Does FunctionGraph Process Concurrent Requests?
- What If Function Instances Have Not Been Executed for a Long Time?
- How Can I Speed Up Initial Access to a Function?
- How Do I Know the Actual Memory Used for Function Execution?
- Why Is My First Request Slow?
- What Do I Do If an Error Occurs When Calling an API?
- How Do I Read the Request Header of a Function?
- Why Does a Function Use More Memory Than Estimated and Even Trigger the Out of Memory Alarm?
- How Do I Check the Memory Usage When Seeing "runtime memory limit exceeded"?
- How Do I Troubleshoot "CrashLoopBackOff"?
- After I Updated an Image with the Same Name, Reserved Instances Still Use the Old Image. What Can I Do?
- Function Configuration FAQs
- External Resource Access FAQs
- Other FAQs
-
General FAQs
- Change History
-
API Reference (Kuala Lumpur Region)
- Before You Start
- API Overview
- Calling APIs
- Examples
-
APIs
- Function Invocation
- Function Quotas
- Dependencies
- Test Events
- Function Tracing
-
Function Lifecycle Management
- Querying Functions
- Creating a Function
- Deleting a Function or Function Version
- Querying the Code of a Function
- Modifying the Code of a Function
- Querying the Metadata of a Function
- Modifying the Metadata of a Function
- Updating Max. Instances of a Function
- Enabling or Disabling the Snapshot Function
- Querying Snapshot Status
- Querying Resource Tags
- Querying Resources
- Deleting Resource Tags
- Creating Resource Tags
- Creating a VPC Endpoint
- Deleting a VPC Endpoint
- Versions and Aliases
- Function Metrics
- Function Logs
- Reserved Instances
- Function Import and Export
- Function Triggers
-
Asynchronous Execution Notification
- Querying Asynchronous Execution Notification Settings of a Function Version
- Deleting Asynchronous Execution Notification Settings
- Configuring Asynchronous Execution Notification
- Querying Asynchronous Execution Notification Settings of a Function's All Versions
- Querying Asynchronous Invocation Requests
- Stopping an Asynchronous Invocation Request
- Appendix
- Developer Guide (Kuala Lumpur Region)
-
User Guide (ME-Abu Dhabi Region)
- Videos
- Cenário
- Pré-requisitos
- Procedimento geral
- Passo 1: Crie uma função para baixar arquivos do OBS
- Passo 2: Modifique o endereço do OBS, o nome do bucket e o nome do arquivo nas configurações da função
- Passo 3: Teste a função
- Passo 4: Crie um gatilho timer para baixar periodicamente arquivos do OBS
Mostrar todos
Copiado.
Exemplo 1: Uso de um gatilho timer para fazer download periódico de arquivos de um bucket do OBS
Cenário
Este exemplo orienta você pelo procedimento para criar uma função do Python 2.7 e associar um gatilho timer a ela para fazer download periódico de arquivos de um bucket do OBS.
Para obter detalhes sobre como chamar as API, consulte Chamada das API.
Pré-requisitos
- Você carregou arquivos no OBS e registrou os nomes dos arquivos, o bucket no qual os arquivos são armazenados e o endereço do bucket.
- Você criou uma agência no IAM para permitir que o FunctionGraph acesse o OBS e registrou o nome da agência.
Procedimento geral
Crie uma função FunctionGraph e associe um gatilho timer a ela para fazer download periódico de arquivos de um bucket do OBS. O procedimento é o seguinte:
- Criação de uma função: Crie uma função para baixar arquivos.
- Modificação dos metadados de uma função: Modifique o endereço do OBS, o nome do bucket do OBS e o nome do arquivo na configuração da função.
- Execução síncrona de uma função: Verifique se a função pode baixar arquivos do bucket do OBS com êxito.
- Criação de um gatilho: Crie um gatilho de timer para baixar arquivos periodicamente.
Passo 1: Crie uma função para baixar arquivos do OBS
URI: POST /v2/{project_id}/fgs/functions
Para obter detalhes, consulte Criação de um gatilho.
- Exemplo de solicitação
POST https://{Endpoint}/v2/{project_id}/fgs/functions { "code_filename": "index.zip", "code_type": "inline", "func_code": { "file": "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" }, "func_name": "download_file_from_obs", "handler": "index.handler", "memory_size": 256, "package": "default", "runtime": "Python2.7", "timeout": 30 }
- Exemplo de resposta
{ "func_urn": "urn:fss:{project_name}:{project_id}:function:default:download_file_from_obs:latest", "func_name": "download_file_from_obs", "domain_id": "89fexxxd636", "namespace": "{project_id}", "project_name": "xxx", "package": "default", "runtime": "Python2.7", "timeout": 30, "handler": "index.handler", "memory_size": 256, "cpu": 400, "code_type": "inline", "code_filename": "index.zip", "code_size": 1707, "digest": "68891a6778848a78bd37a8c0798c91d75a5c87aee6e901303047a52edf05bf2170aac4149d79b3f6a40efe78406a83bf6d8683e7b25da4f0c07e7493aa4ccdcd", "version": "latest", "image_name": "latest-200603162219@zr2ym", "last_modified": "2020-06-03T16:22:19+08:00", "strategy_config": { "concurrency": -1 }, "StrategyConfig": {}, "enterprise_project_id": "0" }
Registre o URN da função, ou seja, o valor de func_urn na resposta.
Passo 2: Modifique o endereço do OBS, o nome do bucket e o nome do arquivo nas configurações da função
URI: PUT /v2/{project_id}/fgs/functions/{function_urn}/config
Para obter detalhes, consulte Modificação dos metadados de uma função.
- Exemplo de solicitação
PUT https://{Endpoint}/v2/{project_id}/fgs/functions/{function_urn}/config { "func_name": "download_file_from_obs", "handler": "index.handler", "memory_size": 256, "runtime": "Python2.7", "timeout": 30, "user_data": "{\"obs_address\":\"obs.xxx.xxx.com\",\"srcBucket\":\" xxx\",\"srcObjName\":\"xxx\"}", "xrole": "xxx" }
- function_urn: o URN da função gravada em Passo 1: Crie uma função para baixar arquivos do OBS
- obs_address: Endereço OBS
- srcBucket: nome de um bucket OBS
- srcObjName nome do arquivo
- xrole nome da agência
- Exemplo de resposta
{ "func_urn": "urn:fss:{project_name}:{project_id}:function:default:download_file_from_obs:latest", "func_name": "download_file_from_obs", "domain_id": "89fexxxd636", "namespace": "{project_id}", "project_name": "xxx", "package": "default", "runtime": "Python2.7", "timeout": 30, "handler": "index.handler", "memory_size": 256, "cpu": 400, "code_type": "inline", "code_filename": "index.zip", "code_size": 1707, "user_data": "{\"obs_address\":\"obs.xxx.xxx.com\",\"srcBucket\":\"xxx\",\"srcObjName\":\"xxx\"}", "digest": "68891a6778848a78bd37a8c0798c91d75a5c87aee6e901303047a52edf05bf2170aac4149d79b3f6a40efe78406a83bf6d8683e7b25da4f0c07e7493aa4ccdcd", "version": "latest", "image_name": "latest-200603165355@varrp", "xrole": "xxx", "app_xrole": "xxx", "last_modified": "2020-06-03T17:25:03+08:00", "strategy_config": { "concurrency": -1 }, "StrategyConfig": {}, "enterprise_project_id": "0" }
Passo 3: Teste a função
URI: POST /v2/{project_id}/fgs/functions/{function_urn}/invocations
Para obter detalhes, consulte Execução síncrona de uma função.
- Exemplo de solicitação
POST https://{Endpoint}/v2/{project_id}/fgs/functions/{function_urn}/invocations { "message": "download file" }
function_urn indica o URN da função gravada em Passo 1: Crie uma função para baixar arquivos do OBS.
- Exemplo de resposta
"O objeto baixado com sucesso do OBS, e o tamanho é de 14 KB"
Passo 4: Crie um gatilho timer para baixar periodicamente arquivos do OBS
URI: POST /v2/{project_id}/fgs/triggers/{function_urn}
Para obter detalhes, consulte Criação de um gatilho.
- Exemplo de solicitação
POST https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn} { "event_data": { "name": "Timer-download", "schedule_type": "Rate", "schedule": "1d" }, "event_type_code": "MessageCreated", "trigger_status": "ACTIVE", "trigger_type_code": "TIMER" }
function_urn indica o URN da função gravada em Passo 1: Crie uma função para baixar arquivos do OBS.
A solicitação de exemplo anterior é usada para baixar arquivos do bucket do OBS especificado todos os dias.
- Exemplo de resposta
{ "trigger_id": "461bbe95-c85b-4dc9-a306-9701e77f1d66", "trigger_type_code": "TIMER", "trigger_status": "ACTIVE", "event_data": { "name": "Timer-download", "schedule": "1d", "schedule_type": "Rate" }, "last_updated_time": "2020-06-04T10:33:30+08:00", "created_time": "2020-06-04T10:33:30+08:00" }