本文整理汇总了Golang中github.com/cloudfoundry/gunk/urljoiner.Join函数的典型用法代码示例。如果您正苦于以下问题:Golang Join函数的具体用法?Golang Join怎么用?Golang Join使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Join函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetProviders
func (of OAuthFactory) GetProviders(teamName string) (Providers, error) {
team, found, err := of.db.GetTeamByName(teamName)
if err != nil {
return Providers{}, err
}
if !found {
return Providers{}, errors.New("team not found")
}
providers := Providers{}
if len(team.GitHubAuth.Organizations) > 0 ||
len(team.GitHubAuth.Teams) > 0 ||
len(team.GitHubAuth.Users) > 0 {
redirectURL, err := of.routes.CreatePathForRoute(of.callback, rata.Params{
"provider": github.ProviderName,
})
if err != nil {
return Providers{}, err
}
gitHubAuthProvider := github.NewProvider(team.GitHubAuth, urljoiner.Join(of.atcExternalURL, redirectURL))
providers[github.ProviderName] = gitHubAuthProvider
}
return providers, err
}
示例2: compilerDownloadURL
func (backend *dockerBackend) compilerDownloadURL() (*url.URL, error) {
lifecycleFilename := backend.config.Lifecycles["docker"]
if lifecycleFilename == "" {
return nil, ErrNoCompilerDefined
}
parsed, err := url.Parse(lifecycleFilename)
if err != nil {
return nil, errors.New("couldn't parse compiler URL")
}
switch parsed.Scheme {
case "http", "https":
return parsed, nil
case "":
break
default:
return nil, fmt.Errorf("unknown scheme: '%s'", parsed.Scheme)
}
urlString := urljoiner.Join(backend.config.FileServerURL, "/v1/static", lifecycleFilename)
url, err := url.ParseRequestURI(urlString)
if err != nil {
return nil, fmt.Errorf("failed to parse compiler download URL: %s", err)
}
return url, nil
}
示例3: compilerDownloadURL
func (backend *traditionalBackend) compilerDownloadURL(request cc_messages.StagingRequestFromCC, buildpackData cc_messages.BuildpackStagingData) (*url.URL, error) {
compilerPath, ok := backend.config.Lifecycles[request.Lifecycle+"/"+buildpackData.Stack]
if !ok {
return nil, ErrNoCompilerDefined
}
parsed, err := url.Parse(compilerPath)
if err != nil {
return nil, errors.New("couldn't parse compiler URL")
}
switch parsed.Scheme {
case "http", "https":
return parsed, nil
case "":
break
default:
return nil, errors.New("Unknown Scheme")
}
staticPath, err := fileserver.Routes.CreatePathForRoute(fileserver.StaticRoute, nil)
if err != nil {
return nil, fmt.Errorf("couldn't generate the compiler download path: %s", err)
}
urlString := urljoiner.Join(backend.config.FileServerURL, staticPath, compilerPath)
url, err := url.ParseRequestURI(urlString)
if err != nil {
return nil, fmt.Errorf("failed to parse compiler download URL: %s", err)
}
return url, nil
}
示例4: lifecycleDownloadURL
func lifecycleDownloadURL(lifecyclePath string, fileServerURL string) string {
staticPath, err := fileserver.Routes.CreatePathForRoute(fileserver.StaticRoute, nil)
if err != nil {
panic("couldn't generate the download path for the bundle of app lifecycle binaries: " + err.Error())
}
return urljoiner.Join(fileServerURL, staticPath, lifecyclePath)
}
示例5: pollingResponseBody
func pollingResponseBody(jobGuid, status string, baseUrl string) string {
url := urljoiner.Join("/v2/jobs", jobGuid)
if baseUrl != "" {
url = urljoiner.Join(baseUrl, url)
}
return fmt.Sprintf(`
{
"metadata":{
"guid": "%s",
"url": "%s"
},
"entity": {
"status": "%s"
}
}
`, jobGuid, url, status)
}
示例6: verifyPollingRequest
func verifyPollingRequest(jobGuid, status string, timeClicker chan time.Time) http.HandlerFunc {
return ghttp.CombineHandlers(
ghttp.VerifyRequest("GET", urljoiner.Join("/v2/jobs/", jobGuid)),
ghttp.RespondWith(http.StatusOK, pollingResponseBody(jobGuid, status, "")),
func(w http.ResponseWriter, r *http.Request) {
timeClicker <- time.Now()
},
)
}
示例7: cloudfrontURL
func (up *RequestURLProvider) cloudfrontURL(request InRequest, remotePath string) string {
url := urljoiner.Join(request.Source.CloudfrontURL, remotePath)
if request.Version.VersionID != "" {
url = url + "?versionId=" + request.Version.VersionID
}
return url
}
示例8: buildArtifactsUploadURL
func (backend *traditionalBackend) buildArtifactsUploadURL(request cc_messages.StagingRequestFromCC, buildpackData cc_messages.BuildpackStagingData) (*url.URL, error) {
path, err := ccuploader.Routes.CreatePathForRoute(ccuploader.UploadBuildArtifactsRoute, rata.Params{
"app_guid": request.AppId,
})
if err != nil {
return nil, fmt.Errorf("couldn't generate build artifacts cache upload URL: %s", err)
}
urlString := urljoiner.Join(backend.config.CCUploaderURL, path)
u, err := url.ParseRequestURI(urlString)
if err != nil {
return nil, fmt.Errorf("failed to parse build artifacts cache upload URL: %s", err)
}
values := make(url.Values, 1)
values.Add(cc_messages.CcBuildArtifactsUploadUriKey, buildpackData.BuildArtifactsCacheUploadUri)
u.RawQuery = values.Encode()
return u, nil
}
示例9: NewCcClient
func NewCcClient(baseURI string, username string, password string, skipCertVerify bool) CcClient {
httpClient := &http.Client{
Timeout: appCrashedRequestTimeout,
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 10 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
TLSHandshakeTimeout: 10 * time.Second,
TLSClientConfig: &tls.Config{
InsecureSkipVerify: skipCertVerify,
MinVersion: tls.VersionTLS10,
},
},
}
return &ccClient{
ccURI: urljoiner.Join(baseURI, appCrashedPath),
username: username,
password: password,
httpClient: httpClient,
}
}
示例10:
BeforeEach(func() {
var err error
page, err = agoutiDriver.NewPage()
Expect(err).NotTo(HaveOccurred())
})
AfterEach(func() {
Expect(page.Destroy()).To(Succeed())
})
homepage := func() string {
return fmt.Sprintf("http://127.0.0.1:%d", atcPort)
}
withPath := func(path string) string {
return urljoiner.Join(homepage(), path)
}
allBuildsListIcon := ".nav-right .nav-item"
allBuildsListIconLink := ".nav-right .nav-item a"
firstBuildNumber := ".table-row:nth-of-type(1) .build-number"
firstBuildLink := ".table-row:nth-of-type(1) a"
secondBuildLink := ".table-row:nth-of-type(2) a"
homeLink := ".js-groups li:nth-of-type(2) a"
Context("with a one off build", func() {
var oneOffBuild db.Build
var build db.Build
BeforeEach(func() {
location := event.OriginLocation{ID: 1, ParentID: 0, ParallelGroup: 0}
示例11:
{"bbs", componentMaker.BBS()},
{"receptor", componentMaker.Receptor()},
{"auctioneer", componentMaker.Auctioneer()},
{"file-server", fileServer},
}))
bridge = ginkgomon.Invoke(grouper.NewParallel(os.Kill, grouper.Members{
{"cc", fakeCC},
{"stager", componentMaker.Stager()},
{"nsync-listener", componentMaker.NsyncListener()},
}))
u, err := url.Parse(fakeCC.Address())
Expect(err).NotTo(HaveOccurred())
u.User = url.UserPassword(fakeCC.Username(), fakeCC.Password())
u.Path = urljoiner.Join("staging", "droplets", appId, "upload?async=true")
dropletUploadUri = u.String()
u.Path = urljoiner.Join("staging", "buildpack_cache", appId, "upload")
buildArtifactsUploadUri = u.String()
})
AfterEach(func() {
helpers.StopProcesses(cell, brain, bridge)
})
stageApplication := func(stagingGuid, payload string) (*http.Response, error) {
stageURL := urljoiner.Join("http://"+componentMaker.Addresses.Stager, "v1", "staging", stagingGuid)
request, err := http.NewRequest("PUT", stageURL, strings.NewReader(payload))
Expect(err).NotTo(HaveOccurred())
return http.DefaultClient.Do(request)
示例12: storeStatsEndpoint
func (t *ETCDMetrics) storeStatsEndpoint(etcdAddr string) string {
return urljoiner.Join(etcdAddr, "v2", "stats", "store")
}
示例13: keysEndpoint
func (t *ETCDMetrics) keysEndpoint(etcdAddr string) string {
return urljoiner.Join(etcdAddr, "v2", "keys")
}
示例14:
))
})
It("succeeds and prints an error message to help the user", func() {
flyCmd := exec.Command(flyPath, "-t", atcServer.URL()+"/", "configure", "awesome-pipeline", "-c", configFile.Name())
stdin, err := flyCmd.StdinPipe()
Ω(err).ShouldNot(HaveOccurred())
sess, err := gexec.Start(flyCmd, GinkgoWriter, GinkgoWriter)
Ω(err).ShouldNot(HaveOccurred())
Eventually(sess).Should(gbytes.Say(`apply configuration\? \(y/n\): `))
fmt.Fprintln(stdin, "y")
pipelineURL := urljoiner.Join(atcServer.URL(), "pipelines", "awesome-pipeline")
Eventually(sess).Should(gbytes.Say("pipeline created!"))
Eventually(sess).Should(gbytes.Say(fmt.Sprintf("you can view your pipeline here: %s", pipelineURL)))
Eventually(sess).Should(gbytes.Say("the pipeline is currently paused. to unpause, either:"))
Eventually(sess).Should(gbytes.Say(" - run again with --paused=false"))
Eventually(sess).Should(gbytes.Say(" - click play next to the pipeline in the web ui"))
<-sess.Exited
Ω(sess.ExitCode()).Should(Equal(0))
Ω(atcServer.ReceivedRequests()).Should(HaveLen(2))
})
})
示例15:
"num_instances": `+strconv.Itoa(instances)+`,
"memory_mb": 256,
"disk_mb": 1024,
"file_descriptors": 16384,
"environment":[{"name":"VCAP_APPLICATION", "value":"{}"}],
"routes": `+routes+`,
"log_guid": "%s"
}
`,
guid,
fmt.Sprintf("http://%s/v1/static/%s", componentMaker.Addresses.FileServer, "droplet.zip"),
componentMaker.DefaultStack(),
appId,
)
desireURL := urljoiner.Join("http://"+componentMaker.Addresses.NsyncListener, "v1", "apps", guid)
request, err := http.NewRequest("PUT", desireURL, strings.NewReader(desireMessage))
Expect(err).NotTo(HaveOccurred())
request.Header.Set("Content-Type", "application/json")
return http.DefaultClient.Do(request)
}
BeforeEach(func() {
appId = helpers.GenerateGuid()
fileServer, fileServerStaticDir := componentMaker.FileServer()
runtime = ginkgomon.Invoke(grouper.NewParallel(os.Kill, grouper.Members{
{"bbs", componentMaker.BBS()},
{"receptor", componentMaker.Receptor()},