{"id":28478208,"url":"https://github.com/seanhandley/datacentred-go","last_synced_at":"2025-07-24T12:39:45.008Z","repository":{"id":57600905,"uuid":"104334994","full_name":"seanhandley/datacentred-go","owner":"seanhandley","description":"Go SDK for the DataCentred Management API","archived":false,"fork":false,"pushed_at":"2017-10-06T08:13:08.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-07T17:10:51.805Z","etag":null,"topics":["api-client","datacentred","golang","openstack"],"latest_commit_sha":null,"homepage":"https://my.datacentred.io/api","language":"Go","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/seanhandley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-21T10:36:40.000Z","updated_at":"2017-10-24T11:24:55.000Z","dependencies_parsed_at":"2022-08-25T17:52:17.606Z","dependency_job_id":null,"html_url":"https://github.com/seanhandley/datacentred-go","commit_stats":null,"previous_names":["datacentred/datacentred-go"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/seanhandley/datacentred-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanhandley%2Fdatacentred-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanhandley%2Fdatacentred-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanhandley%2Fdatacentred-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanhandley%2Fdatacentred-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seanhandley","download_url":"https://codeload.github.com/seanhandley/datacentred-go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanhandley%2Fdatacentred-go/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263193463,"owners_count":23428523,"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":["api-client","datacentred","golang","openstack"],"created_at":"2025-06-07T17:09:36.351Z","updated_at":"2025-07-02T18:31:03.089Z","avatar_url":"https://github.com/seanhandley.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Datacentred](https://assets-cdn.datacentred.io/assets/DC_Mono_B-903aac5ca4f5c6887193d880dbd1196deb8a978027eef5cb32de78b66d085935.png)\n\n[![CircleCI](https://circleci.com/gh/datacentred/datacentred-go.svg?style=svg)](https://circleci.com/gh/datacentred/datacentred-go) [![Go Report Card](https://goreportcard.com/badge/github.com/datacentred/datacentred-go)](https://goreportcard.com/report/github.com/datacentred/datacentred-go) [![GoDoc](https://godoc.org/github.com/datacentred/datacentred-go?status.svg)](https://godoc.org/github.com/datacentred/datacentred-go)\n\nClient library for automating DataCentred account management in Go.\n\n[www.datacentred.co.uk](https://www.datacentred.co.uk)\n\n# Installation\n\nRun:\n\n```\ngo get github.com/datacentred/datacentred-go\n```\n\nIn your code:\n\n```go\nimport(\n    \"github.com/datacentred/datacentred-go\"\n)\n```\n\n# Usage\n\nThis SDK allows you to automate operations against your DataCentred account.\n\nOperations include:\n\n* Creating and managing users;\n* Creating and managing roles for users;\n* Managing OpenStack Project creation, quota adjustments, and user assignments;\n* Viewing detailed usage/billing information for your account.\n\n## Authentication\n\nThe API used by this SDK uses two pieces of information to authenticate access.\n\nA unique access key specific to your DataCentred account, and a secret key which is generated once.\n\nTo get started:\n\n1. Find your API access key and secret key at [my.datacentred.io](https://my.datacentred.io)\n\n![API Credentials](https://user-images.githubusercontent.com/98526/30334767-79f4617c-97d8-11e7-962c-ec3115d13896.png)\n\n2. Set your credentials by exporting your access key and secret key as environment variables in your shell:\n\n```\nexport DATACENTRED_ACCESS=\"my_access\"\nexport DATACENTRED_SECRET=\"my_secret\"\n```\n\nOr set your keys manually using the following code:\n\n```go\ndatacentred.Config.AccessKey = \"my_access\"\ndatacentred.Config.SecretKey = \"my_secret\"\n```\n\n## Usage Examples\n\n### List all available users\n\n```go\nusers, err := datacentred.Users()\nfmt.Println(users)\n// =\u003e [{2bd21ee25cde40fdb9454954e4fbb4b5 bill.s.preston@esquire.com Bill Preston 2015-02-13 11:07:00 +0000 UTC 2017-09-26 09:11:38 +0000 UTC } {69a34c127dcb439fa9366762234687ac ted.theodore@logan.com Ted Logan 2014-08-22 14:32:31 +0000 UTC 2017-09-21 14:55:43 +0000 UTC }]\n```\n\n### Find a user by id\n\n```go\nuser, err := datacentred.FindUser(\"2bd21ee25cde40fdb9454954e4fbb4b5\")\nfmt.Println(user)\n// =\u003e {2bd21ee25cde40fdb9454954e4fbb4b5 bill.s.preston@esquire.com Bill Preston 2015-02-13 11:07:00 +0000 UTC 2017-09-26 09:11:38 +0000 UTC } \n```\n\n### Update a project\n\n```go\nproject, err := datacentred.FindProject(\"37033518a4514f12adeb8346ac3f188c\")\nproject.QuotaSet.Compute.Instances = 50\n_, err = project.Save()\nfmt.Println(project)\n// =\u003e [{37033518a4514f12adeb8346ac3f188c seancentred {{40 50 60000} {40 10 5} {0 10 50 10 10 100 10}} 2015-04-09 08:14:19 +0000 UTC 2016-12-08 11:44:05 +0000 UTC}\n```\n\n### Create a role\n\n```go\nparams := map[string]string{\n  \"name\": \"Wyld Stallyns\",\n}\n\nrole, err := CreateRole(params)\nfmt.Println(role)\n// =\u003e {5713b281-b9f7-41d7-bc8c-9eb92920d1d3 Wyld Stallyns false [] 2017-09-26 09:42:56 +0000 UTC 2017-09-26 09:42:56 +0000 UTC}\n```\n\n### Add a user to a role\n\n```go\nuser, _ := datacentred.Users()[0]\nresult, err := role.AddUser(user.Id)\nfmt.Println(result)\n// =\u003e true\n```\n\n### Remove a user from a project\n\n```go\nusers, _ := datacentred.Users()\nuser := users[0]\nresult, err = project.RemoveUser(user.Id)\nfmt.Println(result)\n// =\u003e true\n```\n\n### Get usage data for a given year and month\n\n\n```go\nusage, err := datacentred.FindUsage(2017, 9)\nfmt.Println(usage.Projects[0].Usage.Instances[0].Usage.Value)\n// =\u003e 744\nfmt.Println(usage.Projects[0].Usage.Instances[0].Usage.Unit)\n// =\u003e \"hours\"\n```\n\n## Documentation\n\nhttps://godoc.org/github.com/datacentred/datacentred-go\n\n## API Reference Manual\n\nPlease check out the [DataCentred API Documentation](https://my.datacentred.io/api/docs/v1) for a comprehensive description of the API itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanhandley%2Fdatacentred-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseanhandley%2Fdatacentred-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanhandley%2Fdatacentred-go/lists"}