open-index/open-npm huggingface dataset:
npm package: @serverless/tencent-cam-policy
Description: Tencent Cloud Serverless CAM policy
Author: Tencent Cloud, Inc.
Latest version: 1.5.7

# 腾讯云访问管理CAM-policy组件

&nbsp;

* [请点击这里查看英文版部署文档](./README_EN.md)

## 简介
该组件是serverless-tencent组件库中的基础组件之一。通过访问管理CAM-policy组件，可以快速，方便的创建，配置和管理腾讯云的CAM策略

## 快速开始

通过CAM-policy组件，对一个CAM的策略进行完整的创建，配置，部署和删除等操作。支持命令如下：

1. [安装](#1-安装)
2. [创建](#2-创建)
3. [配置](#3-配置)
4. [部署](#4-部署)
5. [移除](#5-移除)

### 1. 安装

通过npm安装serverless

```console
$ npm install -g serverless
```

### 2. 创建

本地创建 `serverless.yml` 和 `.env` 两个文件

```console
$ touch serverless.yml
$ touch .env # 腾讯云的配置信息
```

在 `.env` 文件中配置腾讯云的APPID，SecretId和SecretKey信息并保存

如果没有腾讯云账号，可以在此[注册新账号](https://cloud.tencent.com/register)。

如果已有腾讯云账号，可以在[API密钥管理
](https://console.cloud.tencent.com/cam/capi)中获取`APPID`, `SecretId` 和`SecretKey`.

```
# .env
TENCENT_SECRET_ID=123
TENCENT_SECRET_KEY=123
```

### 3. 配置

在serverless.yml中进行如下配置

```yml
# serverless.yml

myPolicy:
  component: "@serverless/tencent-cam-policy"
  inputs:
    name: my-policy
    description: A policy created by Serverless Components
    policy:
      statement:
        - effect: allow
          action:
            - cos:GetService
          resource: '*'

```
* [点击此处查看配置文档](https://github.com/serverless-tencent/tencent-cam-policy/blob/master/docs/configure.md)


### 4. 部署

通过如下命令进行部署，并查看部署过程中的信息
```console
$ sls --debug

  DEBUG ─ Resolving the template's static variables.
  DEBUG ─ Collecting components from the template.
  DEBUG ─ Downloading any NPM components found in the template.
  DEBUG ─ Analyzing the template's components dependencies.
  DEBUG ─ Creating the template's components graph.
  DEBUG ─ Syncing template state.
  DEBUG ─ Executing the template's components graph.

  myPolicy: 
    id: 27710257

  7s › myPolicy › done
```


### 5. 移除
```console
$ sls remove --debug

  DEBUG ─ Flushing template state and removing all components.

  1s › myPolicy › done


```

### 还支持哪些组件？

可以在 [Serverless Components](https://github.com/serverless/components) repo 中查询更多组件的信息。
npm package: @serverless/tencent-cam-role
Description: Tencent Cloud Serverless CAM Role
Author: Tencent Cloud, Inc.
Latest version: 1.6.6

# 腾讯云访问管理CAM-role组件

&nbsp;

* [请点击这里查看英文版部署文档](./README_EN.md)

## 简介
该组件是serverless-tencent组件库中的基础组件之一。通过访问管理CAM-role组件，可以快速，方便的创建，配置和管理腾讯云的CAM角色

## 快速开始

通过CAM-role组件，对一个CAM的角色进行完整的创建，配置，部署和删除等操作。支持命令如下：

1. [安装](#1-安装)
2. [创建](#2-创建)
3. [配置](#3-配置)
4. [部署](#4-部署)
4. [移除](#5-移除)

### 1. 安装

通过npm安装serverless

```console
$ npm install -g serverless
```

### 2. 创建

本地创建 `serverless.yml` 和 `.env` 两个文件

```console
$ touch serverless.yml
$ touch .env # 腾讯云的配置信息
```

在 `.env` 文件中配置腾讯云的APPID，SecretId和SecretKey信息并保存

如果没有腾讯云账号，可以在此[注册新账号](https://cloud.tencent.com/register)。

如果已有腾讯云账号，可以在[API密钥管理
](https://console.cloud.tencent.com/cam/capi)中获取`APPID`, `SecretId` 和`SecretKey`.

```
# .env
TENCENT_SECRET_ID=123
TENCENT_SECRET_KEY=123
```

### 3. 配置

在serverless.yml中进行如下配置

```yml
# serverless.yml

# serverless.yml

myRole:
  component: "@serverless/tencent-cam-role"
  inputs:
    roleName: QCS_SCFExcuteRole
    service:
      - scf.qcloud.com
      - cos.qcloud.com
    policy:      
      policyName:
        - QCloudResourceFullAccess
        - QcloudAccessForCDNRole
 ```

 
* [点击此处查看配置文档](https://github.com/serverless-tencent/tencent-cam-role/blob/master/docs/configure.md)

 
### 4. 部署

通过如下命令进行部署，并查看部署过程中的信息

```shell
$ sls --debug

  DEBUG ─ Resolving the template's static variables.
  DEBUG ─ Collecting components from the template.
  DEBUG ─ Downloading any NPM components found in the template.
  DEBUG ─ Analyzing the template's components dependencies.
  DEBUG ─ Creating the template's components graph.
  DEBUG ─ Syncing template state.
  DEBUG ─ Executing the template's components graph.
  DEBUG ─ Syncing role c0hhdv-qt9mh6xj in region ap-guangzhou.
  DEBUG ─ Updating policy for role c0hhdv-qt9mh6xj.
  DEBUG ─ Saved state for role c0hhdv-qt9mh6xj.
  DEBUG ─ Role c0hhdv-qt9mh6xj was successfully deployed to region ap-guangzhou.
  DEBUG ─ Deployed role roleId is 4611686018427945536.

  myRole: 
    roleName:    QCS_SCFExcuteRole
    description: This is tencent-cam-role component.
    roleId:      4611686018427945536
    service: 
      - cos.qcloud.com
      - scf.qcloud.com
    policy: 
      policyId: 
        - 16313162
        - 2
      policyName: 
        - QCloudResourceFullAccess
        - QcloudAccessForCDNRole

  17s › myRole › done

```

&nbsp;

### 5. 移除

```shell
$ sls remove --debug

  DEBUG ─ Flushing template state and removing all components.
  DEBUG ─ Removing role c0hhdv-qt9mh6xj from region ap-guangzhou.
  DEBUG ─ Role c0hhdv-qt9mh6xj successfully removed from region ap-guangzhou.

  1s › myRole › done

```


```

### 还支持哪些组件？

可以在 [Serverless Components](https://github.com/serverless/components) repo 中查询更多组件的信息。
npm package: @serverless/tencent-cdn
Description: Tencent Cloud CDN Component
Author: Tencent Cloud, Inc.
Latest version: 0.1.5

# 腾讯云 CDN 组件

&nbsp;

- [请点击这里查看英文版部署文档](./README_EN.md)

## 简介

该组件是 serverless-tencent 组件库中的基础组件之一。通过 CDN 组件，可以快速方便的创建，配置和管理腾讯云的 CDN 产品。

## 快速开始

&nbsp;

1. [安装](#1-安装)
2. [配置](#2-配置)
3. [部署](#3-部署)
4. [移除](#4-移除)

&nbsp;

### 1. 安装

通过 npm 安装 serverless

```shell
$ npm install -g serverless
```

### 2. 配置

本地创建 `serverless.yml` 文件，在其中进行如下配置

```shell
$ touch serverless.yml
```

```yml
# serverless.yml

MyCDN:
  component: '@serverless/tencent-cdn'
  inputs:
    host: abc.com
    hostType: cos
    origin: ww.test.com
    backupOrigin: ww.test.com
    serviceType: web
    fullUrl: on
    fwdHost: ww.test.com
    https:
      cert: 123
      privateKey: 123
      http2: off
      httpsType: 2
      forceSwitch: -2
```

- [点击此处查看配置文档](https://github.com/serverless-tencent/tencent-cdn/blob/master/docs/configure.md)

### 3. 部署

如您的账号未[登陆](https://cloud.tencent.com/login)或[注册](https://cloud.tencent.com/register)腾讯云，您可以直接通过`微信`扫描命令行中的二维码进行授权登陆和注册。

同时需要到 [内容分发网络](https://console.cloud.tencent.com/cdn) 开通该服务。

通过`sls`命令进行部署，并可以添加`--debug`参数查看部署过程中的信息

```console
$ sls --debug

  DEBUG ─ Resolving the template's static variables.
  DEBUG ─ Collecting components from the template.
  DEBUG ─ Downloading any NPM components found in the template.
  DEBUG ─ Analyzing the template's components dependencies.
  DEBUG ─ Creating the template's components graph.
  DEBUG ─ Syncing template state.
  DEBUG ─ Executing the template's components graph.
  DEBUG ─ The CDN domain fullstack.yugasun.com has existed. Updating...
  DEBUG ─ Waiting for CDN deploy success...
  DEBUG ─ CDN deploy success to host: fullstack.yugasun.com
  DEBUG ─ Setup https for fullstack.yugasun.com...

  MyCDN:
    host:   fullstack.yugasun.com
    origin: rahbqkq-a81kuv2-1251556596.cos-website.ap-guangzhou.myqcloud.com
    hostId: 1714502
    https:  true

  100s › MyCDN › done
```

### 4. 移除

通过以下命令移除部署的 CDN 配置：

```console
$ sls remove --debug

  DEBUG ─ Flushing template state and removing all components.
  DEBUG ─ Start removing CDN for fullstack.yugasun.com
  DEBUG ─ Waiting for offline fullstack.yugasun.com...
  DEBUG ─ Removing CDN for fullstack.yugasun.com
  DEBUG ─ Removed CDN for fullstack.yugasun.com.

  73s › MyCDN › done
```

### 账号配置（可选）

当前默认支持 CLI 扫描二维码登录，如您希望配置持久的环境变量/秘钥信息，也可以本地创建 `.env` 文件

```shell
$ touch .env # 腾讯云的配置信息
```

在 `.env` 文件中配置腾讯云的 SecretId 和 SecretKey 信息并保存

如果没有腾讯云账号，可以在此[注册新账号](https://cloud.tencent.com/register)。

如果已有腾讯云账号，可以在[API 密钥管理](https://console.cloud.tencent.com/cam/capi)中获取 `SecretId` 和`SecretKey`.

```text
# .env
TENCENT_SECRET_ID=123
TENCENT_SECRET_KEY=123
```

### 还支持哪些组件？

可以在 [Serverless Components](https://github.com/serverless/components) repo 中查询更多组件的信息。
npm package: @serverless/tencent-cloudfunction
Description: Tencent Serverless Cloud Function
Author: Tencent Cloud
Latest version: 1.1.0

# serverless cloud funtion

Deploy scf functions to tencent in seconds with [Serverless Components](https://github.com/serverless/components).


1. [Install](#1-install)
2. [Create](#2-create)
3. [Configure](#3-configure)
4. [Deploy](#4-deploy)
5. [Remove](#5-remove)

&nbsp;

### 1. Install

```console
$ npm install -g serverless
```

### 2. Create

Just create `serverless.yml` and `.env` files

```console
$ touch serverless.yml
$ touch .env # your Tencent API Keys
```

Set Tencent credentials in the `.env` file.

```
# .env
TENCENT_SECRET_ID=123
TENCENT_SECRET_KEY=123
TENCENT_APP_ID=123
```

### 3. Configure

```yml
# serverless.yml
myFunction1:
  component: "@serverless/tencent-cloudfunction"
  inputs:
    name: myFunction1
    # code dir path
    codeUri: ./code
    handler: index.main_handler
    runtime: Nodejs8.9  // If the function has been established, no modification is allowed
    region: ap-guangzhou  // If the function has been established, change area will cause the function to redeploy
    description: My Serverless Function
    memorySize: 128
    timeout: 20
    # zip compress ignore file or directory
    ignores:
      - .gitignore
      - .git/**
      - node_modules/**
      - .serverless
      - .env
    environment:
      variables:
        TEST: vale
    vpcConfig:
      subnetId: ''
      vpcId: ''

myFunction2:
  component: "@serverless/tencent-cloudfunction"
  inputs:
    name: myFunction2
    # code dir path
    codeUri: ./code
   

```

### 4. Deploy

```console
$ serverless --debug
```

### 5. Remove

```console
$ serverless remove --debug
```

### Test
```text
DFOUNDERLIU-MB0:temp dfounderliu$ sls

  myFunction1: 
    Name:        myFunction1
    Runtime:     Nodejs8.9
    Handler:     index.main_handler
    MemorySize:  128
    Timeout:     200
    Region:      ap-guangzhou
    Role:        QCS_SCFExcuteRole
    Description: My Serverless Function
    UsingCos:    true
    CodeSize:    243 B

  3s › myFunction1 › done

DFOUNDERLIU-MB0:temp dfounderliu$ sls remove

  14s › myFunction1 › done

```

### New to Components?

Checkout the [Serverless Components](https://github.com/serverless/components) repo for more information.
npm package: @serverless/tencent-cos
Description: Tencent Cloud Object Storage
Author: Serverless, Inc.
Latest version: 1.2.15

# 腾讯云对象存储 COS 组件

&nbsp;

- [请点击这里查看英文版部署文档](./README_EN.md)

## 简介

该组件是 serverless-tencent 组件库中的基础组件之一。通过对象存储 COS 组件，可以快速，方便的创建，配置和管理腾讯云的 COS 存储桶

## 快速开始

通过 COS 组件，对一个 COS 存储桶进行完整的创建，配置，部署和删除等操作。支持命令如下：

1. [安装](#1-安装)
2. [配置](#2-配置)
3. [部署](#3-部署)
4. [移除](#4-移除)

### 1. 安装

通过 npm 安装 serverless

```console
$ npm install -g serverless
```

### 2. 配置

本地创建 `serverless.yml` 文件，在其中进行如下配置

```console
$ touch serverless.yml
```

```yml
# serverless.yml

myBucket:
  component: '@serverless/tencent-cos'
  inputs:
    bucket: my-bucket
    region: ap-guangzhou
```

- [点击此处查看配置文档](https://github.com/serverless-tencent/tencent-cos/blob/master/docs/configure.md)

### 3. 部署

如您的账号未[登陆](https://cloud.tencent.com/login)或[注册](https://cloud.tencent.com/register)腾讯云，您可以直接通过`微信`扫描命令行中的二维码进行授权登陆和注册。

通过`sls`命令进行部署，并可以添加`--debug`参数查看部署过程中的信息

```
$ sls --debug

  DEBUG ─ Resolving the template's static variables.
  DEBUG ─ Collecting components from the template.
  DEBUG ─ Downloading any NPM components found in the template.
  DEBUG ─ Analyzing the template's components dependencies.
  DEBUG ─ Creating the template's components graph.
  DEBUG ─ Syncing template state.
  DEBUG ─ Executing the template's components graph.
  DEBUG ─ Deploying "my-bucket-1300415943" bucket in the "ap-guangzhou" region.
  DEBUG ─ "my-bucket-1300415943" bucket was successfully deployed to the "ap-guangzhou" region.
  DEBUG ─ Setting ACL for "my-bucket-1300415943" bucket in the "ap-guangzhou" region.
  DEBUG ─ Ensuring no CORS are set for "my-bucket-1300415943" bucket in the "ap-guangzhou" region.
  DEBUG ─ Ensuring no Tags are set for "my-bucket-1300415943" bucket in the "ap-guangzhou" region.

  myBucket:
    bucket: my-bucket-1300415943
    region: ap-guangzhou

  10s › myBucket › done
```

### 4. 移除

**注意：**删除服务将导致用过的存储桶也被清空和删除。此操作无法撤消。

通过以下命令移除部署的存储桶

```
$ sls remove --debug

  DEBUG ─ Flushing template state and removing all components.
  DEBUG ─ Removing files from the "my-bucket-1300415943" bucket.
  DEBUG ─ Removing "my-bucket-1300415943" bucket from the "ap-guangzhou" region.
  DEBUG ─ "my-bucket-1300415943" bucket was successfully removed from the "ap-guangzhou" region.

  2s › myBucket › done
```

#### 账号配置（可选）

当前默认支持 CLI 扫描二维码登录，如您希望配置持久的环境变量/秘钥信息，也可以本地创建 `.env` 文件

```console
$ touch .env # 腾讯云的配置信息
```

在 `.env` 文件中配置腾讯云的 SecretId 和 SecretKey 信息并保存。

```
# .env
TENCENT_SECRET_ID=123
TENCENT_SECRET_KEY=123
```

> ?
>
> - 如果没有腾讯云账号，请先 [注册新账号](https://cloud.tencent.com/register)。
> - 如果已有腾讯云账号，可以在 [API 密钥管理
>   ](https://console.cloud.tencent.com/cam/capi) 中获取 SecretId 和 SecretKey。

### 还支持哪些组件？

可以在 [Serverless Components](https://github.com/serverless/components) repo 中查询更多组件的信息。