com.google.api.gax.core.NoCredentialsProvider Java Examples

The following examples show how to use com.google.api.gax.core.NoCredentialsProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GcpPubSubAutoConfiguration.java    From spring-cloud-gcp with Apache License 2.0 6 votes vote down vote up
public GcpPubSubAutoConfiguration(GcpPubSubProperties gcpPubSubProperties,
		GcpProjectIdProvider gcpProjectIdProvider,
		CredentialsProvider credentialsProvider) throws IOException {
	this.gcpPubSubProperties = gcpPubSubProperties;
	this.finalProjectIdProvider = (gcpPubSubProperties.getProjectId() != null)
			? gcpPubSubProperties::getProjectId
			: gcpProjectIdProvider;

	if (gcpPubSubProperties.getEmulatorHost() == null
			|| "false".equals(gcpPubSubProperties.getEmulatorHost())) {
		this.finalCredentialsProvider = gcpPubSubProperties.getCredentials().hasKey()
				? new DefaultCredentialsProvider(gcpPubSubProperties)
				: credentialsProvider;
	}
	else {
		// Since we cannot create a general NoCredentialsProvider if the emulator host is enabled
		// (because it would also be used for the other components), we have to create one here
		// for this particular case.
		this.finalCredentialsProvider = NoCredentialsProvider.create();
	}
}
 
Example #2
Source File: GoogleCloudPubSubSinkConfiguration.java    From divolte-collector with Apache License 2.0 6 votes vote down vote up
private static void createTopic(final String hostPort,
                                final TransportChannelProvider channelProvider,
                                final ProjectTopicName topic) {
    final TopicAdminClient topicClient;
    try {
        final TopicAdminSettings topicAdminSettings = TopicAdminSettings.newBuilder()
            .setTransportChannelProvider(channelProvider)
            .setCredentialsProvider(NoCredentialsProvider.create())
            .build();
        topicClient = TopicAdminClient.create(topicAdminSettings);
    } catch (final IOException e) {
        throw new UncheckedIOException(String.format("Error creating topic %s for pub/sub emulator %s",
                                                     topic, hostPort), e);
    }
    final ProjectName project = ProjectName.of(topic.getProject());
    if (Streams.stream(topicClient.listTopics(project).iterateAll())
               .map(Topic::getName)
               .map(ProjectTopicName::parse)
               .noneMatch(topic::equals)) {
        logger.info("Initializing Pub/Sub emulator topic: {}", topic);
        topicClient.createTopic(topic);
    }
}
 
Example #3
Source File: PubSubSink.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public void open(Configuration configuration) throws Exception {
	serializationSchema.open(() -> getRuntimeContext().getMetricGroup().addGroup("user"));

	Publisher.Builder builder = Publisher
		.newBuilder(ProjectTopicName.of(projectName, topicName))
		.setCredentialsProvider(FixedCredentialsProvider.create(credentials));

	if (hostAndPortForEmulator != null) {
		managedChannel = ManagedChannelBuilder
			.forTarget(hostAndPortForEmulator)
			.usePlaintext(true) // This is 'Ok' because this is ONLY used for testing.
			.build();
		channel = GrpcTransportChannel.newBuilder().setManagedChannel(managedChannel).build();
		builder.setChannelProvider(FixedTransportChannelProvider.create(channel))
				.setCredentialsProvider(NoCredentialsProvider.create());
	}

	publisher = builder.build();
	isRunning = true;
}
 
Example #4
Source File: KeywordPlanIdeaServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  KeywordPlanIdeaServiceSettings settings =
      KeywordPlanIdeaServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = KeywordPlanIdeaServiceClient.create(settings);
}
 
Example #5
Source File: AdGroupAdLabelServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  AdGroupAdLabelServiceSettings settings =
      AdGroupAdLabelServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = AdGroupAdLabelServiceClient.create(settings);
}
 
Example #6
Source File: CustomerManagerLinkServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  CustomerManagerLinkServiceSettings settings =
      CustomerManagerLinkServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = CustomerManagerLinkServiceClient.create(settings);
}
 
Example #7
Source File: CampaignAudienceViewServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  CampaignAudienceViewServiceSettings settings =
      CampaignAudienceViewServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = CampaignAudienceViewServiceClient.create(settings);
}
 
Example #8
Source File: CampaignExperimentServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  CampaignExperimentServiceSettings settings =
      CampaignExperimentServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = CampaignExperimentServiceClient.create(settings);
}
 
Example #9
Source File: SearchTermViewServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  SearchTermViewServiceSettings settings =
      SearchTermViewServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = SearchTermViewServiceClient.create(settings);
}
 
Example #10
Source File: ExtensionFeedItemServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  ExtensionFeedItemServiceSettings settings =
      ExtensionFeedItemServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = ExtensionFeedItemServiceClient.create(settings);
}
 
Example #11
Source File: CustomerExtensionSettingServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  CustomerExtensionSettingServiceSettings settings =
      CustomerExtensionSettingServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = CustomerExtensionSettingServiceClient.create(settings);
}
 
Example #12
Source File: CustomerManagerLinkServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  CustomerManagerLinkServiceSettings settings =
      CustomerManagerLinkServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = CustomerManagerLinkServiceClient.create(settings);
}
 
Example #13
Source File: HotelGroupViewServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  HotelGroupViewServiceSettings settings =
      HotelGroupViewServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = HotelGroupViewServiceClient.create(settings);
}
 
Example #14
Source File: FeedItemServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  FeedItemServiceSettings settings =
      FeedItemServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = FeedItemServiceClient.create(settings);
}
 
Example #15
Source File: KeywordViewServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  KeywordViewServiceSettings settings =
      KeywordViewServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = KeywordViewServiceClient.create(settings);
}
 
Example #16
Source File: AgeRangeViewServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  AgeRangeViewServiceSettings settings =
      AgeRangeViewServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = AgeRangeViewServiceClient.create(settings);
}
 
Example #17
Source File: DisplayKeywordViewServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  DisplayKeywordViewServiceSettings settings =
      DisplayKeywordViewServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = DisplayKeywordViewServiceClient.create(settings);
}
 
Example #18
Source File: ClickViewServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  ClickViewServiceSettings settings =
      ClickViewServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = ClickViewServiceClient.create(settings);
}
 
Example #19
Source File: LocationViewServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  LocationViewServiceSettings settings =
      LocationViewServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = LocationViewServiceClient.create(settings);
}
 
Example #20
Source File: ShoppingPerformanceViewServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  ShoppingPerformanceViewServiceSettings settings =
      ShoppingPerformanceViewServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = ShoppingPerformanceViewServiceClient.create(settings);
}
 
Example #21
Source File: AdGroupSimulationServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  AdGroupSimulationServiceSettings settings =
      AdGroupSimulationServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = AdGroupSimulationServiceClient.create(settings);
}
 
Example #22
Source File: RemarketingActionServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  RemarketingActionServiceSettings settings =
      RemarketingActionServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = RemarketingActionServiceClient.create(settings);
}
 
Example #23
Source File: PubsubHelper.java    From flink with Apache License 2.0 5 votes vote down vote up
public SubscriptionAdminClient getSubscriptionAdminClient() throws IOException {
	if (subscriptionAdminClient == null) {
		SubscriptionAdminSettings subscriptionAdminSettings =
			SubscriptionAdminSettings
				.newBuilder()
				.setTransportChannelProvider(channelProvider)
				.setCredentialsProvider(NoCredentialsProvider.create())
				.build();
		subscriptionAdminClient = SubscriptionAdminClient.create(subscriptionAdminSettings);
	}
	return subscriptionAdminClient;
}
 
Example #24
Source File: TopicConstantServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  TopicConstantServiceSettings settings =
      TopicConstantServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = TopicConstantServiceClient.create(settings);
}
 
Example #25
Source File: RecommendationServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  RecommendationServiceSettings settings =
      RecommendationServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = RecommendationServiceClient.create(settings);
}
 
Example #26
Source File: CampaignBidModifierServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  CampaignBidModifierServiceSettings settings =
      CampaignBidModifierServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = CampaignBidModifierServiceClient.create(settings);
}
 
Example #27
Source File: TopicViewServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  TopicViewServiceSettings settings =
      TopicViewServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = TopicViewServiceClient.create(settings);
}
 
Example #28
Source File: AdGroupExtensionSettingServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  AdGroupExtensionSettingServiceSettings settings =
      AdGroupExtensionSettingServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = AdGroupExtensionSettingServiceClient.create(settings);
}
 
Example #29
Source File: AdGroupBidModifierServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  AdGroupBidModifierServiceSettings settings =
      AdGroupBidModifierServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = AdGroupBidModifierServiceClient.create(settings);
}
 
Example #30
Source File: SharedCriterionServiceClientTest.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  serviceHelper.reset();
  channelProvider = serviceHelper.createChannelProvider();
  SharedCriterionServiceSettings settings =
      SharedCriterionServiceSettings.newBuilder()
          .setTransportChannelProvider(channelProvider)
          .setCredentialsProvider(NoCredentialsProvider.create())
          .build();
  client = SharedCriterionServiceClient.create(settings);
}