Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
9cc3688e
Commit
9cc3688e
authored
Jan 06, 2016
by
Matt Butcher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(*): add DM client, fix makefile
parent
69e62568
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
140 additions
and
6 deletions
+140
-6
.gitignore
.gitignore
+1
-0
Makefile
Makefile
+4
-4
client.go
dm/client.go
+82
-0
glide.lock
glide.lock
+49
-2
glide.yaml
glide.yaml
+4
-0
No files found.
.gitignore
View file @
9cc3688e
vendor/
vendor/
bin/helm
Makefile
View file @
9cc3688e
...
@@ -4,8 +4,8 @@ endif
...
@@ -4,8 +4,8 @@ endif
BIN_DIR
:=
bin
BIN_DIR
:=
bin
DIST_DIR
:=
_dist
DIST_DIR
:=
_dist
GO_PACKAGES
:=
action chart config dependency log manifest release plugins/sec plugins/example codec
GO_PACKAGES
:=
cmd dm
MAIN_GO
:=
helm.go
MAIN_GO
:=
cmd/
helm.go
HELM_BIN
:=
$(BIN_DIR)
/helm
HELM_BIN
:=
$(BIN_DIR)
/helm
PATH_WITH_HELM
=
PATH
=
"
$(
shell
pwd
)
/
$(BIN_DIR)
:
$(PATH)
"
PATH_WITH_HELM
=
PATH
=
"
$(
shell
pwd
)
/
$(BIN_DIR)
:
$(PATH)
"
...
@@ -18,7 +18,7 @@ ifndef VERSION
...
@@ -18,7 +18,7 @@ ifndef VERSION
endif
endif
build
:
$(MAIN_GO)
build
:
$(MAIN_GO)
go build
-o
$(HELM_BIN)
-ldflags
"-X github.com/helm/helm/c
li
.version=
${
VERSION
}
"
$<
go build
-o
$(HELM_BIN)
-ldflags
"-X github.com/helm/helm/c
md
.version=
${
VERSION
}
"
$<
bootstrap
:
bootstrap
:
go get
-u
github.com/golang/lint/golint github.com/mitchellh/gox
go get
-u
github.com/golang/lint/golint github.com/mitchellh/gox
...
@@ -54,7 +54,7 @@ else
...
@@ -54,7 +54,7 @@ else
endif
endif
quicktest
:
quicktest
:
$(PATH_WITH_HELM)
go
test
-short
./
$
(
addprefix ./,
$(GO_PACKAGES)
)
$(PATH_WITH_HELM)
go
test
-short
$
(
addprefix ./,
$(GO_PACKAGES)
)
test
:
test-style
test
:
test-style
$(PATH_WITH_HELM)
go
test
-v
./
$
(
addprefix ./,
$(GO_PACKAGES)
)
$(PATH_WITH_HELM)
go
test
-v
./
$
(
addprefix ./,
$(GO_PACKAGES)
)
...
...
dm/client.go
0 → 100644
View file @
9cc3688e
package
dm
import
(
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"time"
"github.com/ghodss/yaml"
)
var
DefaultHTTPTimeout
time
.
Duration
type
Client
struct
{
// Timeout on HTTP connections.
HTTPTimeout
time
.
Duration
// The remote host
Host
string
// The protocol. Currently only http and https are supported.
Protocol
string
}
func
NewClient
(
host
string
)
*
Client
{
return
&
Client
{
HTTPTimeout
:
DefaultHTTPTimeout
,
Protocol
:
"https"
,
Host
:
host
,
}
}
func
(
c
*
Client
)
url
(
path
string
)
string
{
// TODO: Switch to net.URL
return
c
.
Protocol
+
"://"
+
c
.
Host
+
"/"
+
path
}
// CallService is a low-level function for making an API call.
func
(
c
*
Client
)
CallService
(
path
,
method
,
action
string
,
reader
io
.
ReadCloser
)
{
u
:=
c
.
url
(
path
)
resp
:=
c
.
callHttp
(
u
,
method
,
action
,
reader
)
var
j
interface
{}
if
err
:=
json
.
Unmarshal
([]
byte
(
resp
),
&
j
);
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"Failed to parse JSON response from service: %s"
,
resp
))
}
y
,
err
:=
yaml
.
Marshal
(
j
)
if
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"Failed to serialize JSON response from service: %s"
,
resp
))
}
fmt
.
Println
(
string
(
y
))
}
func
(
c
*
Client
)
callHttp
(
path
,
method
,
action
string
,
reader
io
.
ReadCloser
)
string
{
request
,
err
:=
http
.
NewRequest
(
method
,
path
,
reader
)
request
.
Header
.
Add
(
"Content-Type"
,
"application/json"
)
client
:=
http
.
Client
{
Timeout
:
time
.
Duration
(
time
.
Duration
(
DefaultHTTPTimeout
)
*
time
.
Second
),
}
response
,
err
:=
client
.
Do
(
request
)
if
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"cannot %s: %s
\n
"
,
action
,
err
))
}
defer
response
.
Body
.
Close
()
body
,
err
:=
ioutil
.
ReadAll
(
response
.
Body
)
if
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"cannot %s: %s
\n
"
,
action
,
err
))
}
if
response
.
StatusCode
<
http
.
StatusOK
||
response
.
StatusCode
>=
http
.
StatusMultipleChoices
{
message
:=
fmt
.
Sprintf
(
"status code: %d status: %s : %s"
,
response
.
StatusCode
,
response
.
Status
,
body
)
panic
(
fmt
.
Errorf
(
"cannot %s: %s
\n
"
,
action
,
message
))
}
return
string
(
body
)
}
glide.lock
View file @
9cc3688e
hash:
2f47b12bf634894e182800b5565efd124c6defff6291b60408cbba6a038778ae
hash:
4cc1aba06a344d43c0c1005d71dc0659ada5d90f0b2235b1d8e8c7352d1251a7
updated: 2016-01-06T1
3:51:49.95440773
5-08:00
updated: 2016-01-06T1
4:30:55.04126787
5-08:00
imports:
imports:
- name: github.com/codegangsta/cli
- name: github.com/codegangsta/cli
version: c31a7975863e7810c92e2e288a9ab074f9a88f29
version: c31a7975863e7810c92e2e288a9ab074f9a88f29
- name: github.com/emicklei/go-restful
version: ce94a9f819d7dd2b5599ff0c017b1124595a64fb
- name: github.com/ghodss/yaml
version: 73d445a93680fa1a78ae23a5839bad48f32ba1ee
- name: github.com/golang/glog
version: fca8c8854093a154ff1eb580aae10276ad6b1b5f
- name: github.com/golang/protobuf
version: 2402d76f3d41f928c7902a765dfc872356dd3aad
- name: github.com/google/go-github
version: 63fbbb283ce4913a5ac1b6de7abae50dbf594a04
- name: github.com/google/go-querystring
version: 2a60fc2ba6c19de80291203597d752e9ba58e4c0
- name: github.com/gorilla/context
version: 1c83b3eabd45b6d76072b66b746c20815fb2872d
- name: github.com/gorilla/handlers
version: 1af6d56d7cd39d982856bc0cee11142baf392c52
- name: github.com/gorilla/mux
version: 26a6070f849969ba72b72256e9f14cf519751690
- name: github.com/gorilla/schema
version: 14c555599c2a4f493c1e13fd1ea6fdf721739028
- name: github.com/kubernetes/deployment-manager
version: 62f19486073edd020a11922304130f0c5c1dff20
subpackages:
- /common
- name: github.com/mjibson/appstats
version: 0542d5f0e87ea3a8fa4174322b9532f5d04f9fa8
- name: golang.org/x/crypto
version: 552e9d568fde9701ea1944fb01c8aadaceaa7353
- name: golang.org/x/net
version: 1ade16a5450925b7496e1031938175d1f5d30d31
- name: golang.org/x/oauth2
version: 2baa8a1b9338cf13d9eeb27696d761155fa480be
- name: golang.org/x/text
version: cf4986612c83df6c55578ba198316d1684a9a287
- name: google.golang.com/appengine
version: ""
repo: https://google.golang.com/appengine
- name: google.golang.org/api
version: f5b7ec483f357a211c03c6722a840444c2d395dc
- name: google.golang.org/appengine
version: 54bf9150c922186bfc45a00bf9dfcb91a5063275
- name: google.golang.org/cloud
version: 1bff51b8fae8d33cb3dab8f7858c266ce001ee3e
- name: google.golang.org/grpc
version: 78905999da08d7f87d5dd11608fa79ff8700daa8
- name: gopkg.in/yaml.v2
version: f7716cbe52baa25d2e9b0d0da546fcf909fc16b4
devImports: []
devImports: []
glide.yaml
View file @
9cc3688e
package
:
github.com/engineyard/helm-dm
package
:
github.com/engineyard/helm-dm
import
:
import
:
-
package
:
github.com/codegangsta/cli
-
package
:
github.com/codegangsta/cli
-
package
:
github.com/kubernetes/deployment-manager
subpackages
:
-
/common
-
package
:
github.com/ghodss/yaml
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment