本文整理匯總了Golang中cf/net.NewNotFoundApiResponse函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewNotFoundApiResponse函數的具體用法?Golang NewNotFoundApiResponse怎麽用?Golang NewNotFoundApiResponse使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewNotFoundApiResponse函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: FindServicePlanByDescription
func (repo CloudControllerServiceRepository) FindServicePlanByDescription(planDescription ServicePlanDescription) (planGuid string, apiResponse net.ApiResponse) {
path := fmt.Sprintf("%s/v2/services?inline-relations-depth=1&q=label:%s;provider:%s",
repo.config.ApiEndpoint(),
planDescription.ServiceName,
planDescription.ServiceProvider)
response := new(PaginatedServiceOfferingResources)
apiResponse = repo.gateway.GetResource(path, repo.config.AccessToken(), response)
if apiResponse.IsNotSuccessful() {
return
}
for _, serviceOfferingResource := range response.Resources {
for _, servicePlanResource := range serviceOfferingResource.Entity.ServicePlans {
if servicePlanResource.Entity.Name == planDescription.ServicePlanName {
planGuid = servicePlanResource.Metadata.Guid
return
}
}
}
apiResponse = net.NewNotFoundApiResponse("Plan %s cannot be found", planDescription)
return
}
示例2: FindByUsername
func (repo *FakeUserRepository) FindByUsername(username string) (user cf.UserFields, apiResponse net.ApiResponse) {
repo.FindByUsernameUsername = username
user = repo.FindByUsernameUserFields
if repo.FindByUsernameNotFound {
apiResponse = net.NewNotFoundApiResponse("UserFields not found")
}
return
}
示例3: FindByName
func (repo *FakeServiceBrokerRepo) FindByName(name string) (serviceBroker cf.ServiceBroker, apiResponse net.ApiResponse) {
repo.FindByNameName = name
serviceBroker = repo.FindByNameServiceBroker
if repo.FindByNameNotFound {
apiResponse = net.NewNotFoundApiResponse("%s %s not found", "Service Broker", name)
}
return
}
示例4: FindByName
func (repo *FakeBuildpackRepository) FindByName(name string) (buildpack cf.Buildpack, apiResponse net.ApiResponse) {
repo.FindByNameName = name
buildpack = repo.FindByNameBuildpack
if repo.FindByNameNotFound {
apiResponse = net.NewNotFoundApiResponse("Buildpack %s not found", name)
}
return
}
示例5: TestMapDomainDomainNotFound
func TestMapDomainDomainNotFound(t *testing.T) {
reqFactory, domainRepo := getDomainMapperDeps()
domainRepo.FindByNameInOrgApiResponse = net.NewNotFoundApiResponse("Domain foo.com not found")
ui := callDomainMapper(t, true, []string{"my-space", "foo.com"}, reqFactory, domainRepo)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Mapping domain", "foo.com", "my-space"},
{"FAILED"},
{"Error finding", "foo.com"},
})
}
示例6: TestMapDomainDomainNotFound
func TestMapDomainDomainNotFound(t *testing.T) {
reqFactory, domainRepo := getDomainMapperDeps()
domainRepo.FindByNameInOrgApiResponse = net.NewNotFoundApiResponse("Domain foo.com not found")
ui := callDomainMapper(t, true, []string{"my-space", "foo.com"}, reqFactory, domainRepo)
assert.Equal(t, len(ui.Outputs), 3)
assert.Contains(t, ui.Outputs[0], "Mapping domain")
assert.Contains(t, ui.Outputs[0], "foo.com")
assert.Contains(t, ui.Outputs[0], "my-space")
assert.Contains(t, ui.Outputs[1], "FAILED")
assert.Contains(t, ui.Outputs[2], "foo.com")
}
示例7: FindByName
func (repo *FakeQuotaRepository) FindByName(name string) (quota cf.QuotaFields, apiResponse net.ApiResponse) {
repo.FindByNameName = name
quota = repo.FindByNameQuota
if repo.FindByNameNotFound {
apiResponse = net.NewNotFoundApiResponse("%s %s not found", "Org", name)
}
if repo.FindByNameErr {
apiResponse = net.NewApiResponseWithMessage("Error finding quota")
}
return
}
示例8: FindByName
func (repo *FakeDomainRepository) FindByName(name string) (domain models.DomainFields, apiResponse net.ApiResponse) {
repo.FindByNameName = name
domain = repo.FindByNameDomain
if repo.FindByNameNotFound {
apiResponse = net.NewNotFoundApiResponse("%s %s not found", "Domain", name)
}
if repo.FindByNameErr {
apiResponse = net.NewApiResponseWithMessage("Error finding domain")
}
return
}
示例9: TestDeleteServiceAuthTokenWhenTokenDoesNotExist
func TestDeleteServiceAuthTokenWhenTokenDoesNotExist(t *testing.T) {
authTokenRepo := &testapi.FakeAuthTokenRepo{
FindByLabelAndProviderApiResponse: net.NewNotFoundApiResponse("not found"),
}
reqFactory := &testreq.FakeReqFactory{LoginSuccess: true}
args := []string{"a label", "a provider"}
ui := callDeleteServiceAuthToken(t, args, []string{"Y"}, reqFactory, authTokenRepo)
assert.Contains(t, ui.Outputs[0], "Deleting service auth token as")
assert.Contains(t, ui.Outputs[0], "my-user")
assert.Contains(t, ui.Outputs[1], "OK")
assert.Contains(t, ui.Outputs[2], "does not exist")
}
示例10: FindByName
func (repo *FakeSpaceRepository) FindByName(name string) (space cf.Space, apiResponse net.ApiResponse) {
repo.FindByNameName = name
space = repo.FindByNameSpace
if repo.FindByNameErr {
apiResponse = net.NewApiResponseWithMessage("Error finding space by name.")
}
if repo.FindByNameNotFound {
apiResponse = net.NewNotFoundApiResponse("%s %s not found", "Space", name)
}
return
}
示例11: GetEndpoint
func (repo RemoteEndpointRepository) GetEndpoint(name cf.EndpointType) (endpoint string, apiResponse net.ApiResponse) {
switch name {
case cf.CloudControllerEndpointKey:
return repo.cloudControllerEndpoint()
case cf.UaaEndpointKey:
return repo.uaaControllerEndpoint()
case cf.LoggregatorEndpointKey:
return repo.loggregatorEndpoint()
}
apiResponse = net.NewNotFoundApiResponse("Endpoint type %s is unkown", string(name))
return
}
示例12: FindByName
func (repo CloudControllerDomainRepository) FindByName(name string) (domain cf.Domain, apiResponse net.ApiResponse) {
path := fmt.Sprintf("/v2/domains?inline-relations-depth=1&q=%s", url.QueryEscape("name:"+name))
domains, _, apiResponse := repo.findNextWithPath(path)
if apiResponse.IsNotSuccessful() {
return
}
if len(domains) > 0 {
domain = domains[0]
} else {
apiResponse = net.NewNotFoundApiResponse("Domain %s not found", name)
}
return
}
示例13: FindByNameInOrg
func (repo CloudControllerDomainRepository) FindByNameInOrg(name string, orgGuid string) (domain models.DomainFields, apiResponse net.ApiResponse) {
domain, apiResponse = repo.findOneWithPath(
fmt.Sprintf("/v2/organizations/%s/domains?inline-relations-depth=1&q=%s", orgGuid, url.QueryEscape("name:"+name)),
name)
if apiResponse.IsNotFound() {
domain, apiResponse = repo.FindByName(name)
if !domain.Shared {
apiResponse = net.NewNotFoundApiResponse("Domain %s not found", name)
}
}
return
}
示例14: findOneWithPath
func (repo CloudControllerDomainRepository) findOneWithPath(path, name string) (domain models.DomainFields, apiResponse net.ApiResponse) {
foundDomain := false
apiResponse = repo.listDomains(path, func(result models.DomainFields) bool {
domain = result
foundDomain = true
return false
})
if apiResponse.IsSuccessful() && !foundDomain {
apiResponse = net.NewNotFoundApiResponse("Domain %s not found", name)
}
return
}
示例15: FindByName
func (repo *FakeOrgRepository) FindByName(name string) (org cf.Organization, apiResponse net.ApiResponse) {
repo.FindByNameName = name
org = repo.FindByNameOrganization
if repo.FindByNameErr {
apiResponse = net.NewApiResponseWithMessage("Error finding organization by name.")
}
if repo.FindByNameNotFound {
apiResponse = net.NewNotFoundApiResponse("%s %s not found", "Org", name)
}
return
}