CROC Cloud API Client#

Important

To work with CROC Cloud API Client, you need Python 2 ≥ 2.7.9 or Python 3 ≥ 3.4

To work with various CROC Cloud API, you can use the utilities from the c2-client package:

The package includes the following utilities:

  • c2-as — a client for Auto Scaling API;

  • c2-ct — command-line client for CloudTrail API;

  • c2-cw — command-line client for CloudWatch API;

  • c2-ec2 — command-line client for EC2 API;

  • c2-eks — command-line client for the EKS API;

  • c2-paas — command-line client for PaaS API;

  • c2-elb — command-line client for the Elastic Load Balancing API;

  • c2-route53 — command-line client for Route53 API;

  • c2rc-convert — utility for converting settings to be used in Windows.

To manage resources in CROC Cloud via API, you should use the customized version of the python-boto and python-boto3 libraries.

Installation#

All operation systems#

pip install git+https://github.com/C2Devel/boto.git@@BOTO_VERSION@-@BOTO_RELEASE@
pip install git+https://github.com/C2Devel/boto3.git
pip install git+https://github.com/C2Devel/botocore.git
pip install c2client

Linux#

[user@host ~]$ sudo wget https://copr.fedorainfracloud.org/coprs/c2devel/c2-sdk/repo/epel-6/c2devel-c2-sdk-epel-6.repo \
  -O /etc/yum.repos.d/c2devel-c2-sdk-epel-6.repo
[user@host ~]$ sudo yum install python-boto c2-client
[user@host ~]$ sudo wget https://copr.fedorainfracloud.org/coprs/c2devel/c2-sdk/repo/epel-7/c2devel-c2-sdk-epel-7.repo \
 -O /etc/yum.repos.d/c2devel-c2-sdk-epel-7.repo
[user@host ~]$ sudo yum install python-boto c2-client

Use#

Get API access settings in the CROC Cloud management console. Click the user login in the top right corner, select Profile Get API access settings.

In the C2_PROJECT variable, specify your project ID.

Add the settings you have got to environment variables:

For Windows, convert the settings file and export environment variables:

C:\> c2rc-convert path\to\c2rc.sh path\to\c2rc.bat
C:\> call path\to\c2rc.bat

For Linux, export environment variables:

source path/to/c2rc.sh

Now you can use the utilities according to documentation. For example:

c2-ec2 DescribeAvailabilityZones
c2-eks DescribeCluster name backend_production