Search in sources :

Example 1 with IamCredentialsClient

use of com.google.cloud.iam.credentials.v1.IamCredentialsClient in project gapic-generator-java by googleapis.

the class SyncSignJwtServiceaccountnameListstringString method syncSignJwtServiceaccountnameListstringString.

public static void syncSignJwtServiceaccountnameListstringString() throws Exception {
    // It may require modifications to work in your environment.
    try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
        ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
        List<String> delegates = new ArrayList<>();
        String payload = "payload-786701938";
        SignJwtResponse response = iamCredentialsClient.signJwt(name, delegates, payload);
    }
}
Also used : SignJwtResponse(com.google.cloud.iam.credentials.v1.SignJwtResponse) ArrayList(java.util.ArrayList) IamCredentialsClient(com.google.cloud.iam.credentials.v1.IamCredentialsClient) ServiceAccountName(com.google.cloud.iam.credentials.v1.ServiceAccountName)

Example 2 with IamCredentialsClient

use of com.google.cloud.iam.credentials.v1.IamCredentialsClient in project gapic-generator-java by googleapis.

the class SyncGenerateIdToken method syncGenerateIdToken.

public static void syncGenerateIdToken() throws Exception {
    // It may require modifications to work in your environment.
    try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
        GenerateIdTokenRequest request = GenerateIdTokenRequest.newBuilder().setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString()).addAllDelegates(new ArrayList<String>()).setAudience("audience975628804").setIncludeEmail(true).build();
        GenerateIdTokenResponse response = iamCredentialsClient.generateIdToken(request);
    }
}
Also used : ArrayList(java.util.ArrayList) IamCredentialsClient(com.google.cloud.iam.credentials.v1.IamCredentialsClient) GenerateIdTokenRequest(com.google.cloud.iam.credentials.v1.GenerateIdTokenRequest) GenerateIdTokenResponse(com.google.cloud.iam.credentials.v1.GenerateIdTokenResponse)

Example 3 with IamCredentialsClient

use of com.google.cloud.iam.credentials.v1.IamCredentialsClient in project gapic-generator-java by googleapis.

the class SyncGenerateIdTokenServiceaccountnameListstringStringBoolean method syncGenerateIdTokenServiceaccountnameListstringStringBoolean.

public static void syncGenerateIdTokenServiceaccountnameListstringStringBoolean() throws Exception {
    // It may require modifications to work in your environment.
    try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
        ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
        List<String> delegates = new ArrayList<>();
        String audience = "audience975628804";
        boolean includeEmail = true;
        GenerateIdTokenResponse response = iamCredentialsClient.generateIdToken(name, delegates, audience, includeEmail);
    }
}
Also used : ArrayList(java.util.ArrayList) IamCredentialsClient(com.google.cloud.iam.credentials.v1.IamCredentialsClient) ServiceAccountName(com.google.cloud.iam.credentials.v1.ServiceAccountName) GenerateIdTokenResponse(com.google.cloud.iam.credentials.v1.GenerateIdTokenResponse)

Example 4 with IamCredentialsClient

use of com.google.cloud.iam.credentials.v1.IamCredentialsClient in project gapic-generator-java by googleapis.

the class AsyncSignBlob method asyncSignBlob.

public static void asyncSignBlob() throws Exception {
    // It may require modifications to work in your environment.
    try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
        SignBlobRequest request = SignBlobRequest.newBuilder().setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString()).addAllDelegates(new ArrayList<String>()).setPayload(ByteString.EMPTY).build();
        ApiFuture<SignBlobResponse> future = iamCredentialsClient.signBlobCallable().futureCall(request);
        // Do something.
        SignBlobResponse response = future.get();
    }
}
Also used : SignBlobRequest(com.google.cloud.iam.credentials.v1.SignBlobRequest) IamCredentialsClient(com.google.cloud.iam.credentials.v1.IamCredentialsClient) ByteString(com.google.protobuf.ByteString) SignBlobResponse(com.google.cloud.iam.credentials.v1.SignBlobResponse)

Example 5 with IamCredentialsClient

use of com.google.cloud.iam.credentials.v1.IamCredentialsClient in project gapic-generator-java by googleapis.

the class SyncSignBlobServiceaccountnameListstringBytestring method syncSignBlobServiceaccountnameListstringBytestring.

public static void syncSignBlobServiceaccountnameListstringBytestring() throws Exception {
    // It may require modifications to work in your environment.
    try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
        ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
        List<String> delegates = new ArrayList<>();
        ByteString payload = ByteString.EMPTY;
        SignBlobResponse response = iamCredentialsClient.signBlob(name, delegates, payload);
    }
}
Also used : ByteString(com.google.protobuf.ByteString) ArrayList(java.util.ArrayList) IamCredentialsClient(com.google.cloud.iam.credentials.v1.IamCredentialsClient) ServiceAccountName(com.google.cloud.iam.credentials.v1.ServiceAccountName) ByteString(com.google.protobuf.ByteString) SignBlobResponse(com.google.cloud.iam.credentials.v1.SignBlobResponse)

Aggregations

IamCredentialsClient (com.google.cloud.iam.credentials.v1.IamCredentialsClient)21 ArrayList (java.util.ArrayList)11 ServiceAccountName (com.google.cloud.iam.credentials.v1.ServiceAccountName)5 SignJwtResponse (com.google.cloud.iam.credentials.v1.SignJwtResponse)5 GenerateIdTokenResponse (com.google.cloud.iam.credentials.v1.GenerateIdTokenResponse)4 SignBlobResponse (com.google.cloud.iam.credentials.v1.SignBlobResponse)4 ByteString (com.google.protobuf.ByteString)4 GenerateAccessTokenResponse (com.google.cloud.iam.credentials.v1.GenerateAccessTokenResponse)3 IamCredentialsSettings (com.google.cloud.iam.credentials.v1.IamCredentialsSettings)3 HttpTransport (com.google.api.client.http.HttpTransport)2 GenerateIdTokenRequest (com.google.cloud.iam.credentials.v1.GenerateIdTokenRequest)2 SignBlobRequest (com.google.cloud.iam.credentials.v1.SignBlobRequest)2 SignJwtRequest (com.google.cloud.iam.credentials.v1.SignJwtRequest)2 Duration (com.google.protobuf.Duration)2 IOException (java.io.IOException)2 RetryerBuilder (com.github.rholder.retry.RetryerBuilder)1 GoogleCredential (com.google.api.client.googleapis.auth.oauth2.GoogleCredential)1 GoogleNetHttpTransport (com.google.api.client.googleapis.javanet.GoogleNetHttpTransport)1 ApacheHttpTransport (com.google.api.client.http.apache.ApacheHttpTransport)1 JsonFactory (com.google.api.client.json.JsonFactory)1