core

package
v0.0.0-...-d7b82ac Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Client        *api.Client
	CompartmentID string
}

Client is a client for the core services API.

func NewClient

func NewClient(c *api.Client, compartmentID string) *Client

NewClient provides a Client interface for all Compute API calls

func (*Client) CreateSecurityList

func (c *Client) CreateSecurityList(securityList *SecurityList) (bool, *bmc.Error)

CreateSecurityList creates a new security list for the specified VCN

func (*Client) DeleteSecurityList

func (c *Client) DeleteSecurityList(securityListID string) (bool, *bmc.Error)

DeleteSecurityList deletes the specified security list, but only if it's not associated with a subnet

func (*Client) GetInstance

func (c *Client) GetInstance(instanceID string) (Instance, *bmc.Error)

GetInstance returns a struct of an instance request given an instance ID

func (*Client) GetSecurityList

func (c *Client) GetSecurityList(securityListID string) (SecurityList, *bmc.Error)

GetSecurityList returns a struct of a SecurityList request given an SecurityList ID

func (*Client) GetSubnet

func (c *Client) GetSubnet(subnetID string) (Subnet, *bmc.Error)

GetSubnet returns a struct of a Subnet request given an Subnet ID

func (*Client) GetVNic

func (c *Client) GetVNic(vnicID string) (VNic, *bmc.Error)

GetVNic returns a struct of a VNic request given an VNic ID

func (*Client) GetVNicAttachment

func (c *Client) GetVNicAttachment(vNicAttachmentID string) (VNicAttachment, *bmc.Error)

GetVNicAttachment returns a struct of a VNicAttachment request given an VNicAttachment ID

func (*Client) GetVcn

func (c *Client) GetVcn(vcnID string) (VCN, *bmc.Error)

GetVcn returns a struct of a VCN request given an VCN ID

func (*Client) ListInstances

func (c *Client) ListInstances(options *InstancesParameters) ([]Instance, *bmc.Error)

ListInstances returns a slice struct of all instance

func (*Client) ListSecurityLists

func (c *Client) ListSecurityLists(vcnID string) ([]SecurityList, *bmc.Error)

ListSecurityLists returns a slice struct of all securityList

func (*Client) ListSubnets

func (c *Client) ListSubnets() ([]Subnet, *bmc.Error)

ListSubnets returns a slice struct of all subnet

func (*Client) ListVNic

func (c *Client) ListVNic(instanceID string) []VNic

ListVNic returns all VNic associated with an instance ID

func (*Client) ListVNicAttachments

func (c *Client) ListVNicAttachments(instanceID string) ([]VNicAttachment, *bmc.Error)

ListVNicAttachments returns a slice struct of all instance

func (*Client) ListVcns

func (c *Client) ListVcns() ([]VCN, *bmc.Error)

ListVcns returns a slice struct of all vcn

func (*Client) Request

func (c *Client) Request(method string, reqURL string, body interface{}) (*http.Response, error)

Request builds the API endpoint given a URL and sends it to the API request

func (*Client) UpdateSecurityList

func (c *Client) UpdateSecurityList(securityListID string, securityListUpdate *SecurityListUpdate) (bool, *bmc.Error)

UpdateSecurityList creates a new security list for the specified VCN

type EgressSecurityRule

type EgressSecurityRule struct {
	Destination string      `json:"destination"`
	IcmpOptions *IcmpOption `json:"icmpOptions,omitempty"`
	IsStateless bool        `json:"isStateless,omitempty"`
	// Protocol values: all, ICMP ("1"), TCP ("6"), UDP ("17").
	Protocol   string      `json:"protocol"`
	TcpOptions *PortConfig `json:"tcpOptions,omitempty"`
	UdpOptions *PortConfig `json:"udpOptions,omitempty"`
}

EgressSecurityRule rule for allowing outbound IP packets

type IcmpOption

type IcmpOption struct {
	// The ICMP code
	Code int `json:"code,omitempty"`
	// The ICMP type
	Type int `json:"type,omitempty"`
}

type IngressSecurityRule

type IngressSecurityRule struct {
	Source      string      `json:"source"`
	IcmpOptions *IcmpOption `json:"icmpOptions,omitempty"`
	IsStateless bool        `json:"isStateless,omitempty"`
	// Protocol values: all, ICMP ("1"), TCP ("6"), UDP ("17").
	Protocol   string      `json:"protocol"`
	TcpOptions *PortConfig `json:"tcpOptions,omitempty"`
	UdpOptions *PortConfig `json:"udpOptions,omitempty"`
}

IngressSecurityRule rule for allowing inbound IP packets

type Instance

type Instance struct {
	// The Availability Domain the instance is running in
	AvailabilityDomain string `json:"availabilityDomain"`
	// The OCID of the compartment that contains the instance
	CompartmentID string `json:"compartmentId"`
	// A user-friendly name
	DisplayName string `json:"displayName"`
	// Additional metadata key/value pairs that you provide
	ExtendedMetadata *json.RawMessage
	// The OCID of the instance
	ID string `json:"id"`
	// The image used to boot the instance
	ImageID string `json:"imageId"`
	// iPXE script to continue the boot process.
	IpxeScript string `json:"ipxeScript"`
	// The current state of the instance.
	// PROVISIONING | RUNNING | STARTING |
	// STOPPING | STOPPED | CREATING_IMAGE | TERMINATING | TERMINATED
	LifeCycleState string `json:"lifecycleState"`
	// Custom metadata that you provide
	Metadata struct {
		PublicKey string `json:"ssh_authorized_keys"`
		UserData  string `json:"user_data"`
	} `json:"metadata"`
	// The region that contains the Availability Domain the instance is running in
	Region string `json:"region"`
	// The shape of the instance
	Shape string `json:"shape"`
	// The date and time the instance was created (RFC3339)
	TimeCreated string `json:"timeCreated"`
}

Instance contains the instance reference from: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Instance/

type InstanceFilter

type InstanceFilter struct {
	LifeCycleState string
	DisplayName    string
}

InstanceFilter creates a filter for the data (conditional AND) If filter is empty, everything is returned

type InstancesParameters

type InstancesParameters struct {
	AvailabilityDomain string `url:"availabilityDomain,omitempty"` //The name of the Availability Domain.
	DisplayName        string `url:"displayName,omitempty"`        //A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
	Limit              int    `url:"limit,omitempty"`              //The maximum number of items to return in a paginated "List" call.
	Page               string `url:"page,omitempty"`               //The value of the opc-next-page response header from the previous "List" call
	Filter             *InstanceFilter
}

InstancesParameters are optional parameters when listing instances

type PortConfig

type PortConfig struct {
	DestinationPortRange *PortRange `json:"destinationPortRange,omitempty"`
	SourcePortRange      *PortRange `json:"sourcePortRange,omitempty"`
}

type PortRange

type PortRange struct {
	Min int `json:"min,omitempty"`
	Max int `json:"max,omitempty"`
}

type SecurityList

type SecurityList struct {
	// The OCID of the compartment that contains the security list
	CompartmentID string `json:"compartmentId,omitempty"`
	// A user-friendly name
	DisplayName string `json:"displayName,omitempty"`
	// The OCID of the SecurityList
	ID string `json:"id,omitempty"`
	// Rules for allowing egress IP packets
	EgressSecurityRules *[]EgressSecurityRule `json:"egressSecurityRules"`
	// Rules for allowing ingress IP packets
	IngressSecurityRules *[]IngressSecurityRule `json:"ingressSecurityRules"`
	// The SecurityList's current state
	LifeCycleState string `json:"lifecycleState,omitempty"`
	// The date and time the instance was created (RFC3339)
	TimeCreated string `json:"timeCreated,omitempty"`
	// The OCID of the VCN
	VcnID string `json:"vcnId,omitempty"`
}

SecurityList contains the SecurityList reference from: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/SecurityList/

type SecurityListUpdate

type SecurityListUpdate struct {
	// A user-friendly name
	DisplayName string `json:"displayName,omitempty"`
	// Rules for allowing egress IP packets
	EgressSecurityRules *[]EgressSecurityRule `json:"egressSecurityRules"`
	// Rules for allowing ingress IP packets
	IngressSecurityRules *[]IngressSecurityRule `json:"ingressSecurityRules"`
}

type Subnet

type Subnet struct {
	// The subnet's Availability Domain
	AvailabilityDomain string `json:"availabilityDomain"`
	// The subnet's CIDR block
	CidrBlock string `json:"cidrBlock"`
	// The OCID of the compartment that contains the instance
	CompartmentID string `json:"compartmentId"`
	// A user-friendly name
	DisplayName string `json:"displayName"`
	// The OCID of the VNIC
	ID string `json:"id"`
	// The OCID of the set of DHCP options associated with the subnet
	DhcpOptionsID string `json:"dhcpOptionsId"`
	// Whether VNICs within this subnet can have public IP addresses
	ProhibitPublicIpOnVnic bool `json:"prohibitPublicIpOnVnic"`
	// The OCID of the route table the subnet is using
	RouteTableId string `json:"routeTableId"`
	// The Subnet's current state
	LifeCycleState string `json:"lifecycleState"`
	// A DNS label for the Subnet
	DNSlabel string `json:"dnsLabel"`
	// The date and time the instance was created (RFC3339)
	TimeCreated string `json:"timeCreated"`
	// OCIDs for the security lists to use for VNICs in this subnet
	SecurityListIDs []string `json:"securityListIds"`
	// The OCID of the VNIC
	VNicID string `json:"vnicId"`
	// The subnet's domain name
	SubnetDomainName string `json:"subnetDomainName"`
	// The IP address of the virtual router
	VirtualRouterIP string `json:"virtualRouterIp"`
	// The MAC address of the virtual router
	VirtualRouterMac string `json:"virtualRouterMac"`
}

Subnet contains the Subnet reference from: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Subnet/

type VCN

type VCN struct {
	// The Availability Domain the instance is running in
	CidrBlock string `json:"cidrBlock"`
	// The OCID of the compartment that contains the instance
	CompartmentID string `json:"compartmentId"`
	// A user-friendly name
	DisplayName string `json:"displayName"`
	// The OCID of the VNIC
	ID string `json:"id"`
	// The OCID for the VCN's default set of DHCP options
	DefaultDhcpOptionsID string `json:"defaultDhcpOptionsId"`
	// The OCID for the VCN's default route table
	DefaultRouteTableID string `json:"defaultRouteTableId"`
	// The OCID for the VCN's default security list
	DefaultSecurityListID string `json:"defaultSecurityListId"`
	// The VCN's current state
	LifeCycleState string `json:"lifecycleState"`
	// A DNS label for the VCN
	DNSlabel string `json:"dnsLabel"`
	// The date and time the instance was created (RFC3339)
	TimeCreated string `json:"timeCreated"`
	// The VCN's domain name
	VcnDomainName int `json:"vcnDomainName"`
	// The OCID of the VNIC
	VNicID string `json:"vnicId"`
}

VCN contains the VCN reference from: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Vcn/

type VNic

type VNic struct {
	// The Availability Domain the instance is running in
	AvailabilityDomain string `json:"availabilityDomain"`
	// The OCID of the compartment that contains the instance
	CompartmentID string `json:"compartmentId"`
	// A user-friendly name
	DisplayName string `json:"displayName"`
	// The hostname for the VNIC's primary private IP
	HostnameLabel string `json:"hostnameLabel"`
	// The OCID of the VNIC
	ID string `json:"id"`
	// Whether the VNIC is the primary VNIC
	Primary bool `json:"isPrimary"`
	// The current state of the instance.
	// PROVISIONING | AVAILABLE
	// TERMINATING | TERMINATED
	LifeCycleState string `json:"lifecycleState"`
	// The MAC address of the VNIC
	MacAddress string `json:"macAddress"`
	// The private IP address of the primary privateIp object on the VNIC
	PrivateIP string `json:"privateIp"`
	// The public IP address of the VNIC, if one is assigned.
	PublicIP string `json:"publicIp"`
	// Whether the source/destination check is disabled on the VNIC
	SrcDestCheck bool `json:"skipSourceDestCheck"`
	// The OCID of the subnet the VNIC is in
	SubnetID string `json:"subnetId"`
	// The date and time the instance was created (RFC3339)
	TimeCreated string `json:"timeCreated"`
}

VNic contains the VNIC reference from: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Vnic/

type VNicAttachment

type VNicAttachment struct {
	// The Availability Domain the instance is running in
	AvailabilityDomain string `json:"availabilityDomain"`
	// The OCID of the compartment that contains the instance
	CompartmentID string `json:"compartmentId"`
	// A user-friendly name
	DisplayName string `json:"displayName"`
	// The OCID of the VNIC
	ID string `json:"id"`
	// The OCID of the instance
	InstanceID string `json:"instanceId"`
	// The current state of the instance.
	// ATTACHING | ATTACHED
	// DETACHING | DETACHED
	LifeCycleState string `json:"lifecycleState"`
	// The OCID of the subnet the VNIC is in
	SubnetID string `json:"subnetId"`
	// The date and time the instance was created (RFC3339)
	TimeCreated string `json:"timeCreated"`
	// The Oracle-assigned VLAN tag of the attached VNIC
	VlanTag int `json:"vlanTag"`
	// The OCID of the VNIC
	VNicID string `json:"vnicId"`
}

VNicAttachment contains the VNICAttachement reference from: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VnicAttachment/

Jump to

Keyboard shortcuts

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