本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/configuration.ReadWriter.ApiVersion方法的典型用法代码示例。如果您正苦于以下问题:Golang ReadWriter.ApiVersion方法的具体用法?Golang ReadWriter.ApiVersion怎么用?Golang ReadWriter.ApiVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/cli/cf/configuration.ReadWriter
的用法示例。
在下文中一共展示了ReadWriter.ApiVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewRepositoryLocator
func NewRepositoryLocator(config configuration.ReadWriter, gatewaysByName map[string]net.Gateway) (loc RepositoryLocator) {
strategy := strategy.NewEndpointStrategy(config.ApiVersion())
authGateway := gatewaysByName["auth"]
cloudControllerGateway := gatewaysByName["cloud-controller"]
uaaGateway := gatewaysByName["uaa"]
loc.authRepo = authentication.NewUAAAuthenticationRepository(authGateway, config)
// ensure gateway refreshers are set before passing them by value to repositories
cloudControllerGateway.SetTokenRefresher(loc.authRepo)
uaaGateway.SetTokenRefresher(loc.authRepo)
tlsConfig := net.NewTLSConfig([]tls.Certificate{}, config.IsSSLDisabled())
loggregatorConsumer := consumer.New(config.LoggregatorEndpoint(), tlsConfig, http.ProxyFromEnvironment)
loggregatorConsumer.SetDebugPrinter(terminal.DebugPrinter{})
loc.appBitsRepo = application_bits.NewCloudControllerApplicationBitsRepository(config, cloudControllerGateway)
loc.appEventsRepo = app_events.NewCloudControllerAppEventsRepository(config, cloudControllerGateway, strategy)
loc.appFilesRepo = NewCloudControllerAppFilesRepository(config, cloudControllerGateway)
loc.appRepo = NewCloudControllerApplicationRepository(config, cloudControllerGateway)
loc.appSummaryRepo = NewCloudControllerAppSummaryRepository(config, cloudControllerGateway)
loc.appInstancesRepo = NewCloudControllerAppInstancesRepository(config, cloudControllerGateway)
loc.authTokenRepo = NewCloudControllerServiceAuthTokenRepository(config, cloudControllerGateway)
loc.curlRepo = NewCloudControllerCurlRepository(config, cloudControllerGateway)
loc.domainRepo = NewCloudControllerDomainRepository(config, cloudControllerGateway, strategy)
loc.endpointRepo = NewEndpointRepository(config, cloudControllerGateway)
loc.logsRepo = NewLoggregatorLogsRepository(config, loggregatorConsumer, loc.authRepo)
loc.organizationRepo = organizations.NewCloudControllerOrganizationRepository(config, cloudControllerGateway)
loc.passwordRepo = NewCloudControllerPasswordRepository(config, uaaGateway)
loc.quotaRepo = quotas.NewCloudControllerQuotaRepository(config, cloudControllerGateway)
loc.routeRepo = NewCloudControllerRouteRepository(config, cloudControllerGateway)
loc.stackRepo = NewCloudControllerStackRepository(config, cloudControllerGateway)
loc.serviceRepo = NewCloudControllerServiceRepository(config, cloudControllerGateway)
loc.serviceBindingRepo = NewCloudControllerServiceBindingRepository(config, cloudControllerGateway)
loc.serviceBrokerRepo = NewCloudControllerServiceBrokerRepository(config, cloudControllerGateway)
loc.servicePlanRepo = NewCloudControllerServicePlanRepository(config, cloudControllerGateway)
loc.servicePlanVisibilityRepo = NewCloudControllerServicePlanVisibilityRepository(config, cloudControllerGateway)
loc.serviceSummaryRepo = NewCloudControllerServiceSummaryRepository(config, cloudControllerGateway)
loc.spaceRepo = spaces.NewCloudControllerSpaceRepository(config, cloudControllerGateway)
loc.userProvidedServiceInstanceRepo = NewCCUserProvidedServiceInstanceRepository(config, cloudControllerGateway)
loc.userRepo = NewCloudControllerUserRepository(config, uaaGateway, cloudControllerGateway)
loc.buildpackRepo = NewCloudControllerBuildpackRepository(config, cloudControllerGateway)
loc.buildpackBitsRepo = NewCloudControllerBuildpackBitsRepository(config, cloudControllerGateway, app_files.ApplicationZipper{})
loc.securityGroupRepo = security_groups.NewSecurityGroupRepo(config, cloudControllerGateway)
loc.stagingSecurityGroupRepo = staging.NewStagingSecurityGroupsRepo(config, cloudControllerGateway)
loc.runningSecurityGroupRepo = running.NewRunningSecurityGroupsRepo(config, cloudControllerGateway)
loc.securityGroupSpaceBinder = securitygroupspaces.NewSecurityGroupSpaceBinder(config, cloudControllerGateway)
loc.spaceQuotaRepo = space_quotas.NewCloudControllerSpaceQuotaRepository(config, cloudControllerGateway)
loc.featureFlagRepo = feature_flags.NewCloudControllerFeatureFlagRepository(config, cloudControllerGateway)
loc.environmentVariableGroupRepo = environment_variable_groups.NewCloudControllerEnvironmentVariableGroupsRepository(config, cloudControllerGateway)
return
}
示例2: NewRepositoryLocator
func NewRepositoryLocator(config configuration.ReadWriter, gatewaysByName map[string]net.Gateway) (loc RepositoryLocator) {
strategy := strategy.NewEndpointStrategy(config.ApiVersion())
authGateway := gatewaysByName["auth"]
cloudControllerGateway := gatewaysByName["cloud-controller"]
uaaGateway := gatewaysByName["uaa"]
loc.authRepo = NewUAAAuthenticationRepository(authGateway, config)
// ensure gateway refreshers are set before passing them by value to repositories
cloudControllerGateway.SetTokenRefresher(loc.authRepo)
uaaGateway.SetTokenRefresher(loc.authRepo)
tlsConfig := net.NewTLSConfig([]tls.Certificate{}, config.IsSSLDisabled())
loggregatorConsumer := consumer.New(config.LoggregatorEndpoint(), tlsConfig, nil)
loc.appBitsRepo = NewCloudControllerApplicationBitsRepository(config, cloudControllerGateway, app_files.ApplicationZipper{})
loc.appEventsRepo = NewCloudControllerAppEventsRepository(config, cloudControllerGateway, strategy)
loc.appFilesRepo = NewCloudControllerAppFilesRepository(config, cloudControllerGateway)
loc.appRepo = NewCloudControllerApplicationRepository(config, cloudControllerGateway)
loc.appSummaryRepo = NewCloudControllerAppSummaryRepository(config, cloudControllerGateway)
loc.appInstancesRepo = NewCloudControllerAppInstancesRepository(config, cloudControllerGateway)
loc.authTokenRepo = NewCloudControllerServiceAuthTokenRepository(config, cloudControllerGateway)
loc.curlRepo = NewCloudControllerCurlRepository(config, cloudControllerGateway)
loc.domainRepo = NewCloudControllerDomainRepository(config, cloudControllerGateway, strategy)
loc.endpointRepo = NewEndpointRepository(config, cloudControllerGateway)
loc.logsRepo = NewLoggregatorLogsRepository(config, loggregatorConsumer, loc.authRepo)
loc.organizationRepo = NewCloudControllerOrganizationRepository(config, cloudControllerGateway)
loc.passwordRepo = NewCloudControllerPasswordRepository(config, uaaGateway)
loc.quotaRepo = NewCloudControllerQuotaRepository(config, cloudControllerGateway)
loc.routeRepo = NewCloudControllerRouteRepository(config, cloudControllerGateway)
loc.stackRepo = NewCloudControllerStackRepository(config, cloudControllerGateway)
loc.serviceRepo = NewCloudControllerServiceRepository(config, cloudControllerGateway)
loc.serviceBindingRepo = NewCloudControllerServiceBindingRepository(config, cloudControllerGateway)
loc.serviceBrokerRepo = NewCloudControllerServiceBrokerRepository(config, cloudControllerGateway)
loc.serviceSummaryRepo = NewCloudControllerServiceSummaryRepository(config, cloudControllerGateway)
loc.spaceRepo = NewCloudControllerSpaceRepository(config, cloudControllerGateway)
loc.userProvidedServiceInstanceRepo = NewCCUserProvidedServiceInstanceRepository(config, cloudControllerGateway)
loc.userRepo = NewCloudControllerUserRepository(config, uaaGateway, cloudControllerGateway)
loc.buildpackRepo = NewCloudControllerBuildpackRepository(config, cloudControllerGateway)
loc.buildpackBitsRepo = NewCloudControllerBuildpackBitsRepository(config, cloudControllerGateway, app_files.ApplicationZipper{})
loc.appSecurityGroupRepo = NewSecurityGroupRepo(config, cloudControllerGateway)
loc.stagingSecurityGroupRepo = NewStagingSecurityGroupsRepo(config, cloudControllerGateway)
return
}
示例3:
var _ = Describe("DomainRepository", func() {
var (
ts *httptest.Server
handler *testnet.TestHandler
repo DomainRepository
config configuration.ReadWriter
)
BeforeEach(func() {
config = testconfig.NewRepositoryWithDefaults()
})
JustBeforeEach(func() {
gateway := net.NewCloudControllerGateway((config), time.Now)
strategy := strategy.NewEndpointStrategy(config.ApiVersion())
repo = NewCloudControllerDomainRepository(config, gateway, strategy)
})
AfterEach(func() {
ts.Close()
})
var setupTestServer = func(reqs ...testnet.TestRequest) {
ts, handler = testnet.NewServer(reqs)
config.SetApiEndpoint(ts.URL)
}
Describe("listing domains", func() {
BeforeEach(func() {
config.SetApiVersion("2.2.0")
示例4:
space.Name = "my-space"
space.Guid = "my-space-guid"
config.SetOrganizationFields(org)
config.SetSpaceFields(space)
testServerFn = validApiInfoEndpoint
})
It("stores the data from the /info api in the config", func() {
repo.UpdateEndpoint(testServer.URL)
Expect(config.AccessToken()).To(Equal(""))
Expect(config.AuthenticationEndpoint()).To(Equal("https://login.example.com"))
Expect(config.LoggregatorEndpoint()).To(Equal("wss://loggregator.foo.example.org:4443"))
Expect(config.ApiEndpoint()).To(Equal(testServer.URL))
Expect(config.ApiVersion()).To(Equal("42.0.0"))
Expect(config.HasOrganization()).To(BeFalse())
Expect(config.HasSpace()).To(BeFalse())
})
Context("when the api endpoint does not change", func() {
BeforeEach(func() {
config.SetApiEndpoint(testServer.URL)
config.SetAccessToken("some access token")
config.SetRefreshToken("some refresh token")
})
It("does not clear the session if the api endpoint does not change", func() {
repo.UpdateEndpoint(testServer.URL)
Expect(config.OrganizationFields()).To(Equal(org))