ibmcloud

package
v1.4.13 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 27 Imported by: 2 modules, 4 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIamAuthenticator

func NewIamAuthenticator(apiKey string) (*core.IamAuthenticator, error)

NewIamAuthenticator returns a new IamAuthenticator for using IBM Cloud services.

func Platform

func Platform() (*ibmcloud.Platform, error)

Platform collects IBM Cloud-specific configuration.

func Validate

func Validate(client API, ic *types.InstallConfig) error

Validate executes platform-specific validation.

func ValidatePreExistingPublicDNS

func ValidatePreExistingPublicDNS(client API, ic *types.InstallConfig, metadata *Metadata) error

ValidatePreExistingPublicDNS ensure no pre-existing DNS record exists in the CIS DNS zone for cluster's Kubernetes API.

Types

type API

type API interface {
	GetAPIKey() string
	GetAuthenticatorAPIKeyDetails(ctx context.Context) (*iamidentityv1.APIKey, error)
	GetCISInstance(ctx context.Context, crnstr string) (*resourcecontrollerv2.ResourceInstance, error)
	GetDNSInstance(ctx context.Context, crnstr string) (*resourcecontrollerv2.ResourceInstance, error)
	GetDNSInstancePermittedNetworks(ctx context.Context, dnsID string, dnsZone string) ([]string, error)
	GetDedicatedHostByName(ctx context.Context, name string, region string) (*vpcv1.DedicatedHost, error)
	GetDedicatedHostProfiles(ctx context.Context, region string) ([]vpcv1.DedicatedHostProfile, error)
	GetDNSRecordsByName(ctx context.Context, crnstr string, zoneID string, recordName string) ([]dnsrecordsv1.DnsrecordDetails, error)
	GetDNSZoneIDByName(ctx context.Context, name string, publish types.PublishingStrategy) (string, error)
	GetDNSZones(ctx context.Context, publish types.PublishingStrategy) ([]responses.DNSZoneResponse, error)
	GetEncryptionKey(ctx context.Context, keyCRN string) (*responses.EncryptionKeyResponse, error)
	GetResourceGroups(ctx context.Context) ([]resourcemanagerv2.ResourceGroup, error)
	GetResourceGroup(ctx context.Context, nameOrID string) (*resourcemanagerv2.ResourceGroup, error)
	GetSubnet(ctx context.Context, subnetID string) (*vpcv1.Subnet, error)
	GetSubnetByName(ctx context.Context, subnetName string, region string) (*vpcv1.Subnet, error)
	GetVSIProfiles(ctx context.Context) ([]vpcv1.InstanceProfile, error)
	GetVPC(ctx context.Context, vpcID string) (*vpcv1.VPC, error)
	GetVPCs(ctx context.Context, region string) ([]vpcv1.VPC, error)
	GetVPCByName(ctx context.Context, vpcName string) (*vpcv1.VPC, error)
	GetVPCZonesForRegion(ctx context.Context, region string) ([]string, error)
	SetVPCServiceURLForRegion(ctx context.Context, region string) error
}

API represents the calls made to the API.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client makes calls to the IBM Cloud API.

func NewClient

func NewClient() (*Client, error)

NewClient initializes a client with a session.

func (*Client) GetAPIKey

func (c *Client) GetAPIKey() string

GetAPIKey gets the API Key.

func (*Client) GetAuthenticatorAPIKeyDetails

func (c *Client) GetAuthenticatorAPIKeyDetails(ctx context.Context) (*iamidentityv1.APIKey, error)

GetAuthenticatorAPIKeyDetails gets detailed information on the API key used for authentication to the IBM Cloud APIs

func (*Client) GetCISInstance

func (c *Client) GetCISInstance(ctx context.Context, crnstr string) (*resourcecontrollerv2.ResourceInstance, error)

GetCISInstance gets a specific Cloud Internet Services by its CRN.

func (*Client) GetDNSInstance

func (c *Client) GetDNSInstance(ctx context.Context, crnstr string) (*resourcecontrollerv2.ResourceInstance, error)

GetDNSInstance gets a specific DNS Services instance by its CRN.

func (*Client) GetDNSInstancePermittedNetworks

func (c *Client) GetDNSInstancePermittedNetworks(ctx context.Context, dnsID string, dnsZone string) ([]string, error)

GetDNSInstancePermittedNetworks gets the permitted VPC networks for a DNS Services instance

func (*Client) GetDNSRecordsByName

func (c *Client) GetDNSRecordsByName(ctx context.Context, crnstr string, zoneID string, recordName string) ([]dnsrecordsv1.DnsrecordDetails, error)

GetDNSRecordsByName gets DNS records in specific Cloud Internet Services instance by its CRN, zone ID, and DNS record name.

func (*Client) GetDNSZoneIDByName

func (c *Client) GetDNSZoneIDByName(ctx context.Context, name string, publish types.PublishingStrategy) (string, error)

GetDNSZoneIDByName gets the DNS (Internal) or CIS zone ID from its domain name.

func (*Client) GetDNSZones

func (c *Client) GetDNSZones(ctx context.Context, publish types.PublishingStrategy) ([]responses.DNSZoneResponse, error)

GetDNSZones returns all of the active DNS zones managed by DNS or CIS.

func (*Client) GetDedicatedHostByName

func (c *Client) GetDedicatedHostByName(ctx context.Context, name string, region string) (*vpcv1.DedicatedHost, error)

GetDedicatedHostByName gets dedicated host by name.

func (*Client) GetDedicatedHostProfiles

func (c *Client) GetDedicatedHostProfiles(ctx context.Context, region string) ([]vpcv1.DedicatedHostProfile, error)

GetDedicatedHostProfiles gets a list of profiles supported in a region.

func (*Client) GetEncryptionKey

func (c *Client) GetEncryptionKey(ctx context.Context, keyCRN string) (*responses.EncryptionKeyResponse, error)

GetEncryptionKey gets data for an encryption key

func (*Client) GetResourceGroup

func (c *Client) GetResourceGroup(ctx context.Context, nameOrID string) (*resourcemanagerv2.ResourceGroup, error)

GetResourceGroup gets a resource group by its name or ID.

func (*Client) GetResourceGroups

func (c *Client) GetResourceGroups(ctx context.Context) ([]resourcemanagerv2.ResourceGroup, error)

GetResourceGroups gets the list of resource groups.

func (*Client) GetSubnet

func (c *Client) GetSubnet(ctx context.Context, subnetID string) (*vpcv1.Subnet, error)

GetSubnet gets a subnet by its ID.

func (*Client) GetSubnetByName

func (c *Client) GetSubnetByName(ctx context.Context, subnetName string, region string) (*vpcv1.Subnet, error)

GetSubnetByName gets a subnet by its Name.

func (*Client) GetVPC

func (c *Client) GetVPC(ctx context.Context, vpcID string) (*vpcv1.VPC, error)

GetVPC gets a VPC by its ID.

func (*Client) GetVPCByName

func (c *Client) GetVPCByName(ctx context.Context, vpcName string) (*vpcv1.VPC, error)

GetVPCByName gets a VPC by its name.

func (*Client) GetVPCZonesForRegion

func (c *Client) GetVPCZonesForRegion(ctx context.Context, region string) ([]string, error)

GetVPCZonesForRegion gets the supported zones for a VPC region.

func (*Client) GetVPCs

func (c *Client) GetVPCs(ctx context.Context, region string) ([]vpcv1.VPC, error)

GetVPCs gets all VPCs in a region

func (*Client) GetVSIProfiles

func (c *Client) GetVSIProfiles(ctx context.Context) ([]vpcv1.InstanceProfile, error)

GetVSIProfiles gets a list of all VSI profiles.

func (*Client) SetVPCServiceURLForRegion

func (c *Client) SetVPCServiceURLForRegion(ctx context.Context, region string) error

SetVPCServiceURLForRegion will set the VPC Service URL to a specific IBM Cloud Region, in order to access Region scoped resources

type DNSInstance

type DNSInstance struct {
	ID   string
	CRN  string
	Zone string
}

DNSInstance holds information for a DNS Services instance

type InstanceType

type InstanceType string

InstanceType is the IBM Cloud network services type being used

const (
	// CISInstanceType is a Cloud Internet Services InstanceType
	CISInstanceType InstanceType = "CIS"
	// DNSInstanceType is a DNS Services InstanceType
	DNSInstanceType InstanceType = "DNS"
)

type Metadata

type Metadata struct {
	BaseDomain              string
	ComputeSubnetNames      []string
	ControlPlaneSubnetNames []string
	Region                  string
	// contains filtered or unexported fields
}

Metadata holds additional metadata for InstallConfig resources that does not need to be user-supplied (e.g. because it can be retrieved from external APIs).

func NewMetadata

func NewMetadata(baseDomain string, region string, controlPlaneSubnets []string, computeSubnets []string) *Metadata

NewMetadata initializes a new Metadata object.

func (*Metadata) AccountID

func (m *Metadata) AccountID(ctx context.Context) (string, error)

AccountID returns the IBM Cloud account ID associated with the authentication credentials.

func (*Metadata) CISInstanceCRN

func (m *Metadata) CISInstanceCRN(ctx context.Context) (string, error)

CISInstanceCRN returns the Cloud Internet Services instance CRN that is managing the DNS zone for the base domain.

func (*Metadata) Client

func (m *Metadata) Client() (API, error)

Client returns a client used for making API calls to IBM Cloud services.

func (*Metadata) ComputeSubnets

func (m *Metadata) ComputeSubnets(ctx context.Context) (map[string]Subnet, error)

ComputeSubnets gets the Subnet details for compute subnets

func (*Metadata) ControlPlaneSubnets

func (m *Metadata) ControlPlaneSubnets(ctx context.Context) (map[string]Subnet, error)

ControlPlaneSubnets gets the Subnet details for control plane subnets

func (*Metadata) DNSInstance

func (m *Metadata) DNSInstance(ctx context.Context) (*DNSInstance, error)

DNSInstance returns a DNSInstance holding information about the DNS Services instance managing the DNS zone for the base domain.

func (*Metadata) IsVPCPermittedNetwork

func (m *Metadata) IsVPCPermittedNetwork(ctx context.Context, vpcName string) (bool, error)

IsVPCPermittedNetwork checks if the VPC is a Permitted Network for the DNS Zone

type Subnet

type Subnet struct {
	CIDR string
	CRN  string
	ID   string
	Name string
	VPC  string
	Zone string
}

Subnet represents an IBM Cloud VPC Subnet

type VPCResourceNotFoundError

type VPCResourceNotFoundError struct{}

VPCResourceNotFoundError represents an error for a VPC resoruce that is not found.

func (*VPCResourceNotFoundError) Error

func (e *VPCResourceNotFoundError) Error() string

Error returns the error message for the VPCResourceNotFoundError error type.

type Zone

type Zone struct {
	Name            string
	ID              string
	InstanceCRN     string
	ResourceGroupID string
}

Zone represents a DNS Zone

func GetDNSZone

func GetDNSZone() (*Zone, error)

GetDNSZone returns a DNS Zone chosen by survey.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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