Skip to main content

No project description provided

Project description

CSP Cloud Provider for Idem

DEVELOPMENT

Clone the idem-csp repository and install with pip.

git clone git@gitlab.com:vmware/idem/idem-csp.git
pip install -e idem_csp

ACCT

After installation the CSP Idem Provider execution and state modules will be accessible to the pop hub. In order to use them we need to set up our credentials. Follow the instructions to generate an api token.

Create a new file called credentials.yaml and populate it with credentials. The default profile will be used automatically by idem unless you specify one with –acct-profile=profile_name on the cli.

There are many ways aws providers/profiles can be stored. See acct backends for more information.

A profile needs to specify the api key it uses and can optionally specify the api url.

credentials.yaml

csp.token:
  default:
    refresh_token: dmd23q3au8ljyajcvhz207of4ivsn9vjiaxzez223qeagdpe0voqiasknykv58jt
    default_org_id: defaults_to_the_logged_in_user_org_id
    # Optional configuration, defaults will be used for these values if not supplied
    csp_url: https://console.cloud.vmware.com

A profile can also be created that uses an access_token directly. However, a csp_url and default_org_id must be explicitly defined.

credentials.yaml

csp:
    my_profile:
        csp_url: https://console.cloud.vmware.com
        default_org_id: my_org_id
        headers:
            csp-auth-token: kl2k3jjoij0un093wjn092w34jta0-3

Now encrypt the credentials file and add the encryption key and encrypted file path to the ENVIRONMENT.

The acct command should be available as it is a requisite of idem and idem-csp. Encrypt the the credential file.

acct encrypt credentials.yaml

output:

-A9ZkiCSOjWYG_lbGmmkVh4jKLFDyOFH4e4S1HNtNwI=

Add these to your environment:

export ACCT_KEY="-A9ZkiCSOjWYG_lbGmmkVh4jKLFDyOFH4e4S1HNtNwI="
export ACCT_FILE=$PWD/credentials.yaml.fernet

Usage

This plugin allows your app to integrate csp authentication.

If your project implements exec modules then add csp to the auth plugins for your project like so:

# my_project_root/my_project/exec/my_project/init.py
def __init__(hub):
    hub.exec.my_project.ACCT = ["csp"]

If your project implements state modules then add csp to the auth plugins for your project like so:

# my_project_root/my_project/states/my_project/init.py
def __init__(hub):
    hub.states.my_project.ACCT = ["csp"]
async def my_func(hub, ctx):
    # Call any exec modules from idem-aiohttp, the ctx contains the right headers for csp apps
    ret = await hub.exec.json.get(ctx, url=f"my_app_url")
    # ret.result will be "True" if the command was a success
    assert ret.result, ret.comment
    # ret.ret has the return data
    return ret.ret

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

idem-csp-2.0.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

idem_csp-2.0.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file idem-csp-2.0.0.tar.gz.

File metadata

  • Download URL: idem-csp-2.0.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for idem-csp-2.0.0.tar.gz
Algorithm Hash digest
SHA256 66f4e5e9aa936bc6502930a6bcc1eb241bbf9941d1df6871524a24be95b07617
MD5 547cac5b36c63349813227c88f92ed58
BLAKE2b-256 484494abfa988b11119ffa176a5415c69a631fcbb2f1e19ab15cbd8616a8b13e

See more details on using hashes here.

File details

Details for the file idem_csp-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: idem_csp-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for idem_csp-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64b6dc8800b1322e1432ec7e78259f810bbae4ea75fdfe990f082375d9ad0744
MD5 1b306ba2b899ae9e88f48d8b51667d31
BLAKE2b-256 b1bfd1d300f400d3e3a7fba5def09e52096547debab0b19b9e8398db69a688c7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page