- 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
Copiado.
Exemplo 2: Uso de um gatilho APIG para obter uma página de web estática
Cenário
Este exemplo orienta você pelo procedimento para criar uma função Python 2.7 e associar um gatilho APIG a ela para obter uma página da Web estática.
Para obter detalhes sobre como chamar as API, consulte Chamada das API.
Pré-requisitos
Você criou um grupo das API no API Gateway e registrou o ID e o nome do subdomínio do grupo das API.
Procedimento geral
Crie uma função FunctionGraph e associe um gatilho APIG a ela para obter uma página web estática. O procedimento é o seguinte:
- Criação de uma função: Crie uma função para retornar uma página da Web estática.
- Criação de um gatilho: Crie um gatilho APIG.
- Chame a API do gatilho APIG para obter uma página estática.
Passo 1: Crie uma função para retornar uma página da Web estática
URI: POST /v2/{project_id}/fgs/functions
Para obter detalhes, consulte Criação de uma função.
- Exemplo de solicitação
POST https://{Endpoint}/v2/{project_id}/fgs/functions { "code_filename": "index.zip", "code_type": "inline", "func_code": { "file": "UEsDBAoAAAAIABY7vFD7lxPkAgMAALoHAAAIAAAAaW5kZXgucHndVdtu00AQfc9XrMKDExQ7zqW50VYqFZRKIFUQhFBVobU9iU1tr9mdbRKqSHwNH8aXMLtxrgoS8ISIosg7c+bszNnjzRPmPnVZKKIkn440TtyBCVQcx6mMY2ATkaZiRjmWKMZzdnFzfcXgAXJkYsI4UzwrUoLpPMRE5B77KDQLCYigkGFMVescCxZMQQq0IDokcl4kruVyEYiGI5TU66VXqTxWGKvGiMUbwFhE1RGrXr0YVxsmXHCMTaBpNmvGQK1uEzdc8gwQpCKIYTFxKeYLU7HCUnBp8V80yMU7lNTYsbKcIqaKfjclMfBoDzR3FfKpxZl2bCMUfiXomWIz7GU5tNXw3oM5hBrBpfE9rdwZod22xzP+VeR8prxQZOvq9wqkezElTQxHqrkrCb1wjSBN32v5rPZa8zrLp/NPlG22fN8fbJsMRGTH/fHtO31X2kigaRVeihxhjtv+j3Zfgq+t7lHU7XT6nV479NthP+r328Mh9Af9QSuAoBu01kU016qg2wq6J8A7bt8PTtxWC3pu0A8itzcMTjiHgEiGZbNL67gkK4QkZ6n102cl8vVzwBX0upVKBBMW8zxKQdasXRpkXztMfWQbKOgckTl02CEoxcoZ2ESKzFiOvCeT6RSkU7FwlItVnfmQvIXIFYwXBbCzlR1vnaP+cO5unV24c2dZYB5Cgb9kdKh9rlMsN08mBwBCxJilzpbALN+WGCJ43CTMx6FjQ60uRQTOiLV9v7GfTtRzK9uLnF5xiAgzlhoOQKWXndEBuT1NaxTzilJ7K3vM6V2jnp6xMOZSAZ7Za6O6V7o82MI4kfhXZ+gFvS7YhmrOqaE6P41b5x8gJecDQ8E0TfqyvDauJC/i0yYBTu225059y73ckRm1zK1hvEhnhart6lZfqQ3pMb1NzY7eZvkP6c2LIk1CbqRomtb+UufH6j3Yu+CBpxqqy99VcVeNjYoKtnKVfv7fHXqTAmXMTaNQ6hDtH5iWKZslGDN7QbBiczfsmezMEDT2Q0bWP/TzgdD1n1BLAQIeAwoAAAAIABY7vFD7lxPkAgMAALoHAAAIAAAAAAAAAAAAAADzAgAAAABpbmRleC5weVBLBQYAAAAAAQABADYAAAAoAwAAAAA=" }, "func_name": "get_html", "handler": "index.handler", "memory_size": 256, "package": "default", "runtime": "Python2.7", "timeout": 5 }
- Exemplo de resposta
{ "func_urn": "urn:fss:{project_name}:{project_id}:function:default:get_html:latest", "func_name": "get_html", "domain_id": "89fexxxd636", "namespace": "{project_id}", "project_name": "xxx", "package": "default", "runtime": "Python2.7", "timeout": 5, "handler": "index.handler", "memory_size": 256, "cpu": 400, "code_type": "inline", "code_filename": "index.zip", "code_size": 884, "digest": "b08fef5e97dd130037978db07f0e9109aa43a191517cd1196bcab822f17dddcf37f7506a15691177962f9803ba6d170a1c87aafb4fa1b9f0d07f9415642b26d2", "version": "latest", "image_name": "latest-200604105808@we0qo", "last_modified": "2020-06-04T10:58:08+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: Crie um gatilho APIG.
URI: POST /v2/{project_id}/fgs/gatilhos/{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": { "group_id": "a9ad0d5df4d7475c9bc35a7c17d89304", "env_id": "DEFAULT_ENVIRONMENT_RELEASE_ID", "auth": "NONE", "protocol": "HTTP", "name": "API_GetHtml", "path": "/test", "match_mode": "SWA", "req_method": "ANY", "backend_type": "FUNCTION", "sl_domain": "a9ad0d5df4d7475c9bc35a7c17d89304.apig.xxx.xxxapis.com", "type": 1, "env_name": "RELEASE" }, "event_type_code": "APICreated", "trigger_status": "ACTIVE", "trigger_type_code": "APIG" }
- function_urn: o URN da função gravada em Passo 1: Crie uma função para retornar uma página da Web estática
- group_id: ID do grupo API
- sl_domain: nome do subdomínio que o API Gateway aloca ao grupo das API
- Exemplo de resposta
{ "trigger_id": "1b3ec74b86454aa39001a9f89cc70ee2", "trigger_type_code": "APIG", "trigger_status": "ACTIVE", "event_data": { "api_id": "cbc698153d1f4265bdd8384b5cf6e581", "api_name": "API_GetHtml", "auth": "NONE", "env_id": "", "env_name": "", "func_info": { "function_urn": "urn:fss:{project_name}:{project_id}:function:default:get_html", "invocation_type": "sync", "timeout": 5000, "version": "latest" }, "group_id": "a9ad0d5df4d7475c9bc35a7c17d89304", "group_name": "APIGroup_gethtml", "invoke_url": "http://a9ad0d5df4d7475c9bc35a7c17d89304.apig.xxx.xxxapis.com/test", "match_mode": "SWA", "name": "API_GetHtml", "path": "/test", "protocol": "HTTP", "req_method": "ANY", "triggerid": "1b3ec74b86454aa39001a9f89cc70ee2", "type": 1 }, "last_updated_time": "2020-06-04T17:14:32+08:00", "created_time": "2020-06-04T17:14:32+08:00" }
Registre o valor de invoke_url.
Passo 3: Chame a API do gatilho APIG para obter uma página da Web estática
Insira o valor de invoke_url na barra de endereços de um navegador para obter uma página da Web estática.
