Search in sources :

Example 1 with EnableServiceRequest

use of com.google.api.services.servicemanagement.model.EnableServiceRequest in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudApiManager method enableApi.

private static void enableApi(CloudLibrary library, CloudProject cloudProject, CredentialedUser user) throws IOException {
    UsageTrackerProvider.getInstance().trackEvent(GctTracking.CLIENT_LIBRARY_ENABLE_API).addMetadata(GctTracking.METADATA_LABEL_KEY, library.getName()).ping();
    ServiceManagement serviceManagement = GoogleApiClientFactory.getInstance().getServiceManagementClient(user.getCredential());
    serviceManagement.services().enable(library.getServiceName(), new EnableServiceRequest().setConsumerId(String.format(SERVICE_REQUEST_PROJECT_FORMAT, cloudProject.projectId()))).execute();
}
Also used : ServiceManagement(com.google.api.services.servicemanagement.ServiceManagement) EnableServiceRequest(com.google.api.services.servicemanagement.model.EnableServiceRequest)

Aggregations

ServiceManagement (com.google.api.services.servicemanagement.ServiceManagement)1 EnableServiceRequest (com.google.api.services.servicemanagement.model.EnableServiceRequest)1