File: bindings.rst

package info (click to toggle)
python-designateclient 6.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 796 kB
  • sloc: python: 4,496; makefile: 26; sh: 2
file content (40 lines) | stat: -rw-r--r-- 1,107 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
.. _bindings:

===========================
Python Bindings - v2
===========================

The python-designateclient package comes with python bindings
the Designate API: v2. This can be used to interact with the Designate
API from any python program.

Introduction - Bindings v2
==========================

To view examples of usage please checkout the *doc/examples* folder, basic usage is:

.. code-block:: python

   #!/usr/bin/env python
   from designateclient.v2 import client
   from designateclient import shell

   from keystoneauth1.identity import generic
   from keystoneauth1 import session as keystone_session


   auth = generic.Password(
    auth_url=shell.env('OS_AUTH_URL'),
    username=shell.env('OS_USERNAME'),
    password=shell.env('OS_PASSWORD'),
    project_name=shell.env('OS_PROJECT_NAME'),
    project_domain_id='default',
    user_domain_id='default')

   session = keystone_session.Session(auth=auth)

   client = client.Client(session=session)

   zone = client.zones.create('i.io.', email='i@i.io')

   rs = client.recordsets.create(zone['id'], 'www', 'A', ['10.0.0.1'])