Skip to main content

A utility library that generates service name convention details based on a repo url.

Project description

https://travis-ci.org/gogoair/gogo-utils.svg?branch=master

Gogo-utils

gogo-utils is a utility library that generates a service name convention based on a repo url. The library is mainly used to ensure that an application is able to easily know the path to a service it may need.

from gogoutils import Parser, Generator

url = 'https://github.com/gogoair/test.git'
project, repo = Parser(url).parse_url()

# a way to customize based on your conventions
my_formats = {
    'jenkins_job_name': '{project}-{repo}-master',
    'app': 'app-{project}{repo}',
}

info = Generator(project, repo, 'dev', formats=my_formats)

info.jenkins()
> {'name': 'gogoair-test-master'}

info.app_name()
> app-gogoairtest

Classes

Parser

This class is needed to parse and gather details about a git repository. A url is split up and the result is a project, repo.

Generator

This class provides details about an application’s details when using different technologies. Its a simple and concise way to know how a specific app is referenced in jenkins, gitlab, s3, iam, dns and among other services tools.

Formats

This class provides a mechanism to alter the way Generator generates certain application references. It is mainly referenced within Generator to provide that functionality.

In setting up the format the following variables are exposed:

VARIABLE

DESCRIPTION

domain

Domain

env

Environment

project

Git project/group name (lowercase)

repo

Git repo name (lowercase)

raw_project

Git project/group name

raw_repo

Git repo name

These are the services you can customize the formats along with their default format:

SERVICE

DEFAULT

DESCRIPTION

domain

example.com

Domain

app

{repo}{project}

Application Name

dns_elb

{repo}.{project}.{env}.{domain}

FQDN of DNS ELB

dns_instance

{repo}{project}-xx.{env}.{domain}

FQDN of instances

iam_base

{project}_{repo}

IAM profile base

iam_user

{project}_{repo}

IAM username

iam_group

{project}

IAM group name

iam_role

{project}_{repo}_role

IAM role name

iam_policy

{project}_{repo}_policy

IAM policy name

iam_profile

{project}_{repo}_profile

IAM profile name

s3_bucket

archaius-{env}

S3 archaius bucket name

s3_bucket_path

{project}/{repo}{project}

S3 path for app (within s3_bucket)

s3_archaius_name

archaius-{env}/{project}/{repo}{project}/

S3 full path for archaius

s3_app_bucket

{project}-{repo}

Application specific S3 bucket name

jenkins_job_name

{project}_{repo}

Jenkins job name

git_repo

{raw_project}/{raw_repo}

Apps git repo

git_repo_qe

{raw_project}/{raw_repo}-qa

QA’s git repo

git_repo_configs

{raw_project}/{raw_repo}-config

Config git repo

apigateway_domain

api.{env}.{domain}

API gateway base domain

Contributions

We encourage contributions, feedback and any bug fixes.

Running Tests

Running tests are very quick and easy when using tox. We validate against python 2.7, 3.4 and 3.5.

To run the tests simply execute

# only needed once
$ pip install -r requirements-dev.txt

$ tox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gogo-utils-1.4.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gogo_utils-1.4-py2.py3-none-any.whl (9.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file gogo-utils-1.4.tar.gz.

File metadata

  • Download URL: gogo-utils-1.4.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for gogo-utils-1.4.tar.gz
Algorithm Hash digest
SHA256 04447306bf4438b0bbb0fdd30143779db1e292d5a1d606bbf9468616ebcac2f8
MD5 327f17717d3378baf47e8c8716c195cd
BLAKE2b-256 5548c7f11f9c15725997406a1ae0d59db43b7e75d28359fa99a7a7cf77a33ee7

See more details on using hashes here.

File details

Details for the file gogo_utils-1.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for gogo_utils-1.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a42891e9e4643d91842966b12fd1d511acd9a051e35848cf1c1f9e799816722d
MD5 f9e3447898e0ca8d29fa69df6c81eff4
BLAKE2b-256 ce68ae90065daafd3d58503ca8baa9fa3b64a7ed12874cc8a4f24199f4e4f38e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page