• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BigqueryScopes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.api.services.bigquery.BigqueryScopes的典型用法代码示例。如果您正苦于以下问题:Java BigqueryScopes类的具体用法?Java BigqueryScopes怎么用?Java BigqueryScopes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BigqueryScopes类属于com.google.api.services.bigquery包,在下文中一共展示了BigqueryScopes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: BigQueryExporter

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
public BigQueryExporter(BigQueryExporterConfiguration config) {
	this.config = config;
	this.checkedSchemas = new HashSet<String>();
	this.existingSchemaMap = new HashMap<String, com.google.api.services.bigquery.model.TableSchema>();

	HttpTransport transport = new NetHttpTransport();
	JsonFactory jsonFactory = new JacksonFactory();
	GoogleCredential credential;
	try {
		credential = GoogleCredential.getApplicationDefault(transport,
				jsonFactory);
	} catch (IOException e) {
		throw new RuntimeException(e);
	}
	if (credential.createScopedRequired()) {
		credential = credential.createScoped(BigqueryScopes.all());
	}
	this.bq = new Bigquery.Builder(transport, jsonFactory, credential)
			.setApplicationName(this.config.applicationName).build();
}
 
开发者ID:frew,项目名称:chute,代码行数:21,代码来源:BigQueryExporter.java


示例2: create

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
/**
 * Returns a new connection to Bigquery, first ensuring that the given dataset exists in the
 * project with the given id, creating it if required.
 */
public Bigquery create(String projectId, String datasetId) throws IOException {
  Bigquery bigquery = create(
      getClass().getSimpleName(),
      new UrlFetchTransport(),
      new JacksonFactory(),
      new AppIdentityCredential(BigqueryScopes.all()));

  // Note: it's safe for multiple threads to call this as the dataset will only be created once.
  if (!knownExistingDatasets.contains(datasetId)) {
    ensureDataset(bigquery, projectId, datasetId);
    knownExistingDatasets.add(datasetId);
  }

  return bigquery;
}
 
开发者ID:google,项目名称:nomulus,代码行数:20,代码来源:BigqueryFactory.java


示例3: Parser

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
/**
 * Initialize the parser by setting up the BigQuery client ready to take take commands.
 * 
 * @throws GeneralSecurityException
 * @throws IOException
 */
private Parser() throws GeneralSecurityException, IOException {
	final HttpTransport http = GoogleNetHttpTransport.newTrustedTransport();
	final JsonFactory jsonFactory = new JacksonFactory();
	final KeyStore keyStore = SecurityUtils.getPkcs12KeyStore();
	final InputStream key = getClass().getClassLoader().getResourceAsStream(keyFile);
	final PrivateKey p12 = SecurityUtils.loadPrivateKeyFromKeyStore(keyStore, key, "notasecret", "privatekey", "notasecret");

	final GoogleCredential.Builder credential = new GoogleCredential.Builder();
	credential.setTransport(http);
	credential.setJsonFactory(jsonFactory);
	credential.setServiceAccountId(account);
	credential.setServiceAccountScopes(Arrays.asList(BigqueryScopes.BIGQUERY));
	credential.setServiceAccountPrivateKey(p12);

	final Bigquery.Builder bq = new Bigquery.Builder(http, jsonFactory, credential.build());
	bq.setApplicationName(project);
	client = bq.build();
}
 
开发者ID:mallocator,项目名称:Elasticsearch-BigQuery-River,代码行数:25,代码来源:BigQueryRiver.java


示例4: client

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
@Override
protected Bigquery client(GoogleCredential credential, HttpTransport transport, JsonFactory jsonFactory)
{
    if (credential.createScopedRequired()) {
        credential = credential.createScoped(BigqueryScopes.all());
    }

    return new Bigquery.Builder(transport, jsonFactory, credential)
            .setApplicationName("Digdag")
            .build();
}
 
开发者ID:gymxxx,项目名称:digdag-bq-wait,代码行数:12,代码来源:BqWaitClient.java


示例5: getDefaultCredential

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
private Credentials getDefaultCredential() {
  GoogleCredentials credential;
  try {
    credential = GoogleCredentials.getApplicationDefault();
  } catch (IOException e) {
    throw new RuntimeException("Failed to get application default credential.", e);
  }

  if (credential.createScopedRequired()) {
    Collection<String> bigqueryScope =
        Lists.newArrayList(BigqueryScopes.CLOUD_PLATFORM_READ_ONLY);
    credential = credential.createScoped(bigqueryScope);
  }
  return credential;
}
 
开发者ID:apache,项目名称:beam,代码行数:16,代码来源:BigqueryMatcher.java


示例6: provideBigquery

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
@Provides
static Bigquery provideBigquery(
    HttpTransport transport,
    JsonFactory jsonFactory,
    Function<Set<String>, ? extends HttpRequestInitializer> credential,
    @Config("projectId") String projectId) {
  return new Bigquery.Builder(transport, jsonFactory, credential.apply(BigqueryScopes.all()))
      .setApplicationName(projectId)
      .build();
}
 
开发者ID:google,项目名称:nomulus,代码行数:11,代码来源:BigqueryModule.java


示例7: createAuthorizedClient

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
private static Bigquery createAuthorizedClient() throws IOException {
  HttpTransport transport = new NetHttpTransport();
  JsonFactory jsonFactory = new JacksonFactory();
  GoogleCredential credential =  GoogleCredential.getApplicationDefault(transport, jsonFactory);

  if (credential.createScopedRequired()) {
    Collection<String> bigqueryScopes = BigqueryScopes.all();
    credential = credential.createScoped(bigqueryScopes);
  }

  return new Bigquery.Builder(transport, jsonFactory, credential)
      .setApplicationName("Zeppelin/1.0 (GPN:Apache Zeppelin;)").build();
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:14,代码来源:BigQueryInterpreter.java


示例8: createAuthorizedClient

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
private static Bigquery createAuthorizedClient() throws IOException {
  Collection<String> BIGQUERY_SCOPES = BigqueryScopes.all();
  HttpTransport TRANSPORT = new NetHttpTransport();
  JsonFactory JSON_FACTORY = new JacksonFactory();
  GoogleCredential credential = GoogleCredential.getApplicationDefault(TRANSPORT, JSON_FACTORY);
  if(credential.createScopedRequired()){
    credential = credential.createScoped(BIGQUERY_SCOPES);
  }
  return new Bigquery.Builder(TRANSPORT, JSON_FACTORY, credential).setApplicationName("BigQuery Samples").build();
}
 
开发者ID:googlearchive,项目名称:bigquery-samples-python,代码行数:11,代码来源:BigqueryServiceFactory.java


示例9: client

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
@Override
protected Storage client(GoogleCredential credential, HttpTransport transport, JsonFactory jsonFactory)
{
    if (credential.createScopedRequired()) {
        credential = credential.createScoped(BigqueryScopes.all());
    }

    return new Storage.Builder(transport, jsonFactory, credential)
            .setApplicationName("Digdag")
            .build();
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:12,代码来源:GcsClient.java


示例10: bqClient

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
private Bigquery bqClient(GoogleCredential credential)
{
    if (credential.createScopedRequired()) {
        credential = credential.createScoped(BigqueryScopes.all());
    }
    return new Bigquery.Builder(transport, jsonFactory, credential)
            .setApplicationName("digdag-test")
            .build();
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:10,代码来源:BigQueryIT.java


示例11: createCredentials

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
public static Credentials createCredentials(BigQueryDatastoreProperties datastore) {
    try {
        GoogleCredentials credential = GoogleCredentials
                .fromStream(new FileInputStream(datastore.serviceAccountFile.getValue())).createScoped(BigqueryScopes.all());
        return credential;
    } catch (IOException e) {
        throw new RuntimeException("Exception when read service account file: " + datastore.serviceAccountFile.getValue()
                + "\nMessage is:" + e.getMessage());
    }
}
 
开发者ID:Talend,项目名称:components,代码行数:11,代码来源:BigQueryConnection.java


示例12: provideBigquery

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
/** Provides the authenticated Bigquery API object. */
@Provides
@Singleton
Bigquery provideBigquery() {
  return new Bigquery.Builder(
      new UrlFetchTransport(),
      new JacksonFactory(),
      new AppIdentityCredential(BigqueryScopes.all()))
          .setApplicationName(BigQueryModule.class.getName())
          .build();
}
 
开发者ID:google,项目名称:domaintest,代码行数:12,代码来源:BigQueryModule.java


示例13: authorizeviainstalled

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
/**
 * Authorizes a bigquery Connection with the given "Installed Application"
 * Clientid and Clientsecret
 *
 * @param clientid
 * @param clientsecret
 * @return Authorized bigquery Connection
 * @throws SQLException
 */
public static Bigquery authorizeviainstalled(String clientid,
                                             String clientsecret,
                                             String userAgent) throws SQLException {
    LocalServerReceiver rcvr = new LocalServerReceiver();
    List<String> Scopes = new ArrayList<String>();
    Scopes.add(BigqueryScopes.BIGQUERY);
    Credential credential = null;
    try {
        logger.debug("Authorizing as installed app.");
        credential = Oauth2Bigquery.authorize(
                CmdlineUtils.getHttpTransport(),
                CmdlineUtils.getJsonFactory(), rcvr, Scopes, clientid,
                clientsecret);
    } catch (Exception e) {
        throw new SQLException(e);
    }

    logger.debug("Creating a new bigquery client.");
    Builder bqBuilder = new Builder(
            CmdlineUtils.getHttpTransport(),
            CmdlineUtils.getJsonFactory(), credential
    );

    if (userAgent != null) {
        BigQueryRequestUserAgentInitializer requestInitializer = new BigQueryRequestUserAgentInitializer();
        requestInitializer.setUserAgent(userAgent);
        bqBuilder.setBigqueryRequestInitializer(requestInitializer);
    }

    Bigquery bigquery = bqBuilder.build();

    Oauth2Bigquery.servicepath = bigquery.getServicePath();
    return bigquery;
}
 
开发者ID:jonathanswenson,项目名称:starschema-bigquery-jdbc,代码行数:44,代码来源:Oauth2Bigquery.java


示例14: GenerateScopes

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
private static List<String> GenerateScopes(){
    List<String> scopes = new ArrayList<String>();
    scopes.add(BigqueryScopes.BIGQUERY);
    // don't have access to DriveScopes without requiring the entire google drive sdk.
    scopes.add(DRIVE_SCOPE);
    return scopes;
}
 
开发者ID:jonathanswenson,项目名称:starschema-bigquery-jdbc,代码行数:8,代码来源:Oauth2Bigquery.java


示例15: getBigqueryServiceDomainWide

import com.google.api.services.bigquery.BigqueryScopes; //导入依赖的package包/类
public static Bigquery getBigqueryServiceDomainWide() throws GeneralSecurityException, IOException {
	return new Bigquery.Builder(GoogleServices.getInstance().httpTransport, GoogleServices.getInstance().jsonFactory, null)
		.setHttpRequestInitializer(GoogleServices.getCredentialDomainWide(Arrays.asList(BigqueryScopes.BIGQUERY)))
		.setApplicationName(Config.get(Config.APPLICATION_NAME))
		.build();
}
 
开发者ID:andryfailli,项目名称:teampot,代码行数:7,代码来源:GoogleServices.java



注:本文中的com.google.api.services.bigquery.BigqueryScopes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AjaxStatus类代码示例发布时间:2022-05-21
下一篇:
Java BackgroundGenerator类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap