Config

oci.config.from_file(file_location='~/.oci/config', profile_name='DEFAULT')

Create a config dict from a file.

Parameters:
  • file_location – Path to the config file. Defaults to ~/.oci/config and with a fallback to environment variable OCI_CONFIG_FILE, then ~/.oraclebmc/config.
  • profile_name – The profile to load from the config file. Defaults to “DEFAULT”
Returns:

A config dict that can be used to create clients.

oci.config.validate_config(config, **kwargs)
oci.regions.is_region(region_name)
oci.regions.endpoint_for(service, region=None, endpoint=None, service_endpoint_template=None)

Returns the base URl for a service, either in the given region or at the specified endpoint.

If endpoint and region are provided, endpoint is used.

If the region information is not available in the existing maps, following sources are checked in order: 1. Regions Configuration File at ~/.oci/regions-config.json 2. Region Metadata Environment variable 3. Instance Metadata Service

Lookup from Instance Metadata Service is disabled by default. To enable, call enable_instance_metadata_service()

The region metadata schema is: {

“realmKey” : string, “realmDomainComponent” : string, “regionKey” : string, “regionIdentifier” : string

}

For example, for the Sydney OC1 region, the schema would be filled out as follows: {

“realmKey” : “OC1”, “realmDomainComponent” : “oraclecloud.com”, “regionKey” : “SYD”, “regionIdentifier” : “ap-sydney-1”

}

If the region still cannot be resolved, we fall back to OC1 realm