static Policy getIamPolicySource(SourceName sourceName) {
    try (SecurityCenterClient client = SecurityCenterClient.create()) {
      // Start setting up a request to get IAM policy for a source.
      // SourceName sourceName = SourceName.of(/*organization=*/"123234324",/*source=*/
      // "423432321");
      GetIamPolicyRequest request =
          GetIamPolicyRequest.newBuilder().setResource(sourceName.toString()).build();

      // Call the API.
      Policy response = client.getIamPolicy(request);

      System.out.println("Policy: " + response);
      return response;
    } catch (IOException e) {
      throw new RuntimeException("Couldn't create client.", e);
    }
  }
static Policy getIamPolicySource ( SourceName sourceName ) { try ( SecurityCenterClient client = SecurityCenterClient . create ( ) ) { GetIamPolicyRequest request = GetIamPolicyRequest . newBuilder ( ) . setResource ( sourceName . toString ( ) ) . build ( ) ; Policy response = client . getIamPolicy ( request ) ; System . out . println ( "Policy: " + response ) ; return response ; } catch ( IOException e ) { throw new RuntimeException ( "Couldn't create client." , e ) ; } }
[START get_source_iam_policy]