Metadata-Version: 2.1
Name: c7n_huaweicloud
Version: 0.1.1
Summary: Cloud Custodian - Huawei Cloud Support
Home-page: https://cloudcustodian.io
License: Apache-2.0
Author: Cloud Custodian Project
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Distributed Computing
Classifier: Topic :: System :: Systems Administration
Requires-Dist: esdk-obs-python (>=3.24.12,<4.0.0)
Requires-Dist: huaweicloudsdkantiddos (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkcbr (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkces (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkcoc (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkconfig (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkcts (>=3.1.139,<4.0.0)
Requires-Dist: huaweicloudsdkdeh (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkecs (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkeg (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkeip (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkelb (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdker (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkevs (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkfunctiongraph (>=3.1.141,<4.0.0)
Requires-Dist: huaweicloudsdkgeip (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkiam (>=3.1.140,<4.0.0)
Requires-Dist: huaweicloudsdkims (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkkms (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdklts (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdknat (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkobs (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkorganizations (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkram (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdksecmaster (>=3.1.140,<4.0.0)
Requires-Dist: huaweicloudsdksfsturbo (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdksmn (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdktms (>=3.1.138,<4.0.0)
Requires-Dist: huaweicloudsdkvpc (>=3.1.138,<4.0.0)
Requires-Dist: jsonpatch (>=1.25,<2.0)
Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
Project-URL: Documentation, https://cloudcustodian.io/docs/
Project-URL: Repository, https://github.com/cloud-custodian/cloud-custodian
Description-Content-Type: text/markdown

# Cloud Custodian - Huawei Cloud Support

This is a plugin to Cloud Custodian that adds Huawei Cloud support.

## Install Cloud Custodian and Huawei Cloud Plugin

The Huawei Cloud provider must be installed as a separate package in addition to c7n.

    $ pip install c7n_huaweicloud

## Write your first policy

Cloud Custodian policies are expressed in YAML and include the following:

* The type of resource to run the policy against
* Filters to narrow down the set of resources
* Actions to take on the filtered set of resources

Our first policy filters compute instance of a specific name, then adds the tag ``mark_deletion: true``.

Create a file named ``custodian.yml`` with the following content.

    policies:
        - name: filter-for-encrypted-volume
          resource: huaweicloud.evs-volume
          filters:
            - type: value
              key: metadata.__system__encrypted
              value: "0"
          actions:
            - delete

## Run your policy

    export HUAWEI_ACCESS_KEY_ID="YOUR_ACCESS_KEY_ID"
    export HUAWEI_SECRET_ACCESS_KEY="YOUR_SECRET_ACCESS_KEY"
    export HUAWEI_DEFAULT_REGION="YOUR_REGION"

    custodian run --output-dir=. custodian.yml

If successful, you should see output like the following on the command line::

    2025-03-14 16:44:00,553 - custodian.policy - INFO - policy:filter-for-encrypted-volume resource:huaweicloud.volume region: count:1 time:0.92
    2025-03-14 16:44:00,771 - custodian.huaweicloud.resources.volume - INFO - Received Job ID:90f0aed1b4ee443d80dc3faddc543ad9
    2025-03-14 16:44:00,771 - custodian.policy - INFO - policy:filter-for-encrypted-volume action:volumedelete resources:1 execution_time:0.22

You can find a new ``filter-for-encrypted-volume`` under --output-dir option value directory with a log and a ``resources.json`` file.

## Links
- [Getting Started](https://cloudcustodian.io/docs/huaweicloud/gettingstarted.html)
- [Example Scenarios](https://cloudcustodian.io/docs/huaweicloud/examples/index.html)

