@Generated(value="by gapic-generator") @BetaApi public class PhishingProtectionServiceV1Beta1Client extends Object implements BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (PhishingProtectionServiceV1Beta1Client phishingProtectionServiceV1Beta1Client = PhishingProtectionServiceV1Beta1Client.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String uri = "";
ReportPhishingResponse response = phishingProtectionServiceV1Beta1Client.reportPhishing(parent, uri);
}
Note: close() needs to be called on the phishingProtectionServiceV1Beta1Client object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of PhishingProtectionServiceV1Beta1Settings to create(). For example:
To customize credentials:
PhishingProtectionServiceV1Beta1Settings phishingProtectionServiceV1Beta1Settings =
PhishingProtectionServiceV1Beta1Settings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
PhishingProtectionServiceV1Beta1Client phishingProtectionServiceV1Beta1Client =
PhishingProtectionServiceV1Beta1Client.create(phishingProtectionServiceV1Beta1Settings);
To customize the endpoint:
PhishingProtectionServiceV1Beta1Settings phishingProtectionServiceV1Beta1Settings =
PhishingProtectionServiceV1Beta1Settings.newBuilder().setEndpoint(myEndpoint).build();
PhishingProtectionServiceV1Beta1Client phishingProtectionServiceV1Beta1Client =
PhishingProtectionServiceV1Beta1Client.create(phishingProtectionServiceV1Beta1Settings);
Modifier | Constructor and Description |
---|---|
protected |
PhishingProtectionServiceV1Beta1Client(PhishingProtectionServiceV1Beta1Settings settings)
Constructs an instance of PhishingProtectionServiceV1Beta1Client, using the given settings.
|
protected |
PhishingProtectionServiceV1Beta1Client(PhishingProtectionServiceV1Beta1Stub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static PhishingProtectionServiceV1Beta1Client |
create()
Constructs an instance of PhishingProtectionServiceV1Beta1Client with default settings.
|
static PhishingProtectionServiceV1Beta1Client |
create(PhishingProtectionServiceV1Beta1Settings settings)
Constructs an instance of PhishingProtectionServiceV1Beta1Client, using the given settings.
|
static PhishingProtectionServiceV1Beta1Client |
create(PhishingProtectionServiceV1Beta1Stub stub)
Constructs an instance of PhishingProtectionServiceV1Beta1Client, using the given stub for
making calls.
|
PhishingProtectionServiceV1Beta1Settings |
getSettings() |
PhishingProtectionServiceV1Beta1Stub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
com.google.phishingprotection.v1beta1.ReportPhishingResponse |
reportPhishing(com.google.phishingprotection.v1beta1.ProjectName parent,
String uri)
Reports a URI suspected of containing phishing content to be reviewed.
|
com.google.phishingprotection.v1beta1.ReportPhishingResponse |
reportPhishing(com.google.phishingprotection.v1beta1.ReportPhishingRequest request)
Reports a URI suspected of containing phishing content to be reviewed.
|
com.google.phishingprotection.v1beta1.ReportPhishingResponse |
reportPhishing(String parent,
String uri)
Reports a URI suspected of containing phishing content to be reviewed.
|
UnaryCallable<com.google.phishingprotection.v1beta1.ReportPhishingRequest,com.google.phishingprotection.v1beta1.ReportPhishingResponse> |
reportPhishingCallable()
Reports a URI suspected of containing phishing content to be reviewed.
|
void |
shutdown() |
void |
shutdownNow() |
protected PhishingProtectionServiceV1Beta1Client(PhishingProtectionServiceV1Beta1Settings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected PhishingProtectionServiceV1Beta1Client(PhishingProtectionServiceV1Beta1Stub stub)
public static final PhishingProtectionServiceV1Beta1Client create() throws IOException
IOException
public static final PhishingProtectionServiceV1Beta1Client create(PhishingProtectionServiceV1Beta1Settings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final PhishingProtectionServiceV1Beta1Client create(PhishingProtectionServiceV1Beta1Stub stub)
public final PhishingProtectionServiceV1Beta1Settings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public PhishingProtectionServiceV1Beta1Stub getStub()
public final com.google.phishingprotection.v1beta1.ReportPhishingResponse reportPhishing(com.google.phishingprotection.v1beta1.ProjectName parent, String uri)
Sample code:
try (PhishingProtectionServiceV1Beta1Client phishingProtectionServiceV1Beta1Client = PhishingProtectionServiceV1Beta1Client.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String uri = "";
ReportPhishingResponse response = phishingProtectionServiceV1Beta1Client.reportPhishing(parent, uri);
}
parent
- Required. The name of the project for which the report will be created, in the
format "projects/{project_number}".uri
- The URI that is being reported for phishing content to be analyzed.ApiException
- if the remote call failspublic final com.google.phishingprotection.v1beta1.ReportPhishingResponse reportPhishing(String parent, String uri)
Sample code:
try (PhishingProtectionServiceV1Beta1Client phishingProtectionServiceV1Beta1Client = PhishingProtectionServiceV1Beta1Client.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String uri = "";
ReportPhishingResponse response = phishingProtectionServiceV1Beta1Client.reportPhishing(parent.toString(), uri);
}
parent
- Required. The name of the project for which the report will be created, in the
format "projects/{project_number}".uri
- The URI that is being reported for phishing content to be analyzed.ApiException
- if the remote call failspublic final com.google.phishingprotection.v1beta1.ReportPhishingResponse reportPhishing(com.google.phishingprotection.v1beta1.ReportPhishingRequest request)
Sample code:
try (PhishingProtectionServiceV1Beta1Client phishingProtectionServiceV1Beta1Client = PhishingProtectionServiceV1Beta1Client.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String uri = "";
ReportPhishingRequest request = ReportPhishingRequest.newBuilder()
.setParent(parent.toString())
.setUri(uri)
.build();
ReportPhishingResponse response = phishingProtectionServiceV1Beta1Client.reportPhishing(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.phishingprotection.v1beta1.ReportPhishingRequest,com.google.phishingprotection.v1beta1.ReportPhishingResponse> reportPhishingCallable()
Sample code:
try (PhishingProtectionServiceV1Beta1Client phishingProtectionServiceV1Beta1Client = PhishingProtectionServiceV1Beta1Client.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String uri = "";
ReportPhishingRequest request = ReportPhishingRequest.newBuilder()
.setParent(parent.toString())
.setUri(uri)
.build();
ApiFuture<ReportPhishingResponse> future = phishingProtectionServiceV1Beta1Client.reportPhishingCallable().futureCall(request);
// Do something
ReportPhishingResponse response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.