From 6fd2f6701d6ab0bd6991d9d15e031d7376245a5d Mon Sep 17 00:00:00 2001 From: Andrew Pryde Date: Tue, 12 Sep 2017 16:30:39 +0100 Subject: [PATCH] Rename Oracle BMCS builder to OCI Oracle Bare Metal Cloud Services (BMCS) has been rebranded as Oracle Cloud Infrastructure (OCI). --- builder/oracle/{bmcs => oci}/COPYRIGHT | 0 builder/oracle/{bmcs => oci}/artifact.go | 4 +- builder/oracle/{bmcs => oci}/artifact_test.go | 2 +- builder/oracle/{bmcs => oci}/builder.go | 20 +++---- builder/oracle/{bmcs => oci}/builder_test.go | 2 +- .../{bmcs => oci}/client/base_client.go | 4 +- builder/oracle/{bmcs => oci}/client/client.go | 8 +-- .../{bmcs => oci}/client/client_test.go | 4 +- .../oracle/{bmcs => oci}/client/compute.go | 6 +- builder/oracle/{bmcs => oci}/client/config.go | 12 ++-- .../{bmcs => oci}/client/config_test.go | 2 +- builder/oracle/{bmcs => oci}/client/error.go | 4 +- builder/oracle/{bmcs => oci}/client/image.go | 8 +-- .../oracle/{bmcs => oci}/client/image_test.go | 8 +-- .../oracle/{bmcs => oci}/client/instance.go | 12 ++-- .../{bmcs => oci}/client/instance_test.go | 8 +-- .../oracle/{bmcs => oci}/client/transport.go | 6 +- .../{bmcs => oci}/client/transport_test.go | 2 +- builder/oracle/{bmcs => oci}/client/vnic.go | 6 +- .../{bmcs => oci}/client/vnic_attachment.go | 8 +-- .../client/vnic_attachment_test.go | 2 +- .../oracle/{bmcs => oci}/client/vnic_test.go | 2 +- .../oracle/{bmcs => oci}/client/waiters.go | 2 +- .../{bmcs => oci}/client/waiters_test.go | 2 +- builder/oracle/{bmcs => oci}/config.go | 14 ++--- builder/oracle/{bmcs => oci}/config_test.go | 4 +- builder/oracle/{bmcs => oci}/driver.go | 6 +- builder/oracle/{bmcs => oci}/driver_mock.go | 6 +- .../driver_bmcs.go => oci/driver_oci.go} | 30 +++++----- builder/oracle/{bmcs => oci}/ssh.go | 2 +- .../{bmcs => oci}/step_create_instance.go | 2 +- .../step_create_instance_test.go | 2 +- builder/oracle/{bmcs => oci}/step_image.go | 2 +- .../oracle/{bmcs => oci}/step_image_test.go | 2 +- .../{bmcs => oci}/step_instance_info.go | 2 +- .../{bmcs => oci}/step_instance_info_test.go | 2 +- .../oracle/{bmcs => oci}/step_ssh_key_pair.go | 2 +- builder/oracle/{bmcs => oci}/step_test.go | 4 +- command/plugin.go | 4 +- ...oracle-bmcs.html.md => oracle-oci.html.md} | 60 +++++++++---------- website/source/layouts/docs.erb | 4 +- 41 files changed, 139 insertions(+), 143 deletions(-) rename builder/oracle/{bmcs => oci}/COPYRIGHT (100%) rename builder/oracle/{bmcs => oci}/artifact.go (92%) rename builder/oracle/{bmcs => oci}/artifact_test.go (94%) rename builder/oracle/{bmcs => oci}/builder.go (79%) rename builder/oracle/{bmcs => oci}/builder_test.go (94%) rename builder/oracle/{bmcs => oci}/client/base_client.go (99%) rename builder/oracle/{bmcs => oci}/client/client.go (81%) rename builder/oracle/{bmcs => oci}/client/client_test.go (91%) rename builder/oracle/{bmcs => oci}/client/compute.go (87%) rename builder/oracle/{bmcs => oci}/client/config.go (94%) rename builder/oracle/{bmcs => oci}/client/config_test.go (99%) rename builder/oracle/{bmcs => oci}/client/error.go (86%) rename builder/oracle/{bmcs => oci}/client/image.go (94%) rename builder/oracle/{bmcs => oci}/client/image_test.go (94%) rename builder/oracle/{bmcs => oci}/client/instance.go (91%) rename builder/oracle/{bmcs => oci}/client/instance_test.go (94%) rename builder/oracle/{bmcs => oci}/client/transport.go (94%) rename builder/oracle/{bmcs => oci}/client/transport_test.go (99%) rename builder/oracle/{bmcs => oci}/client/vnic.go (89%) rename builder/oracle/{bmcs => oci}/client/vnic_attachment.go (88%) rename builder/oracle/{bmcs => oci}/client/vnic_attachment_test.go (98%) rename builder/oracle/{bmcs => oci}/client/vnic_test.go (97%) rename builder/oracle/{bmcs => oci}/client/waiters.go (99%) rename builder/oracle/{bmcs => oci}/client/waiters_test.go (99%) rename builder/oracle/{bmcs => oci}/config.go (93%) rename builder/oracle/{bmcs => oci}/config_test.go (98%) rename builder/oracle/{bmcs => oci}/driver.go (71%) rename builder/oracle/{bmcs => oci}/driver_mock.go (95%) rename builder/oracle/{bmcs/driver_bmcs.go => oci/driver_oci.go} (73%) rename builder/oracle/{bmcs => oci}/ssh.go (98%) rename builder/oracle/{bmcs => oci}/step_create_instance.go (99%) rename builder/oracle/{bmcs => oci}/step_create_instance_test.go (99%) rename builder/oracle/{bmcs => oci}/step_image.go (98%) rename builder/oracle/{bmcs => oci}/step_image_test.go (99%) rename builder/oracle/{bmcs => oci}/step_instance_info.go (98%) rename builder/oracle/{bmcs => oci}/step_instance_info_test.go (98%) rename builder/oracle/{bmcs => oci}/step_ssh_key_pair.go (99%) rename builder/oracle/{bmcs => oci}/step_test.go (93%) rename website/source/docs/builders/{oracle-bmcs.html.md => oracle-oci.html.md} (63%) diff --git a/builder/oracle/bmcs/COPYRIGHT b/builder/oracle/oci/COPYRIGHT similarity index 100% rename from builder/oracle/bmcs/COPYRIGHT rename to builder/oracle/oci/COPYRIGHT diff --git a/builder/oracle/bmcs/artifact.go b/builder/oracle/oci/artifact.go similarity index 92% rename from builder/oracle/bmcs/artifact.go rename to builder/oracle/oci/artifact.go index 0466094d1..6684468fc 100644 --- a/builder/oracle/bmcs/artifact.go +++ b/builder/oracle/oci/artifact.go @@ -1,8 +1,8 @@ -package bmcs +package oci import ( "fmt" - client "github.com/hashicorp/packer/builder/oracle/bmcs/client" + client "github.com/hashicorp/packer/builder/oracle/oci/client" ) // Artifact is an artifact implementation that contains a built Custom Image. diff --git a/builder/oracle/bmcs/artifact_test.go b/builder/oracle/oci/artifact_test.go similarity index 94% rename from builder/oracle/bmcs/artifact_test.go rename to builder/oracle/oci/artifact_test.go index f36a7e7a7..5cfbc1cb8 100644 --- a/builder/oracle/bmcs/artifact_test.go +++ b/builder/oracle/oci/artifact_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "testing" diff --git a/builder/oracle/bmcs/builder.go b/builder/oracle/oci/builder.go similarity index 79% rename from builder/oracle/bmcs/builder.go rename to builder/oracle/oci/builder.go index c29253422..5eedaa0b1 100644 --- a/builder/oracle/bmcs/builder.go +++ b/builder/oracle/oci/builder.go @@ -1,12 +1,12 @@ -// Package bmcs contains a packer.Builder implementation that builds Oracle -// Bare Metal Cloud Services (BMCS) images. -package bmcs +// Package oci contains a packer.Builder implementation that builds Oracle +// Bare Metal Cloud Services (OCI) images. +package oci import ( "fmt" "log" - client "github.com/hashicorp/packer/builder/oracle/bmcs/client" + client "github.com/hashicorp/packer/builder/oracle/oci/client" "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/packer" @@ -14,12 +14,12 @@ import ( ) // BuilderId uniquely identifies the builder -const BuilderId = "packer.oracle.bmcs" +const BuilderId = "packer.oracle.oci" -// BMCS API version -const bmcsAPIVersion = "20160918" +// OCI API version +const ociAPIVersion = "20160918" -// Builder is a builder implementation that creates Oracle BMCS custom images. +// Builder is a builder implementation that creates Oracle OCI custom images. type Builder struct { config *Config runner multistep.Runner @@ -36,7 +36,7 @@ func (b *Builder) Prepare(rawConfig ...interface{}) ([]string, error) { } func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { - driver, err := NewDriverBMCS(b.config) + driver, err := NewDriverOCI(b.config) if err != nil { return nil, err } @@ -52,7 +52,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe steps := []multistep.Step{ &stepKeyPair{ Debug: b.config.PackerDebug, - DebugKeyPath: fmt.Sprintf("bmcs_%s.pem", b.config.PackerBuildName), + DebugKeyPath: fmt.Sprintf("oci_%s.pem", b.config.PackerBuildName), PrivateKeyFile: b.config.Comm.SSHPrivateKey, }, &stepCreateInstance{}, diff --git a/builder/oracle/bmcs/builder_test.go b/builder/oracle/oci/builder_test.go similarity index 94% rename from builder/oracle/bmcs/builder_test.go rename to builder/oracle/oci/builder_test.go index cb4c0d0f2..80500ef55 100644 --- a/builder/oracle/bmcs/builder_test.go +++ b/builder/oracle/oci/builder_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "testing" diff --git a/builder/oracle/bmcs/client/base_client.go b/builder/oracle/oci/client/base_client.go similarity index 99% rename from builder/oracle/bmcs/client/base_client.go rename to builder/oracle/oci/client/base_client.go index d25ca12d4..7270687e7 100644 --- a/builder/oracle/bmcs/client/base_client.go +++ b/builder/oracle/oci/client/base_client.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "bytes" @@ -14,7 +14,7 @@ const ( ) // baseClient provides a basic (AND INTENTIONALLY INCOMPLETE) JSON REST client -// that abstracts away some of the repetitive code required in the BMCS Client. +// that abstracts away some of the repetitive code required in the OCI Client. type baseClient struct { httpClient *http.Client method string diff --git a/builder/oracle/bmcs/client/client.go b/builder/oracle/oci/client/client.go similarity index 81% rename from builder/oracle/bmcs/client/client.go rename to builder/oracle/oci/client/client.go index b2cffdeda..8e6c1762d 100644 --- a/builder/oracle/bmcs/client/client.go +++ b/builder/oracle/oci/client/client.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "net/http" @@ -6,11 +6,11 @@ import ( const ( apiVersion = "20160918" - userAgent = "go-bmcs/" + apiVersion + userAgent = "go-oci/" + apiVersion baseURLPattern = "https://%s.%s.oraclecloud.com/%s/" ) -// Client is the main interface through which consumers interact with the BMCS +// Client is the main interface through which consumers interact with the OCI // API. type Client struct { UserAgent string @@ -18,7 +18,7 @@ type Client struct { Config *Config } -// NewClient creates a new Client for communicating with the BMCS API. +// NewClient creates a new Client for communicating with the OCI API. func NewClient(config *Config) (*Client, error) { transport := NewTransport(http.DefaultTransport, config) base := newBaseClient().Client(&http.Client{Transport: transport}) diff --git a/builder/oracle/bmcs/client/client_test.go b/builder/oracle/oci/client/client_test.go similarity index 91% rename from builder/oracle/bmcs/client/client_test.go rename to builder/oracle/oci/client/client_test.go index 72dd13248..f2ebd8f87 100644 --- a/builder/oracle/bmcs/client/client_test.go +++ b/builder/oracle/oci/client/client_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "net/http" @@ -16,7 +16,7 @@ var ( keyFile *os.File ) -// setup sets up a test HTTP server along with a bmcs.Client that is +// setup sets up a test HTTP server along with a oci.Client that is // configured to talk to that test server. Tests should register handlers on // mux which provide mock responses for the API method being tested. func setup() { diff --git a/builder/oracle/bmcs/client/compute.go b/builder/oracle/oci/client/compute.go similarity index 87% rename from builder/oracle/bmcs/client/compute.go rename to builder/oracle/oci/client/compute.go index b66433e97..183a3794f 100644 --- a/builder/oracle/bmcs/client/compute.go +++ b/builder/oracle/oci/client/compute.go @@ -1,6 +1,6 @@ -package bmcs +package oci -// ComputeClient is a client for the BMCS Compute API. +// ComputeClient is a client for the OCI Compute API. type ComputeClient struct { BaseURL string Instances *InstanceService @@ -9,7 +9,7 @@ type ComputeClient struct { VNICs *VNICService } -// NewComputeClient creates a new client for communicating with the BMCS +// NewComputeClient creates a new client for communicating with the OCI // Compute API. func NewComputeClient(s *baseClient) *ComputeClient { return &ComputeClient{ diff --git a/builder/oracle/bmcs/client/config.go b/builder/oracle/oci/client/config.go similarity index 94% rename from builder/oracle/bmcs/client/config.go rename to builder/oracle/oci/client/config.go index e6b1bef30..580cd9f77 100644 --- a/builder/oracle/bmcs/client/config.go +++ b/builder/oracle/oci/client/config.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "crypto/rand" @@ -28,7 +28,7 @@ type Config struct { // Hex key fingerprint (e.g. b5:a0:62:57:28:0d:fd:c9:59:16:eb:d4:51:9f:70:e4) Fingerprint string `ini:"fingerprint"` - // Path to BMCS config file (e.g. ~/.oraclebmc/config) + // Path to OCI config file (e.g. ~/.oci/config) KeyFile string `ini:"key_file"` // Passphrase used for the key, if it is encrypted. @@ -50,11 +50,11 @@ func (c *Config) getBaseURL(service string) string { return fmt.Sprintf(baseURLPattern, service, c.Region, apiVersion) } -// LoadConfigsFromFile loads all oracle bmcs configurations from a file -// (generally ~/.oraclebmc/config). +// LoadConfigsFromFile loads all oracle oci configurations from a file +// (generally ~/.oci/config). func LoadConfigsFromFile(path string) (map[string]*Config, error) { if _, err := os.Stat(path); err != nil { - return nil, fmt.Errorf("Oracle BMCS config file is missing: %s", path) + return nil, fmt.Errorf("Oracle OCI config file is missing: %s", path) } cfgFile, err := ini.Load(path) @@ -89,7 +89,7 @@ func LoadConfigsFromFile(path string) (map[string]*Config, error) { return configs, nil } -// Loads an individual Config object from a ini.Section in the oraclebmc config +// Loads an individual Config object from a ini.Section in the Oracle OCI config // file. func loadConfigSection(f *ini.File, sectionName string, config *Config) (*Config, error) { if config == nil { diff --git a/builder/oracle/bmcs/client/config_test.go b/builder/oracle/oci/client/config_test.go similarity index 99% rename from builder/oracle/bmcs/client/config_test.go rename to builder/oracle/oci/client/config_test.go index 84e9d8195..08f0b806d 100644 --- a/builder/oracle/bmcs/client/config_test.go +++ b/builder/oracle/oci/client/config_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "crypto/rand" diff --git a/builder/oracle/bmcs/client/error.go b/builder/oracle/oci/client/error.go similarity index 86% rename from builder/oracle/bmcs/client/error.go rename to builder/oracle/oci/client/error.go index 776d6b6ec..a97112f81 100644 --- a/builder/oracle/bmcs/client/error.go +++ b/builder/oracle/oci/client/error.go @@ -1,4 +1,4 @@ -package bmcs +package oci import "fmt" @@ -9,7 +9,7 @@ type APIError struct { } func (e APIError) Error() string { - return fmt.Sprintf("BMCS: [%s] '%s'", e.Code, e.Message) + return fmt.Sprintf("OCI: [%s] '%s'", e.Code, e.Message) } // firstError is a helper function to work out which error to return from calls diff --git a/builder/oracle/bmcs/client/image.go b/builder/oracle/oci/client/image.go similarity index 94% rename from builder/oracle/bmcs/client/image.go rename to builder/oracle/oci/client/image.go index 0cd279b89..802b4650c 100644 --- a/builder/oracle/bmcs/client/image.go +++ b/builder/oracle/oci/client/image.go @@ -1,24 +1,24 @@ -package bmcs +package oci import ( "time" ) -// ImageService enables communicating with the BMCS compute API's instance +// ImageService enables communicating with the OCI compute API's instance // related endpoints. type ImageService struct { client *baseClient } // NewImageService creates a new ImageService for communicating with the -// BMCS compute API's instance related endpoints. +// OCI compute API's instance related endpoints. func NewImageService(s *baseClient) *ImageService { return &ImageService{ client: s.New().Path("images/"), } } -// Image details a BMCS boot disk image. +// Image details a OCI boot disk image. type Image struct { // The OCID of the image originally used to launch the instance. BaseImageID string `json:"baseImageId,omitempty"` diff --git a/builder/oracle/bmcs/client/image_test.go b/builder/oracle/oci/client/image_test.go similarity index 94% rename from builder/oracle/bmcs/client/image_test.go rename to builder/oracle/oci/client/image_test.go index 2bd3fccdb..ef55cc552 100644 --- a/builder/oracle/bmcs/client/image_test.go +++ b/builder/oracle/oci/client/image_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "fmt" @@ -34,12 +34,12 @@ func TestCreateImage(t *testing.T) { defer teardown() mux.HandleFunc("/images/", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, `{"displayName": "go-bmcs test"}`) + fmt.Fprint(w, `{"displayName": "go-oci test"}`) }) params := &CreateImageParams{ CompartmentID: "ocid1.compartment.oc1..a", - DisplayName: "go-bmcs test image", + DisplayName: "go-oci test image", InstanceID: "ocid1.image.oc1.phx.a", } @@ -48,7 +48,7 @@ func TestCreateImage(t *testing.T) { t.Errorf("Client.Compute.Images.Create() returned error: %v", err) } - want := Image{DisplayName: "go-bmcs test"} + want := Image{DisplayName: "go-oci test"} if !reflect.DeepEqual(image, want) { t.Errorf("Client.Compute.Images.Create() returned %+v, want %+v", image, want) diff --git a/builder/oracle/bmcs/client/instance.go b/builder/oracle/oci/client/instance.go similarity index 91% rename from builder/oracle/bmcs/client/instance.go rename to builder/oracle/oci/client/instance.go index 5c40fbd64..30cdbd50b 100644 --- a/builder/oracle/bmcs/client/instance.go +++ b/builder/oracle/oci/client/instance.go @@ -1,24 +1,24 @@ -package bmcs +package oci import ( "time" ) -// InstanceService enables communicating with the BMCS compute API's instance +// InstanceService enables communicating with the OCI compute API's instance // related endpoints. type InstanceService struct { client *baseClient } // NewInstanceService creates a new InstanceService for communicating with the -// BMCS compute API's instance related endpoints. +// OCI compute API's instance related endpoints. func NewInstanceService(s *baseClient) *InstanceService { return &InstanceService{ client: s.New().Path("instances/"), } } -// Instance details a BMCS compute instance. +// Instance details a OCI compute instance. type Instance struct { // The Availability Domain the instance is running in. AvailabilityDomain string `json:"availabilityDomain"` @@ -90,7 +90,7 @@ type LaunchInstanceParams struct { SubnetID string `json:"subnetId,omitempty"` } -// Launch creates a new BMCS compute instance. It does *not* wait for the +// Launch creates a new OCI compute instance. It does *not* wait for the // instance to boot. func (s *InstanceService) Launch(params *LaunchInstanceParams) (Instance, error) { instance := &Instance{} @@ -108,7 +108,7 @@ type TerminateInstanceParams struct { ID string `url:"instanceId,omitempty"` } -// Terminate terminates a running BMCS compute instance. +// Terminate terminates a running OCI compute instance. // instance to boot. func (s *InstanceService) Terminate(params *TerminateInstanceParams) error { e := &APIError{} diff --git a/builder/oracle/bmcs/client/instance_test.go b/builder/oracle/oci/client/instance_test.go similarity index 94% rename from builder/oracle/bmcs/client/instance_test.go rename to builder/oracle/oci/client/instance_test.go index 45d130bd3..e45b707af 100644 --- a/builder/oracle/bmcs/client/instance_test.go +++ b/builder/oracle/oci/client/instance_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "fmt" @@ -34,13 +34,13 @@ func TestLaunchInstance(t *testing.T) { defer teardown() mux.HandleFunc("/instances/", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, `{"displayName": "go-bmcs test"}`) + fmt.Fprint(w, `{"displayName": "go-oci test"}`) }) params := &LaunchInstanceParams{ AvailabilityDomain: "aaaa:PHX-AD-1", CompartmentID: "ocid1.compartment.oc1..a", - DisplayName: "go-bmcs test", + DisplayName: "go-oci test", ImageID: "ocid1.image.oc1.phx.a", Shape: "VM.Standard1.1", SubnetID: "ocid1.subnet.oc1.phx.a", @@ -51,7 +51,7 @@ func TestLaunchInstance(t *testing.T) { t.Errorf("Client.Compute.Instances.Launch() returned error: %v", err) } - want := Instance{DisplayName: "go-bmcs test"} + want := Instance{DisplayName: "go-oci test"} if !reflect.DeepEqual(instance, want) { t.Errorf("Client.Compute.Instances.Launch() returned %+v, want %+v", instance, want) diff --git a/builder/oracle/bmcs/client/transport.go b/builder/oracle/oci/client/transport.go similarity index 94% rename from builder/oracle/bmcs/client/transport.go rename to builder/oracle/oci/client/transport.go index 10fffa206..79da20509 100644 --- a/builder/oracle/bmcs/client/transport.go +++ b/builder/oracle/oci/client/transport.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "bytes" @@ -23,13 +23,13 @@ func (nopCloser) Close() error { return nil } -// Transport adds BMCS signature authentication to each outgoing request. +// Transport adds OCI signature authentication to each outgoing request. type Transport struct { transport http.RoundTripper config *Config } -// NewTransport creates a new Transport to add BMCS signature authentication +// NewTransport creates a new Transport to add OCI signature authentication // to each outgoing request. func NewTransport(transport http.RoundTripper, config *Config) *Transport { return &Transport{ diff --git a/builder/oracle/bmcs/client/transport_test.go b/builder/oracle/oci/client/transport_test.go similarity index 99% rename from builder/oracle/bmcs/client/transport_test.go rename to builder/oracle/oci/client/transport_test.go index be0d577b5..2299f3a0e 100644 --- a/builder/oracle/bmcs/client/transport_test.go +++ b/builder/oracle/oci/client/transport_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "net/http" diff --git a/builder/oracle/bmcs/client/vnic.go b/builder/oracle/oci/client/vnic.go similarity index 89% rename from builder/oracle/bmcs/client/vnic.go rename to builder/oracle/oci/client/vnic.go index bd434bbde..31b37ec3e 100644 --- a/builder/oracle/bmcs/client/vnic.go +++ b/builder/oracle/oci/client/vnic.go @@ -1,17 +1,17 @@ -package bmcs +package oci import ( "time" ) -// VNICService enables communicating with the BMCS compute API's VNICs +// VNICService enables communicating with the OCI compute API's VNICs // endpoint. type VNICService struct { client *baseClient } // NewVNICService creates a new VNICService for communicating with the -// BMCS compute API's instance related endpoints. +// OCI compute API's instance related endpoints. func NewVNICService(s *baseClient) *VNICService { return &VNICService{client: s.New().Path("vnics/")} } diff --git a/builder/oracle/bmcs/client/vnic_attachment.go b/builder/oracle/oci/client/vnic_attachment.go similarity index 88% rename from builder/oracle/bmcs/client/vnic_attachment.go rename to builder/oracle/oci/client/vnic_attachment.go index f4baff1b6..3458f7da1 100644 --- a/builder/oracle/bmcs/client/vnic_attachment.go +++ b/builder/oracle/oci/client/vnic_attachment.go @@ -1,24 +1,24 @@ -package bmcs +package oci import ( "time" ) -// VNICAttachmentService enables communicating with the BMCS compute API's VNIC +// VNICAttachmentService enables communicating with the OCI compute API's VNIC // attachment endpoint. type VNICAttachmentService struct { client *baseClient } // NewVNICAttachmentService creates a new VNICAttachmentService for communicating with the -// BMCS compute API's instance related endpoints. +// OCI compute API's instance related endpoints. func NewVNICAttachmentService(s *baseClient) *VNICAttachmentService { return &VNICAttachmentService{ client: s.New().Path("vnicAttachments/"), } } -// VNICAttachment details the attachment of a VNIC to a BMCS instance. +// VNICAttachment details the attachment of a VNIC to a OCI instance. type VNICAttachment struct { AvailabilityDomain string `json:"availabilityDomain"` CompartmentID string `json:"compartmentId"` diff --git a/builder/oracle/bmcs/client/vnic_attachment_test.go b/builder/oracle/oci/client/vnic_attachment_test.go similarity index 98% rename from builder/oracle/bmcs/client/vnic_attachment_test.go rename to builder/oracle/oci/client/vnic_attachment_test.go index 6b14f6a1d..704423fb0 100644 --- a/builder/oracle/bmcs/client/vnic_attachment_test.go +++ b/builder/oracle/oci/client/vnic_attachment_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "fmt" diff --git a/builder/oracle/bmcs/client/vnic_test.go b/builder/oracle/oci/client/vnic_test.go similarity index 97% rename from builder/oracle/bmcs/client/vnic_test.go rename to builder/oracle/oci/client/vnic_test.go index 23ad6ca53..c208db5c4 100644 --- a/builder/oracle/bmcs/client/vnic_test.go +++ b/builder/oracle/oci/client/vnic_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "fmt" diff --git a/builder/oracle/bmcs/client/waiters.go b/builder/oracle/oci/client/waiters.go similarity index 99% rename from builder/oracle/bmcs/client/waiters.go rename to builder/oracle/oci/client/waiters.go index 1d1367725..bb9ca1c19 100644 --- a/builder/oracle/bmcs/client/waiters.go +++ b/builder/oracle/oci/client/waiters.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "fmt" diff --git a/builder/oracle/bmcs/client/waiters_test.go b/builder/oracle/oci/client/waiters_test.go similarity index 99% rename from builder/oracle/bmcs/client/waiters_test.go rename to builder/oracle/oci/client/waiters_test.go index e32354683..ce52b7922 100644 --- a/builder/oracle/bmcs/client/waiters_test.go +++ b/builder/oracle/oci/client/waiters_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "errors" diff --git a/builder/oracle/bmcs/config.go b/builder/oracle/oci/config.go similarity index 93% rename from builder/oracle/bmcs/config.go rename to builder/oracle/oci/config.go index 84ecf216b..883c61cb5 100644 --- a/builder/oracle/bmcs/config.go +++ b/builder/oracle/oci/config.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "errors" @@ -6,7 +6,7 @@ import ( "os" "path/filepath" - client "github.com/hashicorp/packer/builder/oracle/bmcs/client" + client "github.com/hashicorp/packer/builder/oracle/oci/client" "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/helper/communicator" "github.com/hashicorp/packer/helper/config" @@ -64,7 +64,7 @@ func NewConfig(raws ...interface{}) (*Config, error) { if c.AccessCfgFile != "" { accessCfgFile = c.AccessCfgFile } else { - accessCfgFile, err = getDefaultBMCSSettingsPath() + accessCfgFile, err = getDefaultOCISettingsPath() if err != nil { accessCfgFile = "" // Access cfg might be in template } @@ -198,15 +198,15 @@ func NewConfig(raws ...interface{}) (*Config, error) { return c, nil } -// getDefaultBMCSSettingsPath uses mitchellh/go-homedir to compute the default -// config file location. -func getDefaultBMCSSettingsPath() (string, error) { +// getDefaultOCISettingsPath uses mitchellh/go-homedir to compute the default +// config file location ($HOME/.oci/config). +func getDefaultOCISettingsPath() (string, error) { home, err := homedir.Dir() if err != nil { return "", err } - path := filepath.Join(home, ".oraclebmc", "config") + path := filepath.Join(home, ".oci", "config") if _, err := os.Stat(path); err != nil { return "", err } diff --git a/builder/oracle/bmcs/config_test.go b/builder/oracle/oci/config_test.go similarity index 98% rename from builder/oracle/bmcs/config_test.go rename to builder/oracle/oci/config_test.go index 4d85e87fb..bc6039a55 100644 --- a/builder/oracle/bmcs/config_test.go +++ b/builder/oracle/oci/config_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "io/ioutil" @@ -7,7 +7,7 @@ import ( "strings" "testing" - client "github.com/hashicorp/packer/builder/oracle/bmcs/client" + client "github.com/hashicorp/packer/builder/oracle/oci/client" ) func testConfig(accessConfFile *os.File) map[string]interface{} { diff --git a/builder/oracle/bmcs/driver.go b/builder/oracle/oci/driver.go similarity index 71% rename from builder/oracle/bmcs/driver.go rename to builder/oracle/oci/driver.go index 820c0b9d6..51f6c364a 100644 --- a/builder/oracle/bmcs/driver.go +++ b/builder/oracle/oci/driver.go @@ -1,10 +1,10 @@ -package bmcs +package oci import ( - client "github.com/hashicorp/packer/builder/oracle/bmcs/client" + client "github.com/hashicorp/packer/builder/oracle/oci/client" ) -// Driver interfaces between the builder steps and the BMCS SDK. +// Driver interfaces between the builder steps and the OCI SDK. type Driver interface { CreateInstance(publicKey string) (string, error) CreateImage(id string) (client.Image, error) diff --git a/builder/oracle/bmcs/driver_mock.go b/builder/oracle/oci/driver_mock.go similarity index 95% rename from builder/oracle/bmcs/driver_mock.go rename to builder/oracle/oci/driver_mock.go index 2931b035d..6173760fc 100644 --- a/builder/oracle/bmcs/driver_mock.go +++ b/builder/oracle/oci/driver_mock.go @@ -1,11 +1,11 @@ -package bmcs +package oci import ( - client "github.com/hashicorp/packer/builder/oracle/bmcs/client" + client "github.com/hashicorp/packer/builder/oracle/oci/client" ) // driverMock implements the Driver interface and communicates with Oracle -// BMCS. +// OCI. type driverMock struct { CreateInstanceID string CreateInstanceErr error diff --git a/builder/oracle/bmcs/driver_bmcs.go b/builder/oracle/oci/driver_oci.go similarity index 73% rename from builder/oracle/bmcs/driver_bmcs.go rename to builder/oracle/oci/driver_oci.go index 226b13cca..1d6f943c0 100644 --- a/builder/oracle/bmcs/driver_bmcs.go +++ b/builder/oracle/oci/driver_oci.go @@ -1,30 +1,30 @@ -package bmcs +package oci import ( "errors" "fmt" - client "github.com/hashicorp/packer/builder/oracle/bmcs/client" + client "github.com/hashicorp/packer/builder/oracle/oci/client" ) -// driverBMCS implements the Driver interface and communicates with Oracle -// BMCS. -type driverBMCS struct { +// driverOCI implements the Driver interface and communicates with Oracle +// OCI. +type driverOCI struct { client *client.Client cfg *Config } -// NewDriverBMCS Creates a new driverBMCS with a connected client. -func NewDriverBMCS(cfg *Config) (Driver, error) { +// NewDriverOCI Creates a new driverOCI with a connected client. +func NewDriverOCI(cfg *Config) (Driver, error) { client, err := client.NewClient(cfg.AccessCfg) if err != nil { return nil, err } - return &driverBMCS{client: client, cfg: cfg}, nil + return &driverOCI{client: client, cfg: cfg}, nil } // CreateInstance creates a new compute instance. -func (d *driverBMCS) CreateInstance(publicKey string) (string, error) { +func (d *driverOCI) CreateInstance(publicKey string) (string, error) { params := &client.LaunchInstanceParams{ AvailabilityDomain: d.cfg.AvailabilityDomain, CompartmentID: d.cfg.CompartmentID, @@ -44,7 +44,7 @@ func (d *driverBMCS) CreateInstance(publicKey string) (string, error) { } // CreateImage creates a new custom image. -func (d *driverBMCS) CreateImage(id string) (client.Image, error) { +func (d *driverOCI) CreateImage(id string) (client.Image, error) { params := &client.CreateImageParams{ CompartmentID: d.cfg.CompartmentID, InstanceID: id, @@ -59,12 +59,12 @@ func (d *driverBMCS) CreateImage(id string) (client.Image, error) { } // DeleteImage deletes a custom image. -func (d *driverBMCS) DeleteImage(id string) error { +func (d *driverOCI) DeleteImage(id string) error { return d.client.Compute.Images.Delete(&client.DeleteImageParams{ID: id}) } // GetInstanceIP returns the public IP corresponding to the given instance id. -func (d *driverBMCS) GetInstanceIP(id string) (string, error) { +func (d *driverOCI) GetInstanceIP(id string) (string, error) { // get nvic and cross ref to find pub ip address vnics, err := d.client.Compute.VNICAttachments.List( &client.ListVnicAttachmentsParams{ @@ -89,14 +89,14 @@ func (d *driverBMCS) GetInstanceIP(id string) (string, error) { } // TerminateInstance terminates a compute instance. -func (d *driverBMCS) TerminateInstance(id string) error { +func (d *driverOCI) TerminateInstance(id string) error { params := &client.TerminateInstanceParams{ID: id} return d.client.Compute.Instances.Terminate(params) } // WaitForImageCreation waits for a provisioning custom image to reach the // "AVAILABLE" state. -func (d *driverBMCS) WaitForImageCreation(id string) error { +func (d *driverOCI) WaitForImageCreation(id string) error { return client.NewWaiter().WaitForResourceToReachState( d.client.Compute.Images, id, @@ -107,7 +107,7 @@ func (d *driverBMCS) WaitForImageCreation(id string) error { // WaitForInstanceState waits for an instance to reach the a given terminal // state. -func (d *driverBMCS) WaitForInstanceState(id string, waitStates []string, terminalState string) error { +func (d *driverOCI) WaitForInstanceState(id string, waitStates []string, terminalState string) error { return client.NewWaiter().WaitForResourceToReachState( d.client.Compute.Instances, id, diff --git a/builder/oracle/bmcs/ssh.go b/builder/oracle/oci/ssh.go similarity index 98% rename from builder/oracle/bmcs/ssh.go rename to builder/oracle/oci/ssh.go index d12178a06..a9d62f4a4 100644 --- a/builder/oracle/bmcs/ssh.go +++ b/builder/oracle/oci/ssh.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "fmt" diff --git a/builder/oracle/bmcs/step_create_instance.go b/builder/oracle/oci/step_create_instance.go similarity index 99% rename from builder/oracle/bmcs/step_create_instance.go rename to builder/oracle/oci/step_create_instance.go index 8fec445cc..8650f7314 100644 --- a/builder/oracle/bmcs/step_create_instance.go +++ b/builder/oracle/oci/step_create_instance.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "fmt" diff --git a/builder/oracle/bmcs/step_create_instance_test.go b/builder/oracle/oci/step_create_instance_test.go similarity index 99% rename from builder/oracle/bmcs/step_create_instance_test.go rename to builder/oracle/oci/step_create_instance_test.go index 2f1fd62a2..558a17cb6 100644 --- a/builder/oracle/bmcs/step_create_instance_test.go +++ b/builder/oracle/oci/step_create_instance_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "errors" diff --git a/builder/oracle/bmcs/step_image.go b/builder/oracle/oci/step_image.go similarity index 98% rename from builder/oracle/bmcs/step_image.go rename to builder/oracle/oci/step_image.go index 889df1c53..07c9ddb4b 100644 --- a/builder/oracle/bmcs/step_image.go +++ b/builder/oracle/oci/step_image.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "fmt" diff --git a/builder/oracle/bmcs/step_image_test.go b/builder/oracle/oci/step_image_test.go similarity index 99% rename from builder/oracle/bmcs/step_image_test.go rename to builder/oracle/oci/step_image_test.go index db310a521..72399278c 100644 --- a/builder/oracle/bmcs/step_image_test.go +++ b/builder/oracle/oci/step_image_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "errors" diff --git a/builder/oracle/bmcs/step_instance_info.go b/builder/oracle/oci/step_instance_info.go similarity index 98% rename from builder/oracle/bmcs/step_instance_info.go rename to builder/oracle/oci/step_instance_info.go index 6188db653..310d8699c 100644 --- a/builder/oracle/bmcs/step_instance_info.go +++ b/builder/oracle/oci/step_instance_info.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "fmt" diff --git a/builder/oracle/bmcs/step_instance_info_test.go b/builder/oracle/oci/step_instance_info_test.go similarity index 98% rename from builder/oracle/bmcs/step_instance_info_test.go rename to builder/oracle/oci/step_instance_info_test.go index 7538a42c0..fdae8a0ef 100644 --- a/builder/oracle/bmcs/step_instance_info_test.go +++ b/builder/oracle/oci/step_instance_info_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "errors" diff --git a/builder/oracle/bmcs/step_ssh_key_pair.go b/builder/oracle/oci/step_ssh_key_pair.go similarity index 99% rename from builder/oracle/bmcs/step_ssh_key_pair.go rename to builder/oracle/oci/step_ssh_key_pair.go index 3f9293a0b..cc9d0358f 100644 --- a/builder/oracle/bmcs/step_ssh_key_pair.go +++ b/builder/oracle/oci/step_ssh_key_pair.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "crypto/rand" diff --git a/builder/oracle/bmcs/step_test.go b/builder/oracle/oci/step_test.go similarity index 93% rename from builder/oracle/bmcs/step_test.go rename to builder/oracle/oci/step_test.go index a5f5b3d1f..d4436e304 100644 --- a/builder/oracle/bmcs/step_test.go +++ b/builder/oracle/oci/step_test.go @@ -1,4 +1,4 @@ -package bmcs +package oci import ( "bytes" @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/packer/packer" "github.com/mitchellh/multistep" - client "github.com/hashicorp/packer/builder/oracle/bmcs/client" + client "github.com/hashicorp/packer/builder/oracle/oci/client" ) // TODO(apryde): It would be good not to have to write a key file to disk to diff --git a/command/plugin.go b/command/plugin.go index c77c183eb..11baf4729 100644 --- a/command/plugin.go +++ b/command/plugin.go @@ -31,7 +31,7 @@ import ( nullbuilder "github.com/hashicorp/packer/builder/null" oneandonebuilder "github.com/hashicorp/packer/builder/oneandone" openstackbuilder "github.com/hashicorp/packer/builder/openstack" - oraclebmcsbuilder "github.com/hashicorp/packer/builder/oracle/bmcs" + oracleocibuilder "github.com/hashicorp/packer/builder/oracle/oci" parallelsisobuilder "github.com/hashicorp/packer/builder/parallels/iso" parallelspvmbuilder "github.com/hashicorp/packer/builder/parallels/pvm" profitbricksbuilder "github.com/hashicorp/packer/builder/profitbricks" @@ -97,7 +97,7 @@ var Builders = map[string]packer.Builder{ "null": new(nullbuilder.Builder), "oneandone": new(oneandonebuilder.Builder), "openstack": new(openstackbuilder.Builder), - "oracle-bmcs": new(oraclebmcsbuilder.Builder), + "oracle-oci": new(oracleocibuilder.Builder), "parallels-iso": new(parallelsisobuilder.Builder), "parallels-pvm": new(parallelspvmbuilder.Builder), "profitbricks": new(profitbricksbuilder.Builder), diff --git a/website/source/docs/builders/oracle-bmcs.html.md b/website/source/docs/builders/oracle-oci.html.md similarity index 63% rename from website/source/docs/builders/oracle-bmcs.html.md rename to website/source/docs/builders/oracle-oci.html.md index 7bbd5df94..3503d4fca 100644 --- a/website/source/docs/builders/oracle-bmcs.html.md +++ b/website/source/docs/builders/oracle-oci.html.md @@ -1,23 +1,20 @@ --- description: - with Oracle Bare Metal Cloud Services (BMCS). The builder takes an - Oracle-provided base image, runs any provisioning necessary on the base image - after launching it, and finally snapshots it creating a reusable custom - image. + The oracle-oci builder is able to create new custom images for use with Oracle + Cloud Infrastructure (OCI). layout: docs -page_title: 'Oracle BMCS - Builders' -sidebar_current: 'docs-builders-oracle-bmcs' +page_title: 'Oracle OCI - Builders' +sidebar_current: 'docs-builders-oracle-oci' --- -# Oracle Bare Metal Cloud Services (BMCS) Builder +# Oracle Cloud Infrastructure (OCI) Builder -Type: `oracle-bmcs` +Type: `oracle-oci` -The `oracle-bmcs` Packer builder is able to create new custom images for use -with [Oracle Bare Metal Cloud Services](https://cloud.oracle.com/en_US/bare-metal-compute) -(BMCS). The builder takes an Oracle-provided base image, runs any provisioning -necessary on the base image after launching it, and finally snapshots it -creating a reusable custom image. +The `oracle-oci` Packer builder is able to create new custom images for use +with [Oracle Cloud Infrastructure](https://cloud.oracle.com) (OCI). The builder +takes a base image, runs any provisioning necessary on the base image after +launching it, and finally snapshots it creating a reusable custom image. It is recommended that you familiarise yourself with the [Key Concepts and Terminology](https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Concepts/concepts.htm) @@ -28,7 +25,7 @@ to use it or delete it. ## Authorization -The Oracle BMCS API requires that requests be signed with the RSA public key +The Oracle OCI API requires that requests be signed with the RSA public key associated with your [IAM](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm) user account. For a comprehensive example of how to configure the required authentication see the documentation on @@ -37,7 +34,7 @@ authentication see the documentation on ## Configuration Reference -There are many configuration options available for the `oracle-bmcs` builder. +There are many configuration options available for the `oracle-oci` builder. In addition to the options listed here, a [communicator](/docs/templates/communicator.html) can be configured for this builder. @@ -54,8 +51,7 @@ builder. [ListAvailabilityDomains](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/latest/AvailabilityDomain/ListAvailabilityDomains) operation, which is available in the IAM Service API. - - `base_image_ocid` (string) - The OCID of the - [Oracle-provided base image](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/images.htm) + - `base_image_ocid` (string) - The OCID of the [base image](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/images.htm) to use. This is the unique identifier of the image that will be used to launch a new instance and provision it. @@ -66,9 +62,9 @@ builder. - `compartment_ocid` (string) - The OCID of the [compartment](https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Tasks/choosingcompartments.htm) - - `fingerprint` (string) - Fingerprint for the BMCS API signing key. + - `fingerprint` (string) - Fingerprint for the OCI API signing key. Overrides value provided by the - [BMCS config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) + [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) if present. - `shape` (string) - The template that determines the number of @@ -94,37 +90,37 @@ builder. ### Optional - `access_cfg_file` (string) - The path to the - [BMCS config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm). - Defaults to `$HOME/.oraclebmc/config`. + [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm). + Defaults to `$HOME/.oci/config`. - `access_cfg_file_account` (string) - The specific account in the - [BMCS config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) + [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) to use. Defaults to `DEFAULT`. - `image_name` (string) - The name to assign to the resulting custom image. - - `key_file` (string) - Full path and filename of the BMCS API signing key. + - `key_file` (string) - Full path and filename of the OCI API signing key. Overrides value provided by the - [BMCS config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) + [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) if present. - - `pass_phrase` (string) - Pass phrase used to decrypt the BMCS API signing + - `pass_phrase` (string) - Pass phrase used to decrypt the OCI API signing key. Overrides value provided by the - [BMCS config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) + [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) if present. - - `region` (string) - An Oracle Bare Metal Cloud Services region. Overrides + - `region` (string) - An Oracle Cloud Infrastructure region. Overrides value provided by the - [BMCS config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) + [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) if present. - `tenancy_ocid` (string) - The OCID of your tenancy. Overrides value provided by the - [BMCS config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) + [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) if present. - - `user_ocid` (string) - The OCID of the user calling the BMCS API. Overrides - value provided by the [BMCS config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) + - `user_ocid` (string) - The OCID of the user calling the OCI API. Overrides + value provided by the [OCI config file](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) if present. @@ -142,6 +138,6 @@ substituted with the letter `a` and OCIDS have been shortened for brevity. "shape": "VM.Standard1.1", "ssh_username": "opc", "subnet_ocid": "ocid1.subnet.oc1..aaa", - "type": "oracle-bmcs" + "type": "oracle-oci" } ``` diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index a407697e8..133ebb3ac 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -122,8 +122,8 @@ > OpenStack - > - Oracle BMCS + > + Oracle OCI > Parallels