commit
148b7baf4c
4 changed files with 14 additions and 16 deletions
11
README.md
11
README.md
|
@ -1,11 +1,10 @@
|
||||||
# gorealis [](https://godoc.org/github.com/rdelval/gorealis)
|
# gorealis [](https://godoc.org/github.com/rdelval/gorealis)
|
||||||
|
|
||||||
Go library for communicating with [Apache Aurora](https://github.com/apache/aurora).
|
Go library for interacting with [Apache Aurora](https://github.com/apache/aurora).
|
||||||
Named after the northern lights (Aurora Borealis).
|
|
||||||
|
|
||||||
### Aurora version compatibility
|
### Aurora version compatibility
|
||||||
Please see [.auroraversion](./.auroraversion) to see the latest Aurora version against which this
|
Please see [.auroraversion](./.auroraversion) to see the latest Aurora version against which this
|
||||||
library has been tested. Vendoring a working version of this library is highly recommended.
|
library has been tested.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@ -17,9 +16,5 @@ library has been tested. Vendoring a working version of this library is highly r
|
||||||
* Create or import a custom transport that uses https://github.com/jmcvetta/napping to improve efficiency
|
* Create or import a custom transport that uses https://github.com/jmcvetta/napping to improve efficiency
|
||||||
* End to end testing with Vagrant setup
|
* End to end testing with Vagrant setup
|
||||||
|
|
||||||
## Importing
|
|
||||||
* We suggest using a vendoring tool such as [govendor](https://github.com/kardianos/govendor) and
|
|
||||||
fetching by version, for example: `govendor fetch github.com/rdelval/gorealis@v1`
|
|
||||||
|
|
||||||
## Contributions
|
## Contributions
|
||||||
Contributions are very much welcome. Please raise an issue so that the contribution may be discussed before it's made.
|
Contributions are always welcome. Please raise an issue so that the contribution may be discussed before it's made.
|
|
@ -31,6 +31,8 @@ import (
|
||||||
"github.com/rdelval/gorealis/response"
|
"github.com/rdelval/gorealis/response"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const VERSION = "1.0.4"
|
||||||
|
|
||||||
type Realis interface {
|
type Realis interface {
|
||||||
AbortJobUpdate(updateKey aurora.JobUpdateKey, message string) (*aurora.Response, error)
|
AbortJobUpdate(updateKey aurora.JobUpdateKey, message string) (*aurora.Response, error)
|
||||||
AddInstances(instKey aurora.InstanceKey, count int32) (*aurora.Response, error)
|
AddInstances(instKey aurora.InstanceKey, count int32) (*aurora.Response, error)
|
||||||
|
@ -225,6 +227,7 @@ func newTJSONConfig(url string, timeoutms int) (*RealisConfig, error) {
|
||||||
|
|
||||||
httpTrans := (trans).(*thrift.THttpClient)
|
httpTrans := (trans).(*thrift.THttpClient)
|
||||||
httpTrans.SetHeader("Content-Type", "application/x-thrift")
|
httpTrans.SetHeader("Content-Type", "application/x-thrift")
|
||||||
|
httpTrans.SetHeader("User-Agent", "GoRealis v"+VERSION)
|
||||||
|
|
||||||
return &RealisConfig{transport: trans, protoFactory: thrift.NewTJSONProtocolFactory()}, nil
|
return &RealisConfig{transport: trans, protoFactory: thrift.NewTJSONProtocolFactory()}, nil
|
||||||
}
|
}
|
||||||
|
@ -237,9 +240,11 @@ func newTBinaryConfig(url string, timeoutms int) (*RealisConfig, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
httpTrans := (trans).(*thrift.THttpClient)
|
httpTrans := (trans).(*thrift.THttpClient)
|
||||||
|
httpTrans.DelHeader("Content-Type") // Workaround for using thrift HttpPostClient
|
||||||
|
|
||||||
httpTrans.SetHeader("Accept", "application/vnd.apache.thrift.binary")
|
httpTrans.SetHeader("Accept", "application/vnd.apache.thrift.binary")
|
||||||
httpTrans.SetHeader("Content-Type", "application/vnd.apache.thrift.binary")
|
httpTrans.SetHeader("Content-Type", "application/vnd.apache.thrift.binary")
|
||||||
httpTrans.SetHeader("User-Agent", "GoRealis v1.0.4")
|
httpTrans.SetHeader("User-Agent", "GoRealis v"+VERSION)
|
||||||
|
|
||||||
return &RealisConfig{transport: trans, protoFactory: thrift.NewTBinaryProtocolFactoryDefault()}, nil
|
return &RealisConfig{transport: trans, protoFactory: thrift.NewTBinaryProtocolFactoryDefault()}, nil
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,10 @@ var r Realis
|
||||||
var thermosPayload []byte
|
var thermosPayload []byte
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
var err error
|
||||||
|
|
||||||
// New configuration to connect to Vagrant image
|
// New configuration to connect to Vagrant image
|
||||||
config, err := NewDefaultConfig("http://192.168.33.7:8081",10000)
|
r, err = NewDefaultClientUsingUrl("http://192.168.33.7:8081","aurora", "secret")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Please run vagrant box before running test suite")
|
fmt.Println("Please run vagrant box before running test suite")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -41,10 +43,6 @@ func TestMain(m *testing.M) {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configured for vagrant
|
|
||||||
AddBasicAuth(&config, "aurora", "secret")
|
|
||||||
r = NewClient(config)
|
|
||||||
|
|
||||||
os.Exit(m.Run())
|
os.Exit(m.Run())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
vendor/git.apache.org/thrift.git/lib/go/thrift/http_client.go
generated
vendored
4
vendor/git.apache.org/thrift.git/lib/go/thrift/http_client.go
generated
vendored
|
@ -103,7 +103,7 @@ func NewTHttpClientWithOptions(urlstr string, options THttpClientOptions) (TTran
|
||||||
if client == nil {
|
if client == nil {
|
||||||
client = DefaultHttpClient
|
client = DefaultHttpClient
|
||||||
}
|
}
|
||||||
httpHeader := map[string][]string{}
|
httpHeader := map[string][]string{"Content-Type": []string{"application/x-thrift"}}
|
||||||
return &THttpClient{client: client, response: response, url: parsedURL, header: httpHeader}, nil
|
return &THttpClient{client: client, response: response, url: parsedURL, header: httpHeader}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ func NewTHttpPostClientWithOptions(urlstr string, options THttpClientOptions) (T
|
||||||
if client == nil {
|
if client == nil {
|
||||||
client = DefaultHttpClient
|
client = DefaultHttpClient
|
||||||
}
|
}
|
||||||
httpHeader := map[string][]string{}
|
httpHeader := map[string][]string{"Content-Type": []string{"application/x-thrift"}}
|
||||||
return &THttpClient{client: client, url: parsedURL, requestBuffer: bytes.NewBuffer(buf), header: httpHeader}, nil
|
return &THttpClient{client: client, url: parsedURL, requestBuffer: bytes.NewBuffer(buf), header: httpHeader}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue