class Google::Auth::ExternalAccount::AwsCredentials

def region

Raises:
  • (Google::Auth::CredentialsError) - If the region is not set in the environment

Returns:
  • (String) - The name of the AWS region
def region
  @region = ENV[CredentialsLoader::AWS_REGION_VAR] || ENV[CredentialsLoader::AWS_DEFAULT_REGION_VAR]
  unless @region
    unless @region_url
      raise CredentialsError.with_details(
        "region_url or region must be set for external account credentials",
        credential_type_name: self.class.name,
        principal: principal
      )
    end
    @region ||= get_aws_resource(@region_url, "region").body[0..-2]
  end
  @region
end