Hi,
I am trying to establish a connection to openstack cloud . I am able to
establish a connection with the following statement
from openstack import connectionconn =
connection.Connection(auth_url="http://192.168.0.19:5000/v3",
project_name="admin",username="admin",
password="6908a8d218f843dd", user_domain_id="default",
project_domain_id="default")
I am looking for exact Connection api argument match in below connection.py
file. Also, i am looking for api to access the object store(list out
files,creating backup) and network(creating subnet). I am able to create
duplicate subnet in network. It doesn't prompt out any error.
Thanks,Jayshankar
# Licensed under the Apache License, Version 2.0 (the "License"); you mayb# not
use this file except in compliance with the License. You may obtain# a copy of
the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless
required by applicable law or agreed to in writing, software# distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT# WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the# License for the
specific language governing permissions and limitations# under the License.
"""The :class:`~openstack.connection.Connection` class is the primary
interfaceto the Python SDK. It maintains a context for a connection to a region
ofa cloud provider. The :class:`~openstack.connection.Connection` has
anattribute to access each OpenStack service.
At a minimum, the :class:`~openstack.connection.Connection` class needs to
becreated with a config or the parameters to build one.
While the overall system is very flexible, there are four main use casesfor
different ways to create a :class:`~openstack.connection.Connection`.
* Using config settings and keyword arguments as described in
:ref:`openstack-config`* Using only keyword arguments passed to the constructor
ignoring config files and environment variables.* Using an existing
authenticated `keystoneauth1.session.Session`, such as might exist inside of
an OpenStack service operational context.* Using an existing
:class:`~openstack.config.cloud_region.CloudRegion`.
Using config settings-
For users who want to create a :class:`~openstack.connection.Connection`
makinguse of named clouds in ``clouds.yaml`` files, ``OS_`` environment
variablesand python keyword arguments, the :func:`openstack.connect` factory
functionis the recommended way to go:
.. code-block:: python
import openstack
conn = openstack.connect(cloud='example', region_name='earth1')
If the application in question is a command line application that should
alsoaccept command line arguments, an `argparse.Namespace` can be passed
to:func:`openstack.connect` that will have relevant arguments added to it
andthen subsequently consumed by the construtor:
.. code-block:: python
import argparse import openstack
options = argparse.ArgumentParser(description='Awesome OpenStack App')
conn = openstack.connect(options=options)
Using Only Keyword Arguments
If the application wants to avoid loading any settings from ``clouds.yaml``
orenvironment variables, use the
:class:`~openstack.connection.Connection`constructor directly. As long as the
``cloud`` argument is omitted or ``None``,the
:class:`~openstack.connection.Connection` constructor will not loadsettings
from files or the environment.
.. note::
This is a different default behavior than the :func:`~openstack.connect`
factory function. In :func:`~openstack.connect` if ``cloud`` is omitted or
``None``, a default cloud will be loaded, defaulting to the ``envvars``
cloud if it exists.
.. code-block:: python
from openstack import connection
conn = connection.Connection( region_name='example-region',
auth=dict( auth_url='https://auth.example.com',
username='amazing-user', password='super-secret-password',
project_id='33aa1afc-03fe-43b8-8201-4e0d3b4b8ab5',
user_domain_id='054abd68-9ad9-418b-96d3-3437bb376703'),
compute_api_version='2', identity_interface='internal')
Per-service settings as needed by `keystoneauth1.adapter.Adapter` such
as``api_version``, ``service_name``, and ``interface`` can be set, as
seenabove, by prefixing them with the official ``service-type`` name of
theservice. ``region_name`` is a setting for the
entire:class:`~openstack.config.cloud_region.CloudRegion` and cannot be set
perservice.
From existing authenticated Session---
For applications that already have an authenticated Session, simply passingit
to the :class:`~openstack.connection.Connection` constructor is all thatis
needed:
.. code-block:: python
from openstack import connection
conn = connection.Connection( session=session,
region_name='exa