oraclecloud

package module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: UPL-1.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

libdns Oracle Cloud

libdns provider for Oracle Cloud Infrastructure DNS.

This module currently requires Go 1.25 or newer.

This package implements:

  • GetRecords
  • AppendRecords
  • SetRecords
  • DeleteRecords
  • ListZones

Authentication

OCI SDKs support several authentication methods. This provider supports the two primary methods: API keys, for authentication outside OCI, and instance_principal, for authentication from instances within OCI.

All OCI SDKs support some or all of Oracle's standard environment variables for authentication configuration, so this provider does too.

The recommended and most prominently documented configuration style is the standard OCI config file, usually ~/.oci/config, because it matches Oracle's preferred user workflow and works cleanly with existing OCI tooling.

See the OCI Developer Guide for more on the Authentication Methods and Environment Variables.

Supported Auth values:

  • "" or auto
  • api_key
  • config_file
  • environment
  • instance_principal

The api_key, config_file, and environment values are all API-key authentication; they only differ in where the credentials come from.

resource_principal and token-based authentication are not currently supported.

If you set Auth to auto or config_file with a valid ~/.oci/config file available, or set Auth to instance_principal on an OCI instance with the appropriate policies applied, no further configuration is required to manage public DNS zones. However, both of these methods require ViewID to be configured to manage private zones by name.

For environment, or when populating the provider fields directly, the minimum required values are TenancyOCID, UserOCID, Fingerprint, Region, and either PrivateKeyPath or inline PrivateKey. PrivateKeyPassphrase is only needed when the private key is passphrase-protected.

CompartmentID is required to List Zones.

Provider Fields

provider := oraclecloud.Provider{
    Auth:               "auto",
    ConfigFile:         "~/.oci/config",
    ConfigProfile:      "DEFAULT",
    TenancyOCID:        "ocid1.tenancy.oc1..example",
    UserOCID:           "ocid1.user.oc1..example",
    Fingerprint:        "12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef",
    PrivateKeyPath:     "~/.oci/oci_api_key.pem",
    PrivateKeyPassphrase: "",
    Region:             "us-phoenix-1",
    Scope:              "GLOBAL",
    ViewID:             "",
    CompartmentID:      "ocid1.compartment.oc1..example",
}

Environment Variables

The provider accepts Oracle's documented OCI CLI environment variables:

  • OCI_CLI_KEY_CONTENT or OCI_CLI_KEY_FILE
  • OCI_CLI_PASSPHRASE
  • OCI_CLI_TENANCY
  • OCI_CLI_USER
  • OCI_CLI_FINGERPRINT
  • OCI_CLI_REGION
  • OCI_CLI_CONFIG_FILE
  • OCI_CLI_PROFILE

Smoke Test

You can verify real OCI auth and TXT-record write access locally with the bundled smoke-test command:

go run ./cmd/ocismoke \
  -auth config_file \
  -config-file ~/.oci/config \
  -config-profile DEFAULT \
  -zone example.com

By default it creates a random _libdns-smoke-* TXT record, confirms it can read it back, and then deletes it.

Useful flags:

  • -auth auto|config_file|environment|api_key
  • -zone zone name or OCI zone OCID
  • -view-id for private zones accessed by name
  • -scope GLOBAL|PRIVATE
  • -name to override the generated label
  • -value to override the generated TXT value

For safety, the smoke-test command does not accept inline secret flags such as --private-key or --private-key-passphrase. Use -config-file, -private-key-path, or Oracle's OCI_CLI_* environment variables instead.

Versioning

This module follows Semantic Versioning, with Git tags like v1.2.3.

For Go modules, that means:

  • fix: conventional commits map to patch releases
  • feat: conventional commits map to minor releases
  • feat!: or any commit with a BREAKING CHANGE: footer maps to a major release
  • if this module ever releases v2+, the Go module path must also change to include the major suffix such as github.com/libdns/oraclecloud/v2

GitHub Actions uses release-please to turn conventional commits merged to main into release PRs, SemVer tags, changelog updates, and GitHub Releases.

Notes

  • In Auth: "auto" mode, explicit API-key fields take precedence over config-file auth. If you want to force use of ~/.oci/config, set Auth: "config_file".
  • For private zones accessed by name, OCI requires ViewID.
  • SetRecords is atomic per RRSet because OCI exposes RRSet replacement as a single operation, but it is not atomic across multiple distinct RRSets.
  • The module path is github.com/libdns/oraclecloud.

Documentation

Overview

Package oraclecloud implements a libdns provider for Oracle Cloud Infrastructure DNS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// Auth selects how the provider obtains OCI credentials: auto, api_key,
	// config_file, environment, or instance_principal.
	Auth string `json:"auth,omitempty"`

	// ConfigFile is the path to the OCI config file, usually ~/.oci/config.
	ConfigFile string `json:"config_file,omitempty"`
	// ConfigProfile is the profile name within ConfigFile to use.
	ConfigProfile string `json:"config_profile,omitempty"`

	// PrivateKey is the PEM-encoded API signing key content.
	PrivateKey string `json:"private_key,omitempty"`
	// PrivateKeyPath is the path to the PEM-encoded API signing key file.
	PrivateKeyPath string `json:"private_key_path,omitempty"`
	// PrivateKeyPassphrase is the passphrase for the API signing key, if any.
	PrivateKeyPassphrase string `json:"private_key_passphrase,omitempty"`
	// TenancyOCID is the OCID of the tenancy that owns the credentials.
	TenancyOCID string `json:"tenancy_ocid,omitempty"`
	// UserOCID is the OCID of the OCI user for API key authentication.
	UserOCID string `json:"user_ocid,omitempty"`
	// Fingerprint is the fingerprint of the registered OCI API signing key.
	Fingerprint string `json:"fingerprint,omitempty"`
	// Region is the OCI region used for DNS API requests.
	Region string `json:"region,omitempty"`

	// Scope selects the DNS zone scope: GLOBAL or PRIVATE.
	Scope string `json:"scope,omitempty"`
	// ViewID identifies the private DNS view when operating on private zones by name.
	ViewID string `json:"view_id,omitempty"`
	// CompartmentID identifies the compartment to search when listing zones.
	CompartmentID string `json:"compartment_id,omitempty"`
	// contains filtered or unexported fields
}

Provider facilitates DNS record manipulation with Oracle Cloud Infrastructure.

Authentication is intentionally kept simple:

  • explicit API key fields on the provider
  • OCI config file/profile
  • OCI_* environment variables

The provider is safe for concurrent use.

func (*Provider) AppendRecords

func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

AppendRecords adds records to the zone. It returns the records that were added.

func (*Provider) DeleteRecords

func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

DeleteRecords deletes the specified records from the zone. It returns the records that were deleted.

func (*Provider) GetRecords

func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)

GetRecords lists all the records in the zone.

func (*Provider) ListZones

func (p *Provider) ListZones(ctx context.Context) ([]libdns.Zone, error)

ListZones lists the zones available in the configured compartment.

func (*Provider) SetRecords

func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

SetRecords sets the records in the zone, either by updating existing records or creating new ones. It returns the updated records.

Directories

Path Synopsis
cmd
ocismoke command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址