cf-copilot 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 651ed652ed54626994734f86ee06512083462f86
4
- data.tar.gz: 9e2a059983f0e0a3947697eaa670bbfc4f2c3c58
3
+ metadata.gz: 111090a607e297c9032abbd2850d1df993fd6efe
4
+ data.tar.gz: 279e31f4249998ce9a0b83b275fdcc4032c2687b
5
5
  SHA512:
6
- metadata.gz: 4e01bf34405aa7271c2c2901faede410c9b9f148b86f007fc0f7f391c3cba00cd92b2f46bf15b2f5494bcf72a989a2248edf0f349f01f40387f7a7f1d0d6260e
7
- data.tar.gz: 8c9306ca2ce3922603d30b0632ddfa4078ff9c584b4dbb9776f455927bab928c4d1dde9cf685f6524a36c53f70ee936bfc83ed78abd0ebcc1a670bb181054ad0
6
+ metadata.gz: a406ca97277e260a4b6358996edcfb9c6ee6f4feb977eb50956f93dd1088677abd008d302edb7fe72d29abd29b8bd8600fe87574cef9aeffc588f02adb45a4b8
7
+ data.tar.gz: a1830e80cbc245ad54661dd2d85968365012b9e18706f9363d784d808b1cb6c1cd6f10aa9b7c6737415b8611d219a74ab1e100f9acabf9df5deb65874150cb3a
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ set -eu -o pipefail
4
+
5
+ pushd "${COPILOT_ROOT}/sdk/ruby"
6
+ gem build ./cf-copilot.gemspec && gem install cf-copilot
7
+ popd
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ set -euo pipefail
4
+
5
+ docker build -t protobuf-ruby-dependencies .
6
+ docker run -v "${COPILOT_ROOT}:/tmp/copilot" -it protobuf-ruby-dependencies /bin/bash
7
+ cd /tmp/copilot
@@ -0,0 +1,12 @@
1
+ #!/bin/bash
2
+
3
+ set -euo pipefail
4
+
5
+ echo "Generating services and messages for cf-copilot..."
6
+
7
+ pushd "${COPILOT_ROOT}/api/protos"
8
+ protoc --ruby_out="${COPILOT_ROOT}/sdk/ruby/lib/copilot/protos" \
9
+ --grpc_out="${COPILOT_ROOT}/sdk/ruby/lib/copilot/protos" \
10
+ --plugin="protoc-gen-grpc=$(which grpc_tools_ruby_protoc_plugin)" \
11
+ ./cloud_controller.proto
12
+ popd
@@ -0,0 +1,12 @@
1
+ #!/bin/bash
2
+
3
+ set -euo pipefail
4
+
5
+ pushd "${COPILOT_ROOT}/cmd"
6
+ go install ./copilot-server
7
+ popd
8
+
9
+ pushd "${COPILOT_ROOT}/sdk/ruby"
10
+ bundle install
11
+ bundle exec rspec
12
+ popd
@@ -6,6 +6,7 @@ require 'copilot/protos/cloud_controller_services_pb'
6
6
  module Cloudfoundry
7
7
  module Copilot
8
8
  class Client
9
+ class PilotError < StandardError; end
9
10
 
10
11
  attr_reader :host, :port
11
12
 
@@ -28,23 +29,31 @@ module Cloudfoundry
28
29
  route = Api::Route.new(guid: guid, host: host)
29
30
  request = Api::UpsertRouteRequest.new(route: route)
30
31
  service.upsert_route(request)
32
+ rescue GRPC::BadStatus => e
33
+ raise Cloudfoundry::Copilot::Client::PilotError, "#{e.details} - #{e.metadata}"
31
34
  end
32
35
 
33
36
  def delete_route(guid:)
34
37
  request = Api::DeleteRouteRequest.new(guid: guid)
35
38
  service.delete_route(request)
39
+ rescue GRPC::BadStatus => e
40
+ raise Cloudfoundry::Copilot::Client::PilotError, "#{e.details} - #{e.metadata}"
36
41
  end
37
42
 
38
43
  def map_route(capi_process_guid:, route_guid:)
39
44
  route_mapping = Api::RouteMapping.new(capi_process_guid: capi_process_guid, route_guid: route_guid)
40
45
  request = Api::MapRouteRequest.new(route_mapping: route_mapping)
41
46
  service.map_route(request)
47
+ rescue GRPC::BadStatus => e
48
+ raise Cloudfoundry::Copilot::Client::PilotError, "#{e.details} - #{e.metadata}"
42
49
  end
43
50
 
44
51
  def unmap_route(capi_process_guid:, route_guid:)
45
52
  route_mapping = Api::RouteMapping.new(capi_process_guid: capi_process_guid, route_guid: route_guid)
46
53
  request = Api::UnmapRouteRequest.new(route_mapping: route_mapping)
47
54
  service.unmap_route(request)
55
+ rescue GRPC::BadStatus => e
56
+ raise Cloudfoundry::Copilot::Client::PilotError, "#{e.details} - #{e.metadata}"
48
57
  end
49
58
 
50
59
  def upsert_capi_diego_process_association(capi_process_guid:, diego_process_guids:)
@@ -55,6 +64,8 @@ module Cloudfoundry
55
64
  })
56
65
 
57
66
  service.upsert_capi_diego_process_association(request)
67
+ rescue GRPC::BadStatus => e
68
+ raise Cloudfoundry::Copilot::Client::PilotError, "#{e.details} - #{e.metadata}"
58
69
  end
59
70
 
60
71
  def delete_capi_diego_process_association(capi_process_guid:)
@@ -62,6 +73,8 @@ module Cloudfoundry
62
73
  capi_process_guid: capi_process_guid
63
74
  )
64
75
  service.delete_capi_diego_process_association(request)
76
+ rescue GRPC::BadStatus => e
77
+ raise Cloudfoundry::Copilot::Client::PilotError, "#{e.details} - #{e.metadata}"
65
78
  end
66
79
 
67
80
  def bulk_sync(routes:, route_mappings:, capi_diego_process_associations:)
@@ -71,6 +84,8 @@ module Cloudfoundry
71
84
  capi_diego_process_associations: capi_diego_process_associations
72
85
  )
73
86
  service.bulk_sync(request)
87
+ rescue GRPC::BadStatus => e
88
+ raise Cloudfoundry::Copilot::Client::PilotError, "#{e.details} - #{e.metadata}"
74
89
  end
75
90
 
76
91
  private
@@ -1,5 +1,5 @@
1
1
  module Cloudfoundry
2
2
  module Copilot
3
- VERSION = "0.0.3"
3
+ VERSION = '0.0.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf-copilot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cloud Foundry Routing Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-02 00:00:00.000000000 Z
11
+ date: 2018-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grpc
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description:
70
84
  email:
71
85
  - cf-routing@pivotal.io
@@ -76,6 +90,10 @@ files:
76
90
  - LICENSE
77
91
  - NOTICE
78
92
  - README.md
93
+ - bin/build_and_install_copilot_gem
94
+ - bin/build_and_run_docker
95
+ - bin/generate_protos
96
+ - bin/test
79
97
  - lib/cf-copilot.rb
80
98
  - lib/copilot/protos/cloud_controller_pb.rb
81
99
  - lib/copilot/protos/cloud_controller_services_pb.rb