rubrik-sdk-for-go: github.com/rubrikinc/rubrik-sdk-for-go/rubrikcdm Index | Examples | Files

package rubrikcdm

import "github.com/rubrikinc/rubrik-sdk-for-go/rubrikcdm"

Package rubrikcdm transforms the Rubrik API functionality into easy to consume functions. This eliminates the need to understand how to consume raw Rubrik APIs with Go and extends upon one of Rubrik’s main design centers - simplicity. Rubrik’s API first architecture enables organizations to embrace and integrate Rubrik functionality into their existing automation processes.

Copyright 2018 Rubrik, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License prop

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Examples

Package Files

client.go cloud.go cluster.go data_management.go

type CloudObjectStore Uses

type CloudObjectStore struct {
    HasMore bool `json:"hasMore"`
    Data    []struct {
        ID         string `json:"id"`
        Definition struct {
            ObjectStoreType             string `json:"objectStoreType"`
            Name                        string `json:"name"`
            AccessKey                   string `json:"accessKey"`
            Bucket                      string `json:"bucket"`
            PemFileContent              string `json:"pemFileContent"`
            KmsMasterKeyID              string `json:"kmsMasterKeyId"`
            DefaultRegion               string `json:"defaultRegion"`
            Endpoint                    string `json:"endpoint"`
            NumBuckets                  int    `json:"numBuckets"`
            IsComputeEnabled            bool   `json:"isComputeEnabled"`
            IsConsolidationEnabled      bool   `json:"isConsolidationEnabled"`
            DefaultComputeNetworkConfig struct {
                SubnetID        string `json:"subnetId"`
                VNetID          string `json:"vNetId"`
                SecurityGroupID string `json:"securityGroupId"`
                ResourceGroupID string `json:"resourceGroupId"`
            }   `json:"defaultComputeNetworkConfig"`
            StorageClass        string `json:"storageClass"`
            AzureComputeSummary struct {
                TenantID                         string `json:"tenantId"`
                SubscriptionID                   string `json:"subscriptionId"`
                ClientID                         string `json:"clientId"`
                Region                           string `json:"region"`
                GeneralPurposeStorageAccountName string `json:"generalPurposeStorageAccountName"`
                ContainerName                    string `json:"containerName"`
                Environment                      string `json:"environment"`
            }   `json:"azureComputeSummary"`
        }   `json:"definition"`
        GlacierStatus struct {
            RetrievalTier   string `json:"retrievalTier"`
            VaultLockStatus struct {
                FileLockPeriodInDays int       `json:"fileLockPeriodInDays"`
                Status               string    `json:"status"`
                ExpiryTime           time.Time `json:"expiryTime"`
            }   `json:"vaultLockStatus"`
        }   `json:"glacierStatus"`
        ArchivalProxySummary struct {
            Protocol    string `json:"protocol"`
            ProxyServer string `json:"proxyServer"`
            PortNumber  int    `json:"portNumber"`
            UserName    string `json:"userName"`
        }   `json:"archivalProxySummary"`
        ComputeProxySummary struct {
            Protocol    string `json:"protocol"`
            ProxyServer string `json:"proxyServer"`
            PortNumber  int    `json:"portNumber"`
            UserName    string `json:"userName"`
        }   `json:"computeProxySummary"`
        ReaderLocationSummary struct {
            State         string    `json:"state"`
            RefreshedTime time.Time `json:"refreshedTime"`
        }   `json:"readerLocationSummary"`
    }   `json:"data"`
    Total int `json:"total"`
}

CloudObjectStore represents the JSON response for GET /internal/archive/object_store

type CloudOn Uses

type CloudOn struct {
    ID         string `json:"id"`
    Definition struct {
        ObjectStoreType             string `json:"objectStoreType"`
        Name                        string `json:"name"`
        AccessKey                   string `json:"accessKey"`
        Bucket                      string `json:"bucket"`
        PemFileContent              string `json:"pemFileContent"`
        KmsMasterKeyID              string `json:"kmsMasterKeyId"`
        DefaultRegion               string `json:"defaultRegion"`
        Endpoint                    string `json:"endpoint"`
        NumBuckets                  int    `json:"numBuckets"`
        IsComputeEnabled            bool   `json:"isComputeEnabled"`
        IsConsolidationEnabled      bool   `json:"isConsolidationEnabled"`
        DefaultComputeNetworkConfig struct {
            SubnetID        string `json:"subnetId"`
            VNetID          string `json:"vNetId"`
            SecurityGroupID string `json:"securityGroupId"`
            ResourceGroupID string `json:"resourceGroupId"`
        }   `json:"defaultComputeNetworkConfig"`
        StorageClass        string `json:"storageClass"`
        AzureComputeSummary struct {
            TenantID                         string `json:"tenantId"`
            SubscriptionID                   string `json:"subscriptionId"`
            ClientID                         string `json:"clientId"`
            Region                           string `json:"region"`
            GeneralPurposeStorageAccountName string `json:"generalPurposeStorageAccountName"`
            ContainerName                    string `json:"containerName"`
            Environment                      string `json:"environment"`
        }   `json:"azureComputeSummary"`
    }   `json:"definition"`
    GlacierStatus struct {
        RetrievalTier   string `json:"retrievalTier"`
        VaultLockStatus struct {
            FileLockPeriodInDays int    `json:"fileLockPeriodInDays"`
            Status               string `json:"status"`
            ExpiryTime           string `json:"expiryTime"`
        }   `json:"vaultLockStatus"`
    }   `json:"glacierStatus"`
    ArchivalProxySummary struct {
        Protocol    string `json:"protocol"`
        ProxyServer string `json:"proxyServer"`
        PortNumber  int    `json:"portNumber"`
        UserName    string `json:"userName"`
    }   `json:"archivalProxySummary"`
    ComputeProxySummary struct {
        Protocol    string `json:"protocol"`
        ProxyServer string `json:"proxyServer"`
        PortNumber  int    `json:"portNumber"`
        UserName    string `json:"userName"`
    }   `json:"computeProxySummary"`
    ReaderLocationSummary struct {
        State         string `json:"state"`
        RefreshedTime string `json:"refreshedTime"`
    }   `json:"readerLocationSummary"`
}

CloudOn represents the JSON response for PATCH /internal/archive/object_store/{id}

type ClusterProperties Uses

type ClusterProperties struct {
    ID         string `json:"id"`
    Version    string `json:"version"`
    APIVersion string `json:"apiVersion"`
    Name       string `json:"name"`
    Timezone   struct {
        Timezone string `json:"timezone"`
    }   `json:"timezone"`
    Geolocation struct {
        Address string `json:"address"`
    }   `json:"geolocation"`
    AcceptedEulaVersion string `json:"acceptedEulaVersion"`
    LatestEulaVersion   string `json:"latestEulaVersion"`
}

ClusterProperties corresponds to PATCH /v1/cluster/{id}

type ClusterVersion Uses

type ClusterVersion struct {
    Version string `json:"version"`
}

ClusterVersion corresponds to /v1/cluster/me/version

type Credentials Uses

type Credentials struct {
    NodeIP   string
    Username string
    Password string
}

Credentials contains the parameters used to authenticate against the Rubrik cluster and can be consumed through ConnectEnv() or Connect().

func Connect Uses

func Connect(nodeIP, username, password string) *Credentials

Connect initializes a new API client based on manually provided Rubrik cluster credentials. When possible, the Rubrik credentials should not be stored as plain text in your .go file. ConnectEnv() can be used as a safer alternative.

func ConnectEnv Uses

func ConnectEnv() (*Credentials, error)

ConnectEnv is the preferred method to initialize a new API client by attempting to read the following environment variables:

rubrik_cdm_node_ip

rubrik_cdm_username

rubrik_cdm_password

func (*Credentials) AWSAccountSummary Uses

func (c *Credentials) AWSAccountSummary(awsAccountName string, timeout ...int) (*CurrentAWSAccountID, error)

AWSAccountSummary retrives all information from an AWS Native Account.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

awasAccountName := "Go SDK"

awsSummary, err := rubrik.AWSAccountSummary(awasAccountName)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) AWSS3CloudOn Uses

func (c *Credentials) AWSS3CloudOn(archiveName, vpcID, subnetID, securityGroupID string, timeout ...int) (*CloudOn, error)

AWSS3CloudOn provides the ability to convert a vSphere virtual machines snapshot, an archived snapshot, or a replica into an Amazon Machine Image (AMI) and then launch that AMI into an Elastic Compute Cloud (EC2) instance on an Amazon Virtual Private Cloud (VPC).

The function will return one of the following:

- No change required. The '{archiveName}' archive location is already configured for CloudOn.

- The full API response for PATCH /internal/archive/object_store.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

archiveName := "AWS:S3:GoSDK"
vpcID := "vpc-28e32931"
subnetID := "subnet-3ae87e92"
securityGroupID := "sg-9ba32ff8"

awsCloudOn, err := rubrik.AWSS3CloudOn(archiveName, vpcID, subnetID, securityGroupID)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) AWSS3CloudOutKMS Uses

func (c *Credentials) AWSS3CloudOutKMS(awsBucketName, storageClass, archiveName, awsRegion, awsAccessKey, awsSecretKey, kmsMasterKeyID string, timeout ...int) (interface{}, error)

AWSS3CloudOutKMS configures a new AWS S3 archive target using a AWS KMS Master Key ID for encryption.

Valid "awsRegion" choices are:

ap-south-1,ap-northeast-3, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-northeast-1, ca-central-1, cn-north-1, cn-northwest-1, eu-central-1, eu-west-1,
eu-west-2, eu-west-3, us-west-1, us-east-1, us-east-2, and us-west-2.

Valid "storageClass" choices are:

standard, standard_ia, and reduced_redundancy

The function will return one of the following:

- No change required. The '{archiveName}' archive location is already configured on the Rubrik cluster.

- The full API response for POST /internal/archive/object_store/{archiveID}

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

awsBucket := "rubrikgosdk"
storageClass := "standard"
archiveName := "AWS:S3:GoSDK"
awsRegion := "us-east-1"
awsAccessKey := os.Getenv("AWS_ACCESS_KEY_ID")
awsSecretKey := os.Getenv("AWS_SECRET_ACCESS_KEY")
kmsMasterKeyID := os.Getenv("AWS_MASTER_KEY_ID")

awsCloudOut, err := rubrik.AWSS3CloudOutKMS(awsBucket, storageClass, archiveName, awsRegion, awsAccessKey, awsSecretKey, kmsMasterKeyID)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) AWSS3CloudOutRSA Uses

func (c *Credentials) AWSS3CloudOutRSA(awsBucketName, storageClass, archiveName, awsRegion, awsAccessKey, awsSecretKey, rsaKey string, timeout ...int) (interface{}, error)

AWSS3CloudOutRSA configures a new AWS S3 archive target using a RSA Key for encryption.

Valid "awsRegion" choices are:

ap-south-1,ap-northeast-3, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-northeast-1, ca-central-1, cn-north-1, cn-northwest-1, eu-central-1, eu-west-1,
eu-west-2, eu-west-3, us-west-1, us-east-1, us-east-2, and us-west-2.

Valid "storageClass" choices are:

standard, standard_ia, and reduced_redundancy

The function will return one of the following:

- No change required. The '{archiveName}' archive location is already configured on the Rubrik cluster.

- The full API response for POST /internal/archive/object_store.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

awsBucket := "rubrikgosdk"
storageClass := "standard"
archiveName := "AWS:S3:GoSDK"
awsRegion := "us-east-1"
awsAccessKey := os.Getenv("AWS_ACCESS_KEY_ID")
awsSecretKey := os.Getenv("AWS_SECRET_ACCESS_KEY")
readRSAKey, _ := ioutil.ReadFile("rsa_key.pem")
rsaKey := string(readRSAKey)

awsCloudOut, err := rubrik.AWSS3CloudOutRSA(awsBucket, storageClass, archiveName, awsRegion, awsAccessKey, awsSecretKey, rsaKey)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) AddAWSNativeAccount Uses

func (c *Credentials) AddAWSNativeAccount(awsAccountName, awsAccessKey, awsSecretKey string, awsRegions []string, regionalBoltNetworkConfigs interface{}, timeout ...int) (interface{}, error)

AddAWSNativeAccount enables the management and protection of Amazon Elastic Compute Cloud (Amazon EC2) instances. The "regionalBoltNetworkConfigs" should be a list of dictionaries in the following format:

usEast1 := map[string]string{}
usEast1["region"] = "us-east-1"
usEast1["region"] = "us-east-1"
usEast1["region"] = "us-east-1"
usEast1["vNetId"] = "vpc-11a44968"
usEast1["subnetId"] = "subnet-3ac58e06"
usEast1["securityGroupId"] = "sg-9ba90ee5"

regionalBoltNetworkConfigs := []interface{}{usEast1}

Valid "awsRegion" choices are:

ap-south-1,ap-northeast-3, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-northeast-1, ca-central-1, cn-north-1, cn-northwest-1, eu-central-1, eu-west-1,
eu-west-2, eu-west-3, us-west-1, us-east-1, us-east-2, and us-west-2.

The function will return one of the following:

No change required. Cloud native source with access key '{awsAccessKey}' is already configured on the Rubrik cluster.

//

The full API response for POST /internal/aws/account.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

awsAccountName := "GO SDK Demo" // This is the name that will be displayed in the Rubrik UI
awsAccessKey := os.Getenv("AWS_ACCESS_KEY_ID")
awsSecretKey := os.Getenv("AWS_SECRET_ACCESS_KEY")
awsRegions := []string{"us-east-1"}

usEast1 := map[string]string{}
usEast1["region"] = "us-east-1"
usEast1["vNetId"] = "vpc-11a44968"
usEast1["subnetId"] = "subnet-3ac58e06"
usEast1["securityGroupId"] = "sg-9ba90ee5"
boltConfig := []interface{}{usEast1}

addAWSNative, err := rubrik.AddAWSNativeAccount(awsAccountName, awsAccessKey, awsSecretKey, awsRegions, boltConfig)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) AddvCenter Uses

func (c *Credentials) AddvCenter(vCenterIP, vCenterUsername, vCenterPassword string, vmLinking bool, timeout ...int) (interface{}, error)

AddvCenter connects to the Rubrik cluster to a new vCenter instance.

The function will return one of the following:

No change required. The vCenter '{vcenterIP}' has already been added to the Rubrik cluster.

The full API response for POST /v1/VMware/vcenter

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

vCenterIP := "demogosdk.lab"
vCenterUsername := "go"
vCenterPassword := "sdk"
vmLinking := true

addVcenter, err := rubrik.AddvCenter(vCenterIP, vCenterUsername, vCenterPassword, vmLinking)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) AddvCenterWithCert Uses

func (c *Credentials) AddvCenterWithCert(vCenterIP, vCenterUsername, vCenterPassword, caCertificate string, vmLinking bool, timeout ...int) (interface{}, error)

AddvCenterWithCert connects to the Rubrik cluster to a new vCenter instance using a CA certificate.

The function will return one of the following:

No change required. The vCenter '{vcenterIP}' has already been added to the Rubrik cluster.

The full API response for POST /v1/VMware/vcenter

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

vCenterIP := "demogosdk.lab"
vCenterUsername := "go"
vCenterPassword := "sdk"
readcaCertificate, _ := ioutil.ReadFile("ca_cert")
caCert := string(readcaCertificate)
vmLinking := true

addVcenterWithCert, err := rubrik.AddvCenterWithCert(vCenterIP, vCenterUsername, vCenterPassword, caCert, vmLinking)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) AssignSLA Uses

func (c *Credentials) AssignSLA(objectName, objectType, slaName string, timeout ...int) (*StatusCode, error)

AssignSLA adds the "objectName" to the "slaName". vmware is currently the only supported "objectType". To exclude the object from all SLA assignments use "do not protect" as the "slaName". To assign the selected object to the SLA of the next higher level object, use "clear" as the "slaName".

The function will return one of the following:

No change required. The vSphere VM '{objectName}' is already assigned to the '{slaName}' SLA Domain.

The full API response for POST /internal/sla_domain/{slaID}/assign.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

objectName := "vm01"
slaName := "Bronze"

assignSLA, err := rubrik.AssignSLA(objectName, "VMware", slaName)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) AzureCloudOn Uses

func (c *Credentials) AzureCloudOn(archiveName, container, storageAccountName, applicationID, applicationKey, directoryID, region, virtualNetworkID, subnetName, securityGroupID string, timeout ...int) (*CloudOn, error)

AzureCloudOn provides the ability to convert a snapshot, archived snapshot, or replica into a Virtual Hard Disk (VHD). This enables the instantiation of the associated virtual machine on the Microsoft Azure cloud platform.

Valid "region" choices are:

westus, westus2, centralus, eastus, eastus2, northcentralus, southcentralus, westcentralus, canadacentral, canadaeast, brazilsouth,
northeurope, westeurope, uksouth, ukwest, eastasia, southeastasia, japaneast, japanwest, australiaeast, australiasoutheast, centralindia,
southindia, westindia, koreacentral, koreasouth

The function will return one of the following:

- No change required. The '{archiveName}' archive location is already configured for CloudOn.

- The full API response for PATCH /internal/archive/object_store.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

archiveName := "Azure:GoSDK"
container := "gosdk"
storageAccountName := "rubrikgosdk"
applicationID := os.Getenv("AZURE_APP_ID")
applicationKey := os.Getenv("AZURE_APP_KEY")

directoryID := os.Getenv("AZURE_DIRECTORTY_ID")
region := "westus2"
virtualNetworkID := os.Getenv("AZURE_VNET_ID")
subnetName := os.Getenv("AZURE_SUBNET")
securityGroupID := os.Getenv("AZURE_SECURITY_GROUP")

azureCloudOn, err := rubrik.AzureCloudOn(archiveName, container, storageAccountName, applicationID, applicationKey, directoryID, region, virtualNetworkID, subnetName, securityGroupID)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) AzureCloudOut Uses

func (c *Credentials) AzureCloudOut(container, azureAccessKey, storageAccountName, archiveName, instanceType, rsaKey string, timeout ...int) (interface{}, error)

AzureCloudOut configures a new Azure archive target.

Valid "instanceType" choices are:

default, china, germany, and government

The function will return one of the following:

- No change required. The '{archiveName}' archive location is already configured on the Rubrik cluster.

- The full API response for POST /internal/archive/object_store.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

container := "gosdk"
azureAccessKey := os.Getenv("AZURE_ACCESS_KEY")
storageAccountName := "rubrikgosdk"
archiveName := "Azure:gosdk"
instanceType := "default"
readRSAKey, _ := ioutil.ReadFile("rsa_key.pem")
rsaKey := string(readRSAKey)

azureCloudOut, err := rubrik.AzureCloudOut(container, azureAccessKey, storageAccountName, archiveName, instanceType, rsaKey)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) BeginManagedVolumeSnapshot Uses

func (c *Credentials) BeginManagedVolumeSnapshot(name string, timeout ...int) (*StatusCode, error)

BeginManagedVolumeSnapshot opens a managed volume for writes. All writes to the managed volume until the snapshot is ended will be part of its snapshot.

The function will return one of the following:

No change required. The Managed Volume '{name}' is already in a writeable state.

The full API response for POST /internal/managed_volume/{managedVolumeID}/begin_snapshot

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

mvName := "GoSDK"

beginMV, err := rubrik.BeginManagedVolumeSnapshot(mvName)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) Bootstrap Uses

func (c *Credentials) Bootstrap(clusterName, adminEmail, adminPassword, managementGateway, managementSubnetMask string, dnsSearchDomains, dnsNameServers, ntpServers []string, nodeConfig map[string]string, enableEncryption, waitForCompletion bool, timeout ...int) (interface{}, error)

Bootstrap will complete the bootstrap process for a Rubrik cluster and requires a single node to have it's management interface configured. You will also need to use Connect() with the "username" and "password" set to blank strings. The "nodeConfig" should be in a {nodeName: nodeManagementIP} format. To monitor the bootstrap process and wait for the process to complete, set "waitForCompletion" to true.

The function will return one of the following:

The full API response for POST /internal/cluster/me/bootstrap?request_id={requestID} (waitForCompletion is set to true)

The full API response for POST /internal/cluster/me/bootstrap (waitForCompletion is set to false)

Code:


bootstrapNode := "10.77.16.239"
rubrik := rubrikcdm.Connect(bootstrapNode, "", "")

clusterName := "Go-SDK"
adminEmail := "gosdk@rubrik.com"
adminPassword := "RubrikGoSDK"
managementGateway := "10.77.16.1"
managementSubnetMask := "255.255.252.0"
dnsSearchDomain := []string{"gosdk.lab"}
dnsNameServers := []string{}
ntpServers := []string{"192.21.10.21", "192.21.10.22"}
enableEncryption := true // set to false for a Cloud Cluster
waitForCompletion := true

nodeConfig := map[string]string{}
nodeConfig["RVM157S018901"] = bootstrapNode
nodeConfig["RVM157S018902"] = "10.77.16.56"
nodeConfig["RVM157S018903"] = "10.77.16.198"
nodeConfig["RVM157S018904"] = "10.77.16.81"

bootstrap, err := rubrik.Bootstrap(clusterName, adminEmail, adminPassword, managementGateway, managementSubnetMask, dnsSearchDomain, dnsNameServers, ntpServers, nodeConfig, enableEncryption, waitForCompletion)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) CloudObjectStore Uses

func (c *Credentials) CloudObjectStore(timeout ...int) (*CloudObjectStore, error)

CloudObjectStore retrieves all archive locations configured on the Rubik cluster.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

archiveLocations, err := rubrik.CloudObjectStore()
if err != nil {
    log.Fatal(err)
}

func (*Credentials) ClusterBootstrapStatus Uses

func (c *Credentials) ClusterBootstrapStatus(timeout ...int) (bool, error)

ClusterBootstrapStatus checks whether the cluster has been bootstrapped.

func (*Credentials) ClusterNodeIP Uses

func (c *Credentials) ClusterNodeIP(timeout ...int) ([]string, error)

ClusterNodeIP returns all Node IPs in the Rubrik cluster.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

clusterVersion, err := rubrik.ClusterNodeIP()
if err != nil {
    log.Fatal(err)
}

func (*Credentials) ClusterNodeName Uses

func (c *Credentials) ClusterNodeName(timeout ...int) ([]string, error)

ClusterNodeName returns the name of all nodes in the Rubrik cluster.

func (*Credentials) ClusterVersion Uses

func (c *Credentials) ClusterVersion(timeout ...int) (string, error)

ClusterVersion returns the CDM version of the Rubrik cluster.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

clusterVersion, err := rubrik.ClusterVersion()
if err != nil {
    log.Fatal(err)
}

func (*Credentials) ClusterVersionCheck Uses

func (c *Credentials) ClusterVersionCheck(clusterVersion float64, timeout ...int) error

ClusterVersionCheck is used to determine if the Rubrik cluster is using running an earlier release than the provided CDM "clusterVersion". If the CDM version is an earlier release than the "clusterVersion", the following message error message is thrown: Error: The Rubrik cluster must be running CDM version {clusterVersion} or later.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

clusterVersion := rubrik.ClusterVersionCheck(4.2)
if clusterVersion != nil {
    log.Fatal(err)
}

func (*Credentials) ConfigureDNSServers Uses

func (c *Credentials) ConfigureDNSServers(serverIP []string, timeout ...int) (*StatusCode, error)

ConfigureDNSServers provides the connection information for the DNS Servers used by the Rubrik cluster.

The function will return one of the following:

No change required. The Rubrik cluster is already configured with the provided DNS servers.

The full API response for POST /internal/cluster/me/dns_nameserver

Code:

rubrik, err := rubrikcdm.ConnectEnv()

dnsServers := []string{"192.21.10.50", "192.21.10.51"}

dnsConfig, err := rubrik.ConfigureDNSServers(dnsServers)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) ConfigureNTP Uses

func (c *Credentials) ConfigureNTP(ntpServers []string, timeout ...int) (*StatusCode, error)

ConfigureNTP provides the connection information for the NTP servers used for time synchronization.

The function will return one of the following:

No change required. The NTP server(s) {ntpServers} has already been added to the Rubrik cluster.

The full API response for POST /internal/cluster/me/ntp_server

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

ntpServers := []string{"192.21.10.21", "192.21.10.22"}

ntp, err := rubrik.ConfigureNTP(ntpServers)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) ConfigureSMTPSettings Uses

func (c *Credentials) ConfigureSMTPSettings(hostname, fromEmail, smtpUsername, smtpPassword, encryption string, port int, timeout ...int) (*SMTP, error)

ConfigureSMTPSettings provides the connection information to send notification email messages for delivery to the administrator accounts.

Valid encryption choices are:

NONE, SSL, and STARTTLS

The function will return one of the following:

No change required. The Rubrik cluster is already configured with the provided SMTP settings.

The full API response for POST /internal/smtp_instance

The full API response for PATCH /smtp_instance/{smtpID}

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

hostname := "smtp.GOSDK.lab"
port := 100
fromEmail := "gosdk@rubrik.com"
username := "go"
password := "sdk"
encryption := "NONE"

smtpConfig, err := rubrik.ConfigureSMTPSettings(hostname, fromEmail, username, password, encryption, port)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) ConfigureSearchDomain Uses

func (c *Credentials) ConfigureSearchDomain(searchDomain []string, timeout ...int) (*StatusCode, error)

ConfigureSearchDomain provides the connection information for the DNS search domains used by the Rubrik cluster.

The function will return one of the following:

No change required. The Rubrik cluster is already configured with the provided DNS search domains.

The full API response for POST /internal/cluster/me/dns_search_domain

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

searchDomains := []string{"gosdk.lab"}

searchDomainConfig, err := rubrik.ConfigureSearchDomain(searchDomains)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) ConfigureSyslog Uses

func (c *Credentials) ConfigureSyslog(syslogIP, protocol string, port float64, timeout ...int) (*Syslog, error)

ConfigureSyslog enables the Rubrik cluster to send syslog server messages that are based on the events that also appear in the Activity Log to the provided Syslog Server.

Valid protocol choices are:

UDP, TCP

The function will return one of the following:

No change required. The Rubrik cluster is already configured to use the syslog server '{syslogIP}' on port '{port}' using the '{protocol}' protocol.

The full API response for POST /internal/syslog

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

syslogIP := "192.21.11.29"
syslogProtocol := "UDP"
syslogPort := 514

syslog, err := rubrik.ConfigureSyslog(syslogIP, syslogProtocol, syslogPort)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) ConfigureTimezone Uses

func (c *Credentials) ConfigureTimezone(timezone string, timeout ...int) (*ClusterProperties, error)

ConfigureTimezone provides the ability to set the time zone that is used by the Rubrik cluster which uses the specified time zone for time values in the web UI, all reports, SLA Domain settings, and all other time related operations.

Valid timezone choices are:

America/Anchorage, America/Araguaina, America/Barbados, America/Chicago, America/Denver, America/Los_Angeles America/Mexico_City, America/New_York,
America/Noronha, America/Phoenix, America/Toronto, America/Vancouver, Asia/Bangkok, Asia/Dhaka, Asia/Dubai, Asia/Hong_Kong, Asia/Karachi, Asia/Kathmandu,
Asia/Kolkata, Asia/Magadan, Asia/Singapore, Asia/Tokyo, Atlantic/Cape_Verde, Australia/Perth, Australia/Sydney, Europe/Amsterdam, Europe/Athens,
Europe/London, Europe/Moscow, Pacific/Auckland, Pacific/Honolulu, Pacific/Midway, or UTC.

The function will return one of the following:

No change required. The Rubrik cluster is already configured with '{timezone}' as it's timezone.

The full API response for POST /v1/cluster/me

Code:

rubrik, err := rubrikcdm.ConnectEnv()

confTimezone, err := rubrik.ConfigureTimezone("America/Los_Angeles")
if err != nil {
    log.Fatal(err)
}

func (*Credentials) ConfigureVLAN Uses

func (c *Credentials) ConfigureVLAN(netmask string, vlan int, ips map[string]string, timeout ...int) (*StatusCode, error)

ConfigureVLAN provides the VLAN VLAN tagging information which is an optional feature that allows a Rubrik cluster to efficiently switch network traffic using Virtual Local Area Networks. The ips map should be in a {nodeName:IP} format.

The function will return one of the following:

No change required. The Rubrik cluster is already configured with the provided VLAN information.

The full API response for POST /internal/cluster/me/vlan

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

vlanIPs := map[string]string{}
vlanIPs["RVM157S018901"] = "192.168.100.100"
vlanIPs["RVM157S018902"] = "192.168.100.101"
vlanIPs["RVM157S018903"] = "192.168.100.102"
vlanIPs["RVM157S0189014"] = "192.168.100.103"

vlan := 100
netmask := "255.255.255.0"

configVLAN, err := rubrik.ConfigureVLAN(netmask, vlan, vlanIPs)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) Delete Uses

func (c *Credentials) Delete(apiVersion, apiEndpoint string, timeout ...int) (interface{}, error)

Delete sends a DELETE request to the provided Rubrik API endpoint and returns the full API response. Supported "apiVersions" are v1, v2, and internal. The optional timeout value corresponds to the number of seconds to wait to establish a connection to the Rubrik cluster before returning a timeout error. If no value is provided, a default of 15 seconds will be used.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

deleteSLA, err := rubrik.Delete("v1", "/sla_domain/388a473c-3361-42ab-8f5b-08edb76891f6")
if err != nil {
    log.Fatal(err)
}

func (*Credentials) EndManagedVolumeSnapshot Uses

func (c *Credentials) EndManagedVolumeSnapshot(name, slaName string, timeout ...int) (*EndManagedVolumeSnapshot, error)

EndManagedVolumeSnapshot closes a managed volume for writes. A snapshot will be created containing all writes since the last begin snapshot call.

The function will return one of the following:

No change required. The Managed Volume '{name}' is already in a read-only state.

The full API response for POST /internal/managed_volume/{managedVolumeID}/end_snapshot

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

mvName := "GoSDK"
slaName := "Gold"

endMV, err := rubrik.EndManagedVolumeSnapshot(mvName, slaName)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) EndUserAuthorization Uses

func (c *Credentials) EndUserAuthorization(objectName, endUser, objectType string, timeout ...int) (*EndUserAuthorization, error)

EndUserAuthorization assigns an End User account privileges for a VMware virtual machine. VMware is currently the only supported "objectType"

The function will return one of the following:

No change required. The End User '{endUser}' is already authorized to interact with the '{objectName}' VM.

The full API response for POST /internal/authorization/role/end_user

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

vmName := "vm01"
endUser := "user01"

endUserAuth, err := rubrik.EndUserAuthorization(vmName, endUser, "VMware")
if err != nil {
    log.Fatal(err)
}

func (*Credentials) ExportEC2Instance Uses

func (c *Credentials) ExportEC2Instance(instanceID, exportedInstanceName, instanceType, awsRegion, subnetID, securityGroupID string, waitForCompletion bool, timeout ...int) (interface{}, error)

ExportEC2Instance exports the latest snapshot of the specified EC2 instance.

Valid "awsRegion" choices are:

ap-south-1,ap-northeast-3, ap-northeast-2, ap-southeast-1, ap-southeast-2, ap-northeast-1, ca-central-1, cn-north-1, cn-northwest-1, eu-central-1, eu-west-1,
eu-west-2, eu-west-3, us-west-1, us-east-1, us-east-2, and us-west-2.

Valid "instanceType" choices are:

a1.medium, a1.large, a1.xlarge, a1.2xlarge, a1.4xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m4.16xlarge, m5.large, m5.xlarge, m5.2xlarge, m5.4xlarge, m5.12xlarge, m5.24xlarge, m5a.large, m5a.xlarge, m5a.2xlarge, m5a.4xlarge, m5a.12xlarge, m5a.24xlarge, m5d.large, m5d.xlarge, m5d.2xlarge, m5d.4xlarge, m5d.12xlarge, m5d.24xlarge, t2.nano, t2.micro, t2.small, t2.medium, t2.large, t2.xlarge, t2.2xlarge, t3.nano, t3.micro, t3.small, t3.medium, t3.large, t3.xlarge, t3.2xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, c5.large, c5.xlarge, c5.2xlarge, c5.4xlarge, c5.9xlarge, c5.18xlarge, c5d.xlarge, c5d.2xlarge, c5d.4xlarge, c5d.9xlarge, c5d.18xlarge, c5n.large, c5n.xlarge, c5n.2xlarge, c5n.4xlarge, c5n.9xlarge, c5n.18xlarge, r4.large, r4.xlarge, r4.2xlarge, r4.4xlarge, r4.8xlarge, r4.16xlarge, r5.large, r5.xlarge, r5.2xlarge, r5.4xlarge, r5.12xlarge, r5.24xlarge, r5a.large, r5a.xlarge, r5a.2xlarge, r5a.4xlarge, r5a.12xlarge, r5a.24xlarge, r5d.large, r5d.xlarge, r5d.2xlarge, r5d.4xlarge, r5d.12xlarge, r5d.24xlarge, x1.16xlarge, x1.32xlarge, x1e.xlarge, x1e.2xlarge, x1e.4xlarge, x1e.8xlarge, x1e.16xlarge, x1e.32xlarge, z1d.large, z1d.xlarge, z1d.2xlarge, z1d.3xlarge, z1d.6xlarge, z1d.12xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge, h1.2xlarge, h1.4xlarge, h1.8xlarge, h1.16xlarge, i3.large, i3.xlarge, i3.2xlarge, i3.4xlarge, i3.8xlarge, i3.16xlarge, f1.2xlarge, f1.4xlarge, f1.16xlarge, g3s.xlarge, g3.4xlarge, g3.8xlarge, g3.16xlarge, p2.xlarge, p2.8xlarge, p2.16xlarge, p3.2xlarge, p3.8xlarge, p3.16xlarge, and p3dn.24xlarge.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

instanceID := "i-0268174613c9404dc"
exportInstanceName := "Go SDK"
instanceType := "m4.large"
awsRegion := "us-east-2"
subnetID := "subnet-0099d50dd9df9f088"
securityGroupID := "sg-082f435771cd7e4d1"
waitForCompletion := true

exportEC2, err := rubrik.ExportEC2Instance(instanceID, exportInstanceName, instanceType, awsRegion, subnetID, securityGroupID, waitForCompletion)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) Get Uses

func (c *Credentials) Get(apiVersion, apiEndpoint string, timeout ...int) (interface{}, error)

Get sends a GET request to the provided Rubrik API endpoint and returns the full API response. Supported "apiVersions" are v1, v2, and internal. The optional timeout value corresponds to the number of seconds to wait to establish a connection to the Rubrik cluster before returning a timeout error. If no value is provided, a default of 15 seconds will be used.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

clusterInfo, err := rubrik.Get("v1", "/cluster/me")
if err != nil {
    log.Fatal(err)
}

func (*Credentials) GetSLAObjects Uses

func (c *Credentials) GetSLAObjects(slaName, objectType string, timeout ...int) (interface{}, error)

GetSLAObjects returns the name and ID of a specific object type.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

slaName := "Gold"

getObjSLA, err := rubrik.GetSLAObjects(slaName, "VMware")
if err != nil {
    log.Fatal(err)
}

func (*Credentials) JobStatus Uses

func (c *Credentials) JobStatus(jobStatusURL string, timeout ...int) (interface{}, error)

JobStatus performs a GET operation to monitor the status of a specific Rubrik job want waits for it's completion.

func (*Credentials) ObjectID Uses

func (c *Credentials) ObjectID(objectName, objectType string, timeout int, hostOS ...string) (string, error)

ObjectID will search the Rubrik cluster for the provided "objectName" and return its ID/

Valid "objectType" choices are:

vmware, sla, vmwareHost, physicalHost, filesetTemplate, managedVolume, vcenter, and ec2.

When the "objectType" is "ec2", the objectName should correspond to the AWS Instance ID.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

slaName := "Gold"
timeout := 15

slaID, err := rubrik.ObjectID(slaName, "sla", timeout)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) OnDemandSnapshotPhysical Uses

func (c *Credentials) OnDemandSnapshotPhysical(hostName, slaName, fileset, hostOS string, timeout ...int) (string, error)

OnDemandSnapshotPhysical initiates an on-demand snapshot for a physical host ("hostname"). To use the currently assigned SLA Domain for the snapshot use "current" for the slaName.

Valid "hostOS" choices are:

Linux and Windows

The function will return:

The job status URL for the on-demand Snapshot

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

hostname := "vm01"
slaName := "current"
fileset := "C_Drive"
hostOS := "Windows"

hostSnapshot, err := rubrik.OnDemandSnapshotPhysical(hostname, slaName, fileset, hostOS)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) OnDemandSnapshotVM Uses

func (c *Credentials) OnDemandSnapshotVM(objectName, objectType, slaName string, timeout ...int) (string, error)

OnDemandSnapshotVM initiates an on-demand snapshot for the "objectName". The only "objectType" currently supported is vmware. To use the currently assigned SLA Domain for the snapshot use "current" for the slaName.

The function will return:

The job status URL for the on-demand Snapshot

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

vmName := "ansible-node01"
sla := "current"

vmSnapshot, err := rubrik.OnDemandSnapshotVM(vmName, "VMware", sla)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) Patch Uses

func (c *Credentials) Patch(apiVersion, apiEndpoint string, config interface{}, timeout ...int) (interface{}, error)

Patch sends a PATCH request to the provided Rubrik API endpoint and returns the full API response. Supported "apiVersions" are v1, v2, and internal. The optional timeout value corresponds to the number of seconds to wait to establish a connection to the Rubrik cluster before returning a timeout error. If no value is provided, a default of 15 seconds will be used.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

config := map[string]string{}
config["configuredSlaDomainId"] = "388a473c-3361-42ab-8f5b-08edb76891f6"

fileset, err := rubrik.Patch("v1", "/fileset/Fileset:::b95456e2-7d60-4ed0-af88-648516e139a6", config)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) PauseSnapshot Uses

func (c *Credentials) PauseSnapshot(objectName, objectType string, timeout ...int) (interface{}, error)

PauseSnapshot suspends all snapshot activity for the provided object. The only "objectType" current supported is vmware.

The function will return one of the following:

No change required. The '{objectName}' '{objectType}' is already paused.

The full API response for POST /internal/vmware/vm/{vmID}

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

vmName := "vm01"

pauseVM, err := rubrik.PauseSnapshot(vmName, "VMware")
if err != nil {
    log.Fatal(err)
}

func (*Credentials) Post Uses

func (c *Credentials) Post(apiVersion, apiEndpoint string, config interface{}, timeout ...int) (interface{}, error)

Post sends a POST request to the provided Rubrik API endpoint and returns the full API response. Supported "apiVersions" are v1, v2, and internal. The optional timeout value corresponds to the number of seconds to wait to establish a connection to the Rubrik cluster before returning a timeout error. If no value is provided, a default of 15 seconds will be used.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

config := map[string]string{}
config["slaId"] = "388a473c-3361-42ab-8f5b-08edb76891f6"

onDemandSnapshot, err := rubrik.Post("v1", "/VMware/vm/VirtualMachine:::fbcb1f51-9520-4227-a68c-6fe145982f48-vm-204969/snapshot", config)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) RefreshvCenter Uses

func (c *Credentials) RefreshvCenter(vCenterIP string, timeout ...int) (interface{}, error)

RefreshvCenter updates the the metadata for the specified vCenter Server and waits for the job to complete before returning the JobStatus API response.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

vcenter_hostname := "go.demo.lab"

refresh, err := rubrik.RefreshvCenter(vcenter_hostname)
if err != nil {
    log.Fatal(err)

}

func (*Credentials) RegisterCluster Uses

func (c *Credentials) RegisterCluster(username, password string, timeout ...int) (interface{}, error)

RegisterCluster submits the registration details for the specified Rubrik cluster. The username and password should correspond to your Rubrik Support Portal account. The default timeout value is 160 seconds.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

support_portal_username := "gosdk@rubrik.com"
support_portal_password := "GoDummyPassword"

register, err := rubrik.RegisterCluster(support_portal_username, support_portal_password)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) RemoveAWSAccount Uses

func (c *Credentials) RemoveAWSAccount(awsAccountName string, deleteExsitingSnapshots bool, timeout ...int) (interface{}, error)

RemoveAWSAccount deletes the specific AWS account from the Rubrik clsuter and waits for the job to complete before returning the JobStatus API response.

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

awsAccountName := "GO SDK Demo" // This is the name that will be displayed in the Rubrik UI
deleteSnapshots := true

removeAWSAccount, err := rubrik.RemoveAWSAccount(awsAccountName, deleteSnapshots)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) RemoveArchiveLocation Uses

func (c *Credentials) RemoveArchiveLocation(archiveName string, timeout ...int) (*JobStatus, error)

RemoveArchiveLocation deletes the archival location from the SLA Domains that reference it and expire all snapshots at the archival location

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

archiveName := "Go SDK"

removeArchive, err := rubrik.RemoveArchiveLocation(archiveName)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) ResumeSnapshot Uses

func (c *Credentials) ResumeSnapshot(objectName, objectType string, timeout ...int) (interface{}, error)

ResumeSnapshot resumes all snapshot activity for the provided object. The only "objectType" currently supported is vmware.

The function will return one of the following:

No change required. The '{objectName}' '{objectType}' is currently not paused.

The full API response for POST /internal/vmware/vm/{vmID}

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

vmName := "vm01"

resumeVM, err := rubrik.ResumeSnapshot(vmName, "VMware")
if err != nil {
    log.Fatal(err)
}

func (*Credentials) UpdateAWSNativeAccount Uses

func (c *Credentials) UpdateAWSNativeAccount(archiveName string, config map[string]interface{}, timeout ...int) (*UpdateAWSNative, error)

UpdateAWSNativeAccount updates the configuration of a AWS Native account. The following values, from PATCH /internal/aws/account/{id} are options for the config:

{
 "name": "string",
 "accessKey": "string",
 "secretKey": "string",
 "regions": [
   "string"
 ],
 "regionalBoltNetworkConfigs": [
   {
     "region": "string",
     "vNetId": "string",
     "subnetId": "string",
     "securityGroupId": "string"
   }
 ],
 "disasterRecoveryArchivalLocationId": "string"

}

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

awsAccountName := "GO SDK Demo" // This is the name that will be displayed in the Rubrik UI
newAWSAccountName := "GO SDK"

config := make(map[string]interface{})
config["name"] = newAWSAccountName

updateAWSAccount, err := rubrik.UpdateAWSNativeAccount(awsAccountName, config)
if err != nil {
    log.Fatal(err)
}

func (*Credentials) UpdateCloudArchiveLocation Uses

func (c *Credentials) UpdateCloudArchiveLocation(archiveName string, config map[string]interface{}, timeout ...int) (*UpdateArchiveLocations, error)

UpdateCloudArchiveLocation updates the configuration of a the Cloud Archival Location. The following values, from PATCH /internal/object_store/{id} are options for the config:

{
   "name": "string",
   "accessKey": "string",
   "secretKey": "string",
   "endpoint": "string",
   "numBuckets": 0,
   "isComputeEnabled": true,
   "isConsolidationEnabled": true,
   "defaultComputeNetworkConfig": {
     "subnetId": "string",
     "vNetId": "string",
     "securityGroupId": "string",
     "resourceGroupId": "string"
   },
   "storageClass": "string",
   "glacierConfig": {
     "retrievalTier": "BulkRetrieval",
     "vaultLockPolicy": {
       "fileLockPeriodInDays": 0
     }
   },
   "azureComputeSummary": {
     "tenantId": "string",
     "subscriptionId": "string",
     "clientId": "string",
     "region": "string",
     "generalPurposeStorageAccountName": "string",
     "containerName": "string",
     "environment": "AZURE"
   },
   "azureComputeSecret": {
   "  clientSecret": "string"
   },
   "archivalProxyConfig": {
     "protocol": "HTTP",
     "proxyServer": "string",
     "portNumber": 0,
     "userName": "string",
     "password": "string"
   },
   "computeProxyConfig": {
     "protocol": "HTTP",
     "proxyServer": "string",
     "portNumber": 0,
     "userName": "string",
     "password": "string"
   }
 }

Code:

rubrik, err := rubrikcdm.ConnectEnv()
if err != nil {
    log.Fatal(err)
}

archiveName := "Go SDK"
storageClass := "standard"

config := make(map[string]interface{})
config["storageClass"] = storageClass

updateArchive, err := rubrik.UpdateCloudArchiveLocation(archiveName, config)
if err != nil {
    log.Fatal(err)
}

type CurrentAWSAccount Uses

type CurrentAWSAccount struct {
    HasMore bool `json:"hasMore"`
    Data    []struct {
        ID               string `json:"id"`
        Name             string `json:"name"`
        PrimaryClusterID string `json:"primaryClusterId"`
        Status           string `json:"status"`
    }   `json:"data"`
    Total int `json:"total"`
}

CurrentAWSAccount represents the JSON response for GET /aws/account

type CurrentAWSAccountID Uses

type CurrentAWSAccountID struct {
    Name                       string   `json:"name"`
    AccessKey                  string   `json:"accessKey"`
    Regions                    []string `json:"regions"`
    RegionalBoltNetworkConfigs []struct {
        Region          string `json:"region"`
        VNetID          string `json:"vNetId"`
        SubnetID        string `json:"subnetId"`
        SecurityGroupID string `json:"securityGroupId"`
    }   `json:"regionalBoltNetworkConfigs"`
    DisasterRecoveryArchivalLocationID string `json:"disasterRecoveryArchivalLocationId"`
    ID                                 string `json:"id"`
    ConfiguredSLADomainID              string `json:"configuredSlaDomainId"`
    ConfiguredSLADomainName            string `json:"configuredSlaDomainName"`
    PrimaryClusterID                   string `json:"primaryClusterId"`
}

CurrentAWSAccountID represents the JSON response for GET /aws/account/{id}

type CurrentArchiveLocations Uses

type CurrentArchiveLocations struct {
    HasMore bool `json:"hasMore"`
    Data    []struct {
        ID              string `json:"id"`
        Name            string `json:"name"`
        LocationType    string `json:"locationType"`
        IsActive        bool   `json:"isActive"`
        IPAddress       string `json:"ipAddress"`
        Bucket          string `json:"bucket"`
        OwnershipStatus string `json:"ownershipStatus"`
    }   `json:"data"`
    Total int `json:"total"`
}

CurrentArchiveLocations represents the JSON response for GET /internal/archive/location

type EndManagedVolumeSnapshot Uses

type EndManagedVolumeSnapshot struct {
    ID                     string   `json:"id"`
    Date                   string   `json:"date"`
    ExpirationDate         string   `json:"expirationDate"`
    SourceObjectType       string   `json:"sourceObjectType"`
    IsOnDemandSnapshot     bool     `json:"isOnDemandSnapshot"`
    CloudState             int      `json:"cloudState"`
    ConsistencyLevel       string   `json:"consistencyLevel"`
    IndexState             int      `json:"indexState"`
    ReplicationLocationIds []string `json:"replicationLocationIds"`
    ArchivalLocationIds    []string `json:"archivalLocationIds"`
    SLAID                  string   `json:"slaId"`
    SLAName                string   `json:"slaName"`
    Links                  struct {
        Self struct {
            Href string `json:"href"`
            Rel  string `json:"rel"`
        } `json:"self"`
    }   `json:"links"`
}

EndManagedVolumeSnapshot corresponds to POST /internal/managed_volume/{id}/end_snapshot

type EndUserAuthorization Uses

type EndUserAuthorization struct {
    HasMore bool `json:"hasMore"`
    Data    []struct {
        Principal  string `json:"principal"`
        Privileges struct {
            DestructiveRestore []string `json:"destructiveRestore"`
            Restore            []string `json:"restore"`
            ProvisionOnInfra   []string `json:"provisionOnInfra"`
        }   `json:"privileges"`
        OrganizationID string `json:"organizationId"`
    }   `json:"data"`
    Total int `json:"total"`
}

EndUserAuthorization corresponds to POST /internal/authorization/role/end_user

type ExportEC2Instance Uses

type ExportEC2Instance struct {
    HasMore bool `json:"hasMore"`
    Data    []struct {
        ID                     string   `json:"id"`
        Date                   string   `json:"date"`
        ExpirationDate         string   `json:"expirationDate"`
        SourceObjectType       string   `json:"sourceObjectType"`
        IsOnDemandSnapshot     bool     `json:"isOnDemandSnapshot"`
        CloudState             int      `json:"cloudState"`
        ConsistencyLevel       string   `json:"consistencyLevel"`
        IndexState             int      `json:"indexState"`
        ReplicationLocationIds []string `json:"replicationLocationIds"`
        ArchivalLocationIds    []string `json:"archivalLocationIds"`
        SLAID                  string   `json:"slaId"`
        SLAName                string   `json:"slaName"`
        AccountID              string   `json:"accountId"`
        InstanceID             string   `json:"instanceId"`
        ImageID                string   `json:"imageId"`
        SnapshotVolumeIds      []string `json:"snapshotVolumeIds"`
    }   `json:"data"`
    Total int `json:"total"`
}

ExportEC2Instance corresponds to GET /aws/ec2_instance/{id}/snapshot

type JobStatus Uses

type JobStatus struct {
    ID        string `json:"id"`
    Status    string `json:"status"`
    Progress  int    `json:"progress"`
    StartTime string `json:"startTime"`
    EndTime   string `json:"endTime"`
    NodeID    string `json:"nodeId"`
    Error     struct {
        Message string `json:"message"`
    }   `json:"error"`
    Links []struct {
        Href string `json:"href"`
        Rel  string `json:"rel"`
    }   `json:"links"`
}

JobStatus represents the JSON response for DELETE /internal/archive/location/{id}

type SMTP Uses

type SMTP struct {
    ID           string `json:"id"`
    SMTPHostname string `json:"smtpHostname"`
    SMTPPort     int    `json:"smtpPort"`
    SMTPSecurity string `json:"smtpSecurity"`
    SMTPUsername string `json:"smtpUsername"`
    FromEmailID  string `json:"fromEmailId"`
}

SMTP corresponds to PATCH /internal/smtp_instance/{id}

type StatusCode Uses

type StatusCode struct {
    StatusCode int `json:"statusCode"`
}

StatusCode is used when the only API response is a status code

type Syslog Uses

type Syslog struct {
    Hostname string `json:"hostname"`
    Port     int    `json:"port"`
    Protocol string `json:"protocol"`
    ID       string `json:"id"`
}

Syslog corresponds to POST /internal/syslog

type UpdateAWSNative Uses

type UpdateAWSNative struct {
    Name                       string   `json:"name"`
    AccessKey                  string   `json:"accessKey"`
    Regions                    []string `json:"regions"`
    RegionalBoltNetworkConfigs []struct {
        Region          string `json:"region"`
        VNetID          string `json:"vNetId"`
        SubnetID        string `json:"subnetId"`
        SecurityGroupID string `json:"securityGroupId"`
    }   `json:"regionalBoltNetworkConfigs"`
    DisasterRecoveryArchivalLocationID string `json:"disasterRecoveryArchivalLocationId"`
    ID                                 string `json:"id"`
    ConfiguredSLADomainID              string `json:"configuredSlaDomainId"`
    ConfiguredSLADomainName            string `json:"configuredSlaDomainName"`
    PrimaryClusterID                   string `json:"primaryClusterId"`
}

UpdateAWSNative

type UpdateArchiveLocations Uses

type UpdateArchiveLocations struct {
    ID         string `json:"id"`
    Definition struct {
        ObjectStoreType             string `json:"objectStoreType"`
        Name                        string `json:"name"`
        AccessKey                   string `json:"accessKey"`
        Bucket                      string `json:"bucket"`
        PemFileContent              string `json:"pemFileContent"`
        KmsMasterKeyID              string `json:"kmsMasterKeyId"`
        DefaultRegion               string `json:"defaultRegion"`
        Endpoint                    string `json:"endpoint"`
        NumBuckets                  int    `json:"numBuckets"`
        IsComputeEnabled            bool   `json:"isComputeEnabled"`
        IsConsolidationEnabled      bool   `json:"isConsolidationEnabled"`
        DefaultComputeNetworkConfig struct {
            SubnetID        string `json:"subnetId"`
            VNetID          string `json:"vNetId"`
            SecurityGroupID string `json:"securityGroupId"`
            ResourceGroupID string `json:"resourceGroupId"`
        }   `json:"defaultComputeNetworkConfig"`
        StorageClass        string `json:"storageClass"`
        AzureComputeSummary struct {
            TenantID                         string `json:"tenantId"`
            SubscriptionID                   string `json:"subscriptionId"`
            ClientID                         string `json:"clientId"`
            Region                           string `json:"region"`
            GeneralPurposeStorageAccountName string `json:"generalPurposeStorageAccountName"`
            ContainerName                    string `json:"containerName"`
            Environment                      string `json:"environment"`
        }   `json:"azureComputeSummary"`
    }   `json:"definition"`
    GlacierStatus struct {
        RetrievalTier   string `json:"retrievalTier"`
        VaultLockStatus struct {
            FileLockPeriodInDays int       `json:"fileLockPeriodInDays"`
            Status               string    `json:"status"`
            ExpiryTime           time.Time `json:"expiryTime"`
        }   `json:"vaultLockStatus"`
    }   `json:"glacierStatus"`
    ArchivalProxySummary struct {
        Protocol    string `json:"protocol"`
        ProxyServer string `json:"proxyServer"`
        PortNumber  int    `json:"portNumber"`
        UserName    string `json:"userName"`
    }   `json:"archivalProxySummary"`
    ComputeProxySummary struct {
        Protocol    string `json:"protocol"`
        ProxyServer string `json:"proxyServer"`
        PortNumber  int    `json:"portNumber"`
        UserName    string `json:"userName"`
    }   `json:"computeProxySummary"`
    ReaderLocationSummary struct {
        State         string    `json:"state"`
        RefreshedTime time.Time `json:"refreshedTime"`
    }   `json:"readerLocationSummary"`
}

UpdateArchiveLocations represents the JSON response for PATCH /internal/archive/location/{id}

Package rubrikcdm imports 15 packages (graph). Updated 2019-03-28. Refresh now. Tools for package owners.