{"id":13501586,"url":"https://github.com/openstack/openstacksdk","last_synced_at":"2025-12-12T01:04:24.406Z","repository":{"id":13531923,"uuid":"16223378","full_name":"openstack/openstacksdk","owner":"openstack","description":"Unified SDK for OpenStack. Mirror of code maintained at opendev.org.","archived":false,"fork":false,"pushed_at":"2025-04-04T19:22:19.000Z","size":19747,"stargazers_count":275,"open_issues_count":0,"forks_count":201,"subscribers_count":40,"default_branch":"master","last_synced_at":"2025-04-07T04:16:22.203Z","etag":null,"topics":["client-tools"],"latest_commit_sha":null,"homepage":"https://opendev.org/openstack/openstacksdk","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openstack.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-01-25T02:48:00.000Z","updated_at":"2025-04-06T12:54:40.000Z","dependencies_parsed_at":"2024-08-06T19:15:59.940Z","dependency_job_id":"0dfc2065-f5ad-4669-aee6-cf2cf2326c2f","html_url":"https://github.com/openstack/openstacksdk","commit_stats":null,"previous_names":[],"tags_count":163,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openstack%2Fopenstacksdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openstack%2Fopenstacksdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openstack%2Fopenstacksdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openstack%2Fopenstacksdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openstack","download_url":"https://codeload.github.com/openstack/openstacksdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248908605,"owners_count":21181562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client-tools"],"created_at":"2024-07-31T22:01:42.474Z","updated_at":"2025-12-12T01:04:24.352Z","avatar_url":"https://github.com/openstack.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"============\nopenstacksdk\n============\n\nopenstacksdk is a client library for building applications to work\nwith OpenStack clouds. The project aims to provide a consistent and\ncomplete set of interactions with OpenStack's many services, along with\ncomplete documentation, examples, and tools.\n\nIt also contains an abstraction interface layer. Clouds can do many things, but\nthere are probably only about 10 of them that most people care about with any\nregularity. If you want to do complicated things, the per-service oriented\nportions of the SDK are for you. However, if what you want is to be able to\nwrite an application that talks to any OpenStack cloud regardless of\nconfiguration, then the Cloud Abstraction layer is for you.\n\nMore information about the history of openstacksdk can be found at\nhttps://docs.openstack.org/openstacksdk/latest/contributor/history.html\n\nGetting started\n---------------\n\n.. rubric:: Authentication and connection management\n\nopenstacksdk aims to talk to any OpenStack cloud. To do this, it requires a\nconfiguration file. openstacksdk favours ``clouds.yaml`` files, but can also\nuse environment variables. The ``clouds.yaml`` file should be provided by your\ncloud provider or deployment tooling. An example:\n\n.. code-block:: yaml\n\n    clouds:\n      mordred:\n        region_name: Dallas\n        auth:\n          username: 'mordred'\n          password: XXXXXXX\n          project_name: 'demo'\n          auth_url: 'https://identity.example.com'\n\nopenstacksdk will look for ``clouds.yaml`` files in the following locations:\n\n* If set, the path indicated by the ``OS_CLIENT_CONFIG_FILE`` environment\n  variable\n* ``.`` (the current directory)\n* ``$HOME/.config/openstack``\n* ``/etc/openstack``\n\nYou can create a connection using the ``openstack.connect`` function. The cloud\nname can be either passed directly to this function or specified using the\n``OS_CLOUD`` environment variable. If you don't have a ``clouds.yaml`` file and\ninstead use environment variables for configuration then you can use the\nspecial ``envvars`` cloud name to load configuration from the environment. For\nexample:\n\n.. code-block:: python\n\n    import openstack\n\n    # Initialize connection from a clouds.yaml by passing a cloud name\n    conn_from_cloud_name = openstack.connect(cloud='mordred')\n\n    # Initialize connection from a clouds.yaml using the OS_CLOUD envvar\n    conn_from_os_cloud = openstack.connect()\n\n    # Initialize connection from environment variables\n    conn_from_env_vars = openstack.connect(cloud='envvars')\n\n.. note::\n\n    How this is all achieved is described in more detail `below\n    \u003copenstack.config\u003e`__.\n\n.. rubric:: The cloud layer\n\nopenstacksdk consists of four layers which all build on top of each other. The\nhighest level layer is the *cloud* layer. Cloud layer methods are available via\nthe top level ``Connection`` object returned by ``openstack.connect``. For\nexample:\n\n.. code-block:: python\n\n    import openstack\n\n    # Initialize and turn on debug logging\n    openstack.enable_logging(debug=True)\n\n    # Initialize connection\n    conn = openstack.connect(cloud='mordred')\n\n    # List the servers\n    for server in conn.list_servers():\n        print(server.to_dict())\n\nThe cloud layer is based on logical operations that can potentially touch\nmultiple services. The benefit of this layer is mostly seen in more complicated\noperations that take multiple steps and where the steps vary across providers.\nFor example:\n\n.. code-block:: python\n\n    import openstack\n\n    # Initialize and turn on debug logging\n    openstack.enable_logging(debug=True)\n\n    # Initialize connection\n    conn = openstack.connect(cloud='mordred')\n\n    # Upload an image to the cloud\n    image = conn.create_image(\n        'ubuntu-trusty', filename='ubuntu-trusty.qcow2', wait=True)\n\n    # Find a flavor with at least 512M of RAM\n    flavor = conn.get_flavor_by_ram(512)\n\n    # Boot a server, wait for it to boot, and then do whatever is needed\n    # to get a public IP address for it.\n    conn.create_server(\n        'my-server', image=image, flavor=flavor, wait=True, auto_ip=True)\n\n.. rubric:: The proxy layer\n\nThe next layer is the *proxy* layer. Most users will make use of this layer.\nThe proxy layer is service-specific, so methods will be available under\nservice-specific connection attributes of the ``Connection`` object such as\n``compute``, ``block_storage``, ``image`` etc. For example:\n\n.. code-block:: python\n\n    import openstack\n\n    # Initialize and turn on debug logging\n    openstack.enable_logging(debug=True)\n\n    # Initialize connection\n    conn = openstack.connect(cloud='mordred')\n\n    # List the servers\n    for server in conn.compute.servers():\n        print(server.to_dict())\n\n.. note::\n\n    A list of supported services is given `below \u003csupported-services\u003e`__.\n\n.. rubric:: The resource layer\n\nBelow this there is the *resource* layer. This provides support for the basic\nCRUD operations supported by REST APIs and is the base building block for the\nother layers. You typically will not need to use this directly but it can be\nhelpful for operations where you already have a ``Resource`` object to hand.\nFor example:\n\n.. code-block:: python\n\n    import openstack\n    import openstack.config.loader\n    import openstack.compute.v2.server\n\n    # Initialize and turn on debug logging\n    openstack.enable_logging(debug=True)\n\n    # Initialize connection\n    conn = openstack.connect(cloud='mordred')\n\n    # List the servers\n    for server in openstack.compute.v2.server.Server.list(session=conn.compute):\n        print(server.to_dict())\n\n.. rubric:: The raw HTTP layer\n\nFinally, there is the *raw HTTP* layer. This exposes raw HTTP semantics and\nis effectively a wrapper around the `requests`__ API with added smarts to\nhandle stuff like authentication and version management. As such, you can use\nthe ``requests`` API methods you know and love, like ``get``, ``post`` and\n``put``, and expect to receive a ``requests.Response`` object in response\n(unlike the other layers, which mostly all return objects that subclass\n``openstack.resource.Resource``). Like the *resource* layer, you will typically\nnot need to use this directly but it can be helpful to interact with APIs that\nhave not or will not be supported by openstacksdk. For example:\n\n.. code-block:: python\n\n    import openstack\n\n    # Initialize and turn on debug logging\n    openstack.enable_logging(debug=True)\n\n    # Initialize connection\n    conn = openstack.connect(cloud='mordred')\n\n    # List servers\n    for server in openstack.compute.get('/servers').json():\n        print(server)\n\n.. __: https://requests.readthedocs.io/en/latest/\n\n.. _openstack.config:\n\nConfiguration\n-------------\n\nopenstacksdk uses the ``openstack.config`` module to parse configuration.\n``openstack.config`` will find cloud configuration for as few as one cloud and\nas many as you want to put in a config file. It will read environment variables\nand config files, and it also contains some vendor specific default values so\nthat you don't have to know extra info to use OpenStack\n\n* If you have a config file, you will get the clouds listed in it\n* If you have environment variables, you will get a cloud named `envvars`\n* If you have neither, you will get a cloud named `defaults` with base defaults\n\nYou can view the configuration identified by openstacksdk in your current\nenvironment by running ``openstack.config.loader``. For example:\n\n.. code-block:: bash\n\n   $ python -m openstack.config.loader\n\nMore information at https://docs.openstack.org/openstacksdk/latest/user/config/configuration.html\n\n.. _supported-services:\n\nSupported services\n------------------\n\nThe following services are currently supported. A full list of all available\nOpenStack service can be found in the `Project Navigator`__.\n\n.. note::\n\n   Support here does not guarantee full-support for all APIs. It simply means\n   some aspect of the project is supported.\n\n.. list-table:: Supported services\n   :widths: 15 25 10 40\n   :header-rows: 1\n\n   * - Service\n     - Description\n     - Cloud Layer\n     - Proxy \u0026 Resource Layer\n\n   * - **Compute**\n     -\n     -\n     -\n\n   * - Nova\n     - Compute\n     - ✔\n     - ✔ (``openstack.compute``)\n\n   * - **Hardware Lifecycle**\n     -\n     -\n     -\n\n   * - Ironic\n     - Bare metal provisioning\n     - ✔\n     - ✔ (``openstack.baremetal``, ``openstack.baremetal_introspection``)\n\n   * - Cyborg\n     - Lifecycle management of accelerators\n     - ✔\n     - ✔ (``openstack.accelerator``)\n\n   * - **Storage**\n     -\n     -\n     -\n\n   * - Cinder\n     - Block storage\n     - ✔\n     - ✔ (``openstack.block_storage``)\n\n   * - Swift\n     - Object store\n     - ✔\n     - ✔ (``openstack.object_store``)\n\n   * - Cinder\n     - Shared filesystems\n     - ✔\n     - ✔ (``openstack.shared_file_system``)\n\n   * - **Networking**\n     -\n     -\n     -\n\n   * - Neutron\n     - Networking\n     - ✔\n     - ✔ (``openstack.network``)\n\n   * - Octavia\n     - Load balancing\n     - ✔\n     - ✔ (``openstack.load_balancer``)\n\n   * - Designate\n     - DNS\n     - ✔\n     - ✔ (``openstack.dns``)\n\n   * - **Shared services**\n     -\n     -\n     -\n\n   * - Keystone\n     - Identity\n     - ✔\n     - ✔ (``openstack.identity``)\n\n   * - Placement\n     - Placement\n     - ✔\n     - ✔ (``openstack.placement``)\n\n   * - Glance\n     - Image storage\n     - ✔\n     - ✔ (``openstack.image``)\n\n   * - Barbican\n     - Key management\n     - ✔\n     - ✔ (``openstack.key_manager``)\n\n   * - **Workload provisioning**\n     -\n     -\n     -\n\n   * - Magnum\n     - Container orchestration engine provisioning\n     - ✔\n     - ✔ (``openstack.container_infrastructure_management``)\n\n   * - **Orchestration**\n     -\n     -\n     -\n\n   * - Heat\n     - Orchestration\n     - ✔\n     - ✔ (``openstack.orchestration``)\n\n   * - Senlin\n     - Clustering\n     - ✔\n     - ✔ (``openstack.clustering``)\n\n   * - Mistral\n     - Workflow\n     - ✔\n     - ✔ (``openstack.workflow``)\n\n   * - Zaqar\n     - Messaging\n     - ✔\n     - ✔ (``openstack.message``)\n\n   * - **Application lifecycle**\n     -\n     -\n     -\n\n   * - Masakari\n     - Instances high availability service\n     - ✔\n     - ✔ (``openstack.instance_ha``)\n\n.. __: https://www.openstack.org/software/project-navigator/openstack-components#openstack-services\n\nLinks\n-----\n\n* `Issue Tracker \u003chttps://bugs.launchpad.net/openstacksdk\u003e`_\n* `Code Review \u003chttps://review.opendev.org/#/q/status:open+project:openstack/openstacksdk,n,z\u003e`_\n* `Documentation \u003chttps://docs.openstack.org/openstacksdk/latest/\u003e`_\n* `PyPI \u003chttps://pypi.org/project/openstacksdk/\u003e`_\n* `Mailing list \u003chttps://lists.openstack.org/mailman3/lists/openstack-discuss.lists.openstack.org/\u003e`_\n* `Release Notes \u003chttps://docs.openstack.org/releasenotes/openstacksdk\u003e`_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenstack%2Fopenstacksdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenstack%2Fopenstacksdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenstack%2Fopenstacksdk/lists"}