forked from apache/flink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-18448][pubsub] Update Google Cloud PubSub dependencies
This closes apache#12846
- Loading branch information
1 parent
da210e0
commit fdcaa46
Showing
21 changed files
with
484 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...n/java/org/apache/flink/streaming/connectors/gcp/pubsub/emulator/EmulatorCredentials.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.streaming.connectors.gcp.pubsub.emulator; | ||
|
||
import com.google.auth.oauth2.AccessToken; | ||
import com.google.auth.oauth2.OAuth2Credentials; | ||
|
||
import java.time.Instant; | ||
import java.util.Date; | ||
|
||
import static java.lang.Long.MAX_VALUE; | ||
|
||
/** | ||
* A placeholder for credentials to signify that requests sent to the server should not be | ||
* authenticated. This is typically useful when using local service emulators. | ||
* NOTE: The Google provided NoCredentials and NoCredentialsProvider do not behave as expected | ||
* See https://github.com/googleapis/gax-java/issues/1148 | ||
*/ | ||
public final class EmulatorCredentials extends OAuth2Credentials { | ||
private static final EmulatorCredentials INSTANCE = new EmulatorCredentials(); | ||
|
||
private EmulatorCredentials() { | ||
} | ||
|
||
private Object readResolve() { | ||
return INSTANCE; | ||
} | ||
|
||
public static EmulatorCredentials getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return this == obj; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return System.identityHashCode(this); | ||
} | ||
|
||
@Override | ||
public AccessToken refreshAccessToken() { | ||
return new AccessToken("Dummy credentials for emulator", Date.from(Instant.ofEpochMilli(MAX_VALUE))); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...rg/apache/flink/streaming/connectors/gcp/pubsub/emulator/EmulatorCredentialsProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.streaming.connectors.gcp.pubsub.emulator; | ||
|
||
import com.google.api.gax.core.CredentialsProvider; | ||
import com.google.auth.Credentials; | ||
|
||
/** | ||
* A CredentialsProvider that simply provides the right credentials that are to be used for connecting to an emulator. | ||
* NOTE: The Google provided NoCredentials and NoCredentialsProvider do not behave as expected. | ||
* See https://github.com/googleapis/gax-java/issues/1148 | ||
*/ | ||
public final class EmulatorCredentialsProvider implements CredentialsProvider { | ||
@Override | ||
public Credentials getCredentials() { | ||
return EmulatorCredentials.getInstance(); | ||
} | ||
|
||
public static EmulatorCredentialsProvider create() { | ||
return new EmulatorCredentialsProvider(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.