datastores

package
v1.125.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "datastores",
	Short: "Manage data stores to export analytics data",
	Long:  "Manage data stores to export analytics data",
}

Cmd to manage datastores

View Source
var CreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create a new data store",
	Long:  "Create a new data store",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		if err = validate(targetType, bucketName, gcsPath,
			tablePrefix, datasetName); err != nil {
			return err
		}
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = datastores.Create(name, targetType, projectID, bucketName,
			gcsPath, datasetName, tablePrefix)
		return
	},
}

CreateCmd to create a datastore

View Source
var DeleteCmd = &cobra.Command{
	Use:   "delete",
	Short: "Deletes a datastore connection",
	Long:  "Deletes a datastore connection",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		if name == "" && id == "" {
			return fmt.Errorf("id or name must be passed to the command")
		}
		if name != "" && id != "" {
			return fmt.Errorf("id and name cannot be passed together")
		}
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		if id != "" {
			_, err = datastores.Delete(id)
		} else {
			var version string
			if version, err = datastores.GetVersion(name); err != nil {
				return err
			}
			_, err = datastores.Delete(version)
		}
		return
	},
}

DeleteCmd to delete a datastore

View Source
var GetCmd = &cobra.Command{
	Use:   "get",
	Short: "Gets a datastore connection",
	Long:  "Gets a datastore connection",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		if name == "" && id == "" {
			return fmt.Errorf("id or name must be passed to the command")
		}
		if name != "" && id != "" {
			return fmt.Errorf("id and name cannot be passed together")
		}
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		if id != "" {
			_, err = datastores.Get(id)
		} else {
			var respBody []byte
			if respBody, err = datastores.GetName(name); err != nil {
				return err
			}
			apiclient.PrettyPrint("application/json", respBody)
		}
		return
	},
}

GetCmd to get a datastore

View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "Returns a list of data stores in the org",
	Long:  "Returns a list of data stores in the org",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = datastores.List(targetType)
		return
	},
}

ListCmd to list datastores

View Source
var TestCmd = &cobra.Command{
	Use:   "test",
	Short: "Test an existing data store",
	Long:  "Test an existing data store",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		if err = validate(targetType, bucketName, gcsPath,
			tablePrefix, datasetName); err != nil {
			return err
		}
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = datastores.Test(id, name, targetType, projectID, bucketName,
			gcsPath, datasetName, tablePrefix)
		return
	},
}

TestCmd to update a datastore

View Source
var UpdateCmd = &cobra.Command{
	Use:   "update",
	Short: "Update an existing data store",
	Long:  "Update an existing data store",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		if err = validate(targetType, bucketName, gcsPath,
			tablePrefix, datasetName); err != nil {
			return err
		}
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = datastores.Update(id, name, targetType, projectID, bucketName,
			gcsPath, datasetName, tablePrefix)
		return
	},
}

UpdateCmd to update a datastore

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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