{"id":16484895,"url":"https://github.com/stephenmoloney/openstex_adapters_ovh","last_synced_at":"2026-04-28T20:02:29.367Z","repository":{"id":62430195,"uuid":"85328049","full_name":"stephenmoloney/openstex_adapters_ovh","owner":"stephenmoloney","description":"An adapter for the use of the openstex library with the OVH api.","archived":false,"fork":false,"pushed_at":"2017-11-02T15:21:46.000Z","size":22,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-10T03:14:48.827Z","etag":null,"topics":["elixir","elixir-lang","openstack","ovh","ovh-api","ovh-openstack","swift"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/openstex_adapters_ovh","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephenmoloney.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-17T15:40:07.000Z","updated_at":"2017-05-11T20:47:56.000Z","dependencies_parsed_at":"2022-11-01T20:18:10.730Z","dependency_job_id":null,"html_url":"https://github.com/stephenmoloney/openstex_adapters_ovh","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenmoloney%2Fopenstex_adapters_ovh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenmoloney%2Fopenstex_adapters_ovh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenmoloney%2Fopenstex_adapters_ovh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenmoloney%2Fopenstex_adapters_ovh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephenmoloney","download_url":"https://codeload.github.com/stephenmoloney/openstex_adapters_ovh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226195,"owners_count":20904464,"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":["elixir","elixir-lang","openstack","ovh","ovh-api","ovh-openstack","swift"],"created_at":"2024-10-11T13:18:38.974Z","updated_at":"2026-04-28T20:02:24.330Z","avatar_url":"https://github.com/stephenmoloney.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Openstex.Adapters.Ovh\n\nAn adapter for [Openstex](https://github.com/stephenmoloney/openstex)\nfor the [OVH API](https://github.com/stephenmoloney/ex_ovh).\n\n\n## Steps to getting started\n\n### (1) Installation\n\n- Add `:openstex_adapters_ovh` to your project list of dependencies.\n\n```elixir\ndefp deps() do\n  [\n    {:openstex_adapters_ovh, \"\u003e= 0.3.8\"}\n  ]\nend\n```\n\n- Ensure `openstex_adapters_ovh` is started before your application:\n\n```elixir\ndef application do\n  [applications: [:openstex_adapters_ovh]]\nend\n```\n\n### (2) Configure the Adapter Clients\n\n#### Generating the OVH `application key`, `application secret` and `consumer key`.\n\n- This may be done manually by going to `https://eu.api.ovh.com/createApp/` and following the directions outlined by `OVH` at\n[their first steps guide](https://api.ovh.com/g934.first_step_with_api).\n\n- Alternatively, this may be achieved by running a mix task. This saves me a lot of time when generating a new application.\n\n- [Documentation here](https://github.com/stephenmoloney/ex_ovh/blob/master/docs/mix_task.md)\n\n- The mix task should create a `.env` file in the root directory similar to:\n\n```shell\nexport MY_APP_CLIENT_APPLICATION_KEY=\"app_key\"\nexport MY_APP_CLIENT_APPLICATION_SECRET=\"app_secret\"\nexport MY_APP_CLIENT_CONSUMER_KEY=\"app_consumer_key\"\n```\n\n- Add the configuration for the openstack components of the client to `.env`:\n\n```shell\nexport MY_APP_CLIENT_TENANT_ID=\"tenant_id\"\nexport MY_APP_CLIENT_USER_ID=\"user_id\"\nexport MY_APP_CLIENT_TEMP_URL_KEY1=\"key1\"\nexport MY_APP_CLIENT_TEMP_URL_KEY2=\"key2\"\n```\n\n- The final confiruation file in `config.exs` should look like follows:\n\n```elixir\nconfig :my_app, MyApp.Client,\n    adapter: Openstex.Adapters.Ovh,\n    ovh: [\n      application_key: System.get_env(\"MY_APP_CLIENT_APPLICATION_KEY\"),\n      application_secret: System.get_env(\"MY_APP_CLIENT_OVH_APPLICATION_SECRET\"),\n      consumer_key: System.get_env(\"MY_APP_CLIENT_OVH_CONSUMER_KEY\")\n    ],\n    keystone: [\n      tenant_id: System.get_env(\"MY_APP_CLIENT_TENANT_ID\"), # mandatory, corresponds to an ovh project id or ovh servicename\n      user_id: System.get_env(\"MY_APP_CLIENT_USER_ID\"), # optional, if absent a user will be created using the ovh api.\n      endpoint: \"https://auth.cloud.ovh.net/v2.0\"\n    ],\n    swift: [\n      account_temp_url_key1: System.get_env(\"MY_APP_CLIENT_TEMP_URL_KEY1\"), # defaults to :nil if absent\n      account_temp_url_key2: System.get_env(\"MY_APP_CLIENT_TEMP_URL_KEY2\"), # defaults to :nil if absent\n      region: :nil #  set to \"SBG3\" or \"GRA3\" or \"BHS3\" -- but check with OVH as this may change.\n    ],\n    hackney: [\n      timeout: 20000,\n      recv_timeout: 40000\n    ]\n\nconfig :httpipe,\n  adapter: HTTPipe.Adapters.Hackney\n```\n\n\n### (3) Creating the client module\n\n- The client module is used for making requests.\n\n- Create the client module similar as follows:\n\n```elixir\ndefmodule MyApp.Client do\n  @moduledoc :false\n  use Openstex.Client, otp_app: :my_app, client: __MODULE__\n\n  defmodule Swift do\n    @moduledoc :false\n    use Openstex.Swift.V1.Helpers, otp_app: :my_app, client: MyApp.Client\n  end\n\n  defmodule Ovh do\n    @moduledoc :false\n    use ExOvh.Client, otp_app: :my_app, client: __MODULE__\n  end\nend\n```\n\n### (4) Adding the client to the supervision tree\n\n```elixir\ndef start(_type, _args) do\n  import Supervisor.Spec, warn: false\n  spec1 = [supervisor(MyApp.Endpoint, [])]\n  spec2 = [supervisor(MyApp.Client, [])]\n  opts = [strategy: :one_for_one, name: MyApp.Supervisor]\n  Supervisor.start_link(spec1 ++ spec2, opts)\nend\n```\n\n### (5) Using the client module\n\n#### To use the client for the `Openstex` API:\n\n- Creating a container using the `Openstex.Swift.V1` request generator and then sending the request.\n```elixir\n  MyApp.Client.start_link()\n  Openstex.Swift.V1.create_container(\"new_container\", \"my_swift_account\") |\u003e MyApp.Client.request()\n```\n\n- Uploading a file using the the `Openstex` Swift Helper:\n```elixir\n  file_path = Path.join(Path.expand(__DIR__), \"priv/test.txt\")\n  MyApp.Client.Swift.upload_file!(file_path, \"nested_folder/server_object.txt\", \"new_container\")\n```\n\n- Listing the objects using the `Openstex` Swift Helper:\n```elixir\n  MyApp.Client.Swift.list_objects!(\"new_container\")\n```\n\n\n#### To use the client for the `OVH` API:\n\n- Getting prices with the `ExOvh.V1.Cloud` request generator and then sending the request.\n```elixir\n  ExOvh.V1.Cloud.get_prices() |\u003e MyApp.Client.Ovh.request()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenmoloney%2Fopenstex_adapters_ovh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephenmoloney%2Fopenstex_adapters_ovh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenmoloney%2Fopenstex_adapters_ovh/lists"}