inst_aws_regions 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f5cb17e845c603febdfd719a9f418224c856a987cc6b9cb12087fa0b563ccf89
4
+ data.tar.gz: e46126c0343715c5bf3ded5a7d38fa04971d4386c818f577f492283ed5832fa6
5
+ SHA512:
6
+ metadata.gz: d76d90ddf0d63db0f20003b0b9e62984e06136d7007d665ae391bd142bf063b64d99e4e3cb61ed135f8f79dc715ae1ed7da02303b64710aa6201e5f789258ca6
7
+ data.tar.gz: ec137e15d93faadcb2126faa6418a2ed8c8d528362241d82b898a879c7a02ec7cf7a9f3c57c4b897931f68017056b5ff40a7f47f8c1004412d804b47b47e1c4a
data/.rubocop.yml ADDED
@@ -0,0 +1,9 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+ NewCops: enable
4
+
5
+ Layout/LineLength:
6
+ Max: 120
7
+
8
+ Style/Documentation:
9
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in inst_aws_regions.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 13.0'
9
+
10
+ gem 'rubocop', '~> 1.21'
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rubocop/rake_task'
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :rubocop
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'inst/aws/regions'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/inst_aws_regions/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'inst_aws_regions'
7
+ spec.version = InstAwsRegions::VERSION
8
+ spec.authors = ['Jacob Burroughs']
9
+ spec.email = ['jburroughs@instructure.com']
10
+
11
+ spec.summary = 'Region to airport code mappings for instructure projects'
12
+ spec.homepage = 'https://github.com/instructure/inst_aws_regions'
13
+ spec.required_ruby_version = '>= 2.6.0'
14
+
15
+ spec.metadata['homepage_uri'] = spec.homepage
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
+ `git ls-files -z`.split("\x0").reject do |f|
21
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
22
+ end
23
+ end
24
+ spec.bindir = 'exe'
25
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ['lib']
27
+ spec.metadata['rubygems_mfa_required'] = 'true'
28
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module InstAwsRegions
4
+ module Mappings
5
+ FORWARD_MAPPINGS = {
6
+ 'aws' => {
7
+ 'cpt' => 'af-south-1',
8
+ 'hkg' => 'ap-east-1',
9
+ 'nrt' => 'ap-northeast-1',
10
+ 'icn' => 'ap-northeast-2',
11
+ 'bom' => 'ap-south-1',
12
+ 'sin' => 'ap-southeast-1',
13
+ 'syd' => 'ap-southeast-2',
14
+ 'yul' => 'ca-central-1',
15
+ 'fra' => 'eu-central-1',
16
+ 'arn' => 'eu-north-1',
17
+ 'mxp' => 'eu-south-1',
18
+ 'dub' => 'eu-west-1',
19
+ 'lhr' => 'eu-west-2',
20
+ 'cdg' => 'eu-west-3',
21
+ 'bah' => 'me-south-1',
22
+ 'gru' => 'sa-east-1',
23
+ 'iad' => 'us-east-1',
24
+ 'cmh' => 'us-east-2',
25
+ 'sfo' => 'us-west-1',
26
+ 'pdx' => 'us-west-2'
27
+ },
28
+ 'aws-cn' => {
29
+ 'bjs' => 'cn-north-1',
30
+ 'zhy' => 'cn-northwest-1'
31
+ },
32
+ 'aws-us-gov' => {
33
+ 'osu' => 'us-gov-east-1',
34
+ 'pdt' => 'us-gov-west-1'
35
+ }
36
+ }.freeze
37
+
38
+ REVERSE_MAPPINGS = FORWARD_MAPPINGS.transform_values(&:invert)
39
+
40
+ REGIONS = FORWARD_MAPPINGS.transform_values(&:values)
41
+
42
+ REGION_CODES = FORWARD_MAPPINGS.transform_values(&:keys)
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module InstAwsRegions
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'inst_aws_regions/mappings'
4
+ require_relative 'inst_aws_regions/version'
5
+
6
+ DEFAULT_PARTITION = 'aws'
7
+
8
+ module InstAwsRegions
9
+ def self.code_to_region(code, partition: DEFAULT_PARTITION)
10
+ Mappings::FORWARD_MAPPINGS[partition][code.downcase]
11
+ end
12
+
13
+ def self.region_to_code(region, partition: DEFAULT_PARTITION)
14
+ Mappings::REVERSE_MAPPINGS[partition][region.downcase]
15
+ end
16
+
17
+ def self.codes(partition: DEFAULT_PARTITION)
18
+ Mappings::REGION_CODES[partition]
19
+ end
20
+
21
+ def self.regions(partition: DEFAULT_PARTITION)
22
+ Mappings::REGIONS[partition]
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: inst_aws_regions
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jacob Burroughs
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-05-11 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - jburroughs@instructure.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".rubocop.yml"
21
+ - Gemfile
22
+ - Rakefile
23
+ - bin/console
24
+ - bin/setup
25
+ - inst_aws_regions.gemspec
26
+ - lib/inst_aws_regions.rb
27
+ - lib/inst_aws_regions/mappings.rb
28
+ - lib/inst_aws_regions/version.rb
29
+ homepage: https://github.com/instructure/inst_aws_regions
30
+ licenses: []
31
+ metadata:
32
+ homepage_uri: https://github.com/instructure/inst_aws_regions
33
+ rubygems_mfa_required: 'true'
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.6.0
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubygems_version: 3.1.4
50
+ signing_key:
51
+ specification_version: 4
52
+ summary: Region to airport code mappings for instructure projects
53
+ test_files: []