1.5.9 • Published 4 years ago

@tencent-serverless/tencent-cam-policy-beta v1.5.9

Weekly downloads
-
License
Apache
Repository
-
Last release
4 years ago

Tencent-cam-policy

Easily provision Tencent CAM policy using Serverless Components.

 

 

  1. Install
  2. Create
  3. Configure
  4. Deploy
  5. Remove

 

1. Install

$ npm install -g serverless

2. Create

Just create a serverless.yml file

$ touch serverless.yml
$ touch .env      # your Tencent api keys

If you don't have a Tencent Cloud account, you could sign up first.

If you already login in, find TENCENT_SECRET_ID and TENCENT_SECRET_KEY in Tencent Console.

# .env
TENCENT_SECRET_ID=123
TENCENT_SECRET_KEY=123

3. Configure

# serverless.yml

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

4. Deploy

$ 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. Remove

$ sls remove --debug

  DEBUG ─ Flushing template state and removing all components.

  1s › myPolicy › done

New to Components?

Checkout the Serverless Components repo for more information.