當前位置: 首頁>>代碼示例>>Java>>正文


Java ServiceManagement類代碼示例

本文整理匯總了Java中com.google.api.services.servicemanagement.ServiceManagement的典型用法代碼示例。如果您正苦於以下問題:Java ServiceManagement類的具體用法?Java ServiceManagement怎麽用?Java ServiceManagement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ServiceManagement類屬於com.google.api.services.servicemanagement包,在下文中一共展示了ServiceManagement類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ServiceConfigSupplier

import com.google.api.services.servicemanagement.ServiceManagement; //導入依賴的package包/類
@VisibleForTesting
ServiceConfigSupplier(
    Environment environment,
    HttpTransport httpTransport,
    JsonFactory jsonFactory,
    final GoogleCredential credential) {
  this.environment = environment;
  HttpRequestInitializer requestInitializer = new HttpRequestInitializer() {
    @Override
    public void initialize(HttpRequest request) throws IOException {
      request.setThrowExceptionOnExecuteError(false);
      credential.initialize(request);
    }
  };
  this.serviceManagement =
      new ServiceManagement.Builder(httpTransport, jsonFactory, requestInitializer)
          .setApplicationName("Endpoints Frameworks Java")
          .build();
}
 
開發者ID:cloudendpoints,項目名稱:endpoints-management-java,代碼行數:20,代碼來源:ServiceConfigSupplier.java

示例2: mockServiceApi

import com.google.api.services.servicemanagement.ServiceManagement; //導入依賴的package包/類
private void mockServiceApi(Credential credential, String projectId, String... serviceIds)
    throws IOException {
  ServiceManagement servicesManagementApi = mock(ServiceManagement.class);
  Services servicesApi = mock(Services.class);
  Services.List request = mock(Services.List.class);
  ListServicesResponse response = new ListServicesResponse();

  doReturn(servicesManagementApi).when(apiFactory).newServiceManagementApi(credential);
  doReturn(servicesApi).when(servicesManagementApi).services();

  doReturn(request).when(servicesApi).list();
  // List provides a fluent API
  when(request.setFields(anyString())).thenReturn(request);
  when(request.setConsumerId(anyString())).thenReturn(request);
  when(request.setPageSize(anyInt())).thenReturn(request);
  when(request.setPageToken(anyString())).thenReturn(request);
  when(request.execute()).thenReturn(response);

  List<ManagedService> managedServices = new ArrayList<>();
  for (String serviceId : serviceIds) {
    ManagedService managedService = new ManagedService();
    managedService.setServiceName(serviceId);
    managedService.setProducerProjectId(projectId);
    managedServices.add(managedService);
  }
  response.setServices(managedServices);
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:28,代碼來源:RunOptionsDefaultsComponentTest.java

示例3: compute

import com.google.api.services.servicemanagement.ServiceManagement; //導入依賴的package包/類
@Override
protected List<String> compute(IProgressMonitor monitor)
    throws GoogleJsonResponseException, IOException {
  String projectId = this.projectId;
  ServiceManagement serviceManagement = apiFactory.newServiceManagementApi(credential);
  ListServicesResponse response = null;
  Collection<String> serviceIds = new ArrayList<>();
  do {
    checkCancelled(monitor);
    // We request only the serviceNames as the rest does not appear to be helpful.
    //@formatter:off
    Services.List request = serviceManagement.services().list()
        .setFields("services/serviceName")
        .setConsumerId("project:" + projectId);
    //@formatter:on
    if (response != null && response.getNextPageToken() != null) {
      request.setPageToken(response.getNextPageToken());
    }
    response = request.execute();

    if (response.getServices() != null) {
      for (ManagedService service : response.getServices()) {
        serviceIds.add(service.getServiceName());
      }
    }
  } while (response.getNextPageToken() != null);

  return ImmutableList.copyOf(serviceIds);
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:30,代碼來源:GcpProjectServicesJob.java

示例4: newServiceManagementApi

import com.google.api.services.servicemanagement.ServiceManagement; //導入依賴的package包/類
@Override
public ServiceManagement newServiceManagementApi(Credential credential) {
  Preconditions.checkNotNull(transportCache, "transportCache is null");
  HttpTransport transport = transportCache.getUnchecked(GoogleApi.SERVICE_MANAGEMENT_API);
  Preconditions.checkNotNull(transport, "transport is null");
  Preconditions.checkNotNull(jsonFactory, "jsonFactory is null");

  ServiceManagement serviceManagement =
      new ServiceManagement.Builder(transport, jsonFactory, credential)
          .setApplicationName(CloudToolsInfo.USER_AGENT).build();
  return serviceManagement;
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:13,代碼來源:GoogleApiFactory.java

示例5: getServiceManagementClient

import com.google.api.services.servicemanagement.ServiceManagement; //導入依賴的package包/類
@Override
public ServiceManagement getServiceManagementClient(
    @Nullable HttpRequestInitializer httpRequestInitializer) {
  return new ServiceManagement.Builder(httpTransport, jsonFactory, httpRequestInitializer)
      .setApplicationName(getApplicationName())
      .build();
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-intellij,代碼行數:8,代碼來源:DefaultGoogleApiClientFactory.java

示例6: enableApi

import com.google.api.services.servicemanagement.ServiceManagement; //導入依賴的package包/類
private static void enableApi(
    CloudLibrary library, CloudProject cloudProject, CredentialedUser user) throws IOException {
  ServiceManagement serviceManagement =
      GoogleApiClientFactory.getInstance().getServiceManagementClient(user.getCredential());

  serviceManagement
      .services()
      .enable(
          library.getServiceName(),
          new EnableServiceRequest()
              .setConsumerId(
                  String.format(SERVICE_REQUEST_PROJECT_PATTERN, cloudProject.projectId())))
      .execute();
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-intellij,代碼行數:15,代碼來源:CloudApiManager.java

示例7: testNewServceManagementApi

import com.google.api.services.servicemanagement.ServiceManagement; //導入依賴的package包/類
@Test
public void testNewServceManagementApi() {
  ServiceManagement serviceManagement =
      googleApiFactory.newServiceManagementApi(mock(Credential.class));
  assertEquals("https://servicemanagement.googleapis.com/", serviceManagement.getBaseUrl());
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:7,代碼來源:GoogleApiFactoryTest.java

示例8: newServiceManagementApi

import com.google.api.services.servicemanagement.ServiceManagement; //導入依賴的package包/類
/**
 * @return a ServiceManagement API client
 */
ServiceManagement newServiceManagementApi(Credential credential);
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:5,代碼來源:IGoogleApiFactory.java

示例9: getServiceManagementClient

import com.google.api.services.servicemanagement.ServiceManagement; //導入依賴的package包/類
/**
 * Creates a new instance of a {@link ServiceManagement} client.
 *
 * @param httpRequestInitializer optional HttpRequestInitializer
 */
public abstract ServiceManagement getServiceManagementClient(
    @Nullable HttpRequestInitializer httpRequestInitializer);
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-intellij,代碼行數:8,代碼來源:GoogleApiClientFactory.java


注:本文中的com.google.api.services.servicemanagement.ServiceManagement類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。