Documentation ¶
Index ¶
- type AWSManager
- func (m *AWSManager) CreateVPC(name, cidr string) (VPC, error)
- func (m *AWSManager) DeleteVPC(id string) error
- func (m *AWSManager) GetVPC(id string) (VPC, error)
- func (m *AWSManager) ListAllVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *AWSManager) ListCreatingVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *AWSManager) ListDeletedVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *AWSManager) ListDeletingVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *AWSManager) ListRunningVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *AWSManager) ListStartingVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *AWSManager) ListStoppedVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *AWSManager) ListStoppingVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *AWSManager) ListVPCs(fields map[string]interface{}, instanceStateCode string) ([]VPC, error)
- type Manager
- type OCIManager
- func (m *OCIManager) CreateVPC(name, cidr string) (VPC, error)
- func (m *OCIManager) DeleteVPC(id string) error
- func (m *OCIManager) GetVPC(id string) (VPC, error)
- func (m *OCIManager) ListAllVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *OCIManager) ListCreatingVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *OCIManager) ListDeletedVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *OCIManager) ListDeletingVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *OCIManager) ListRunningVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *OCIManager) ListStartingVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *OCIManager) ListStoppedVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *OCIManager) ListStoppingVPCs(fields map[string]interface{}) ([]VPC, error)
- func (m *OCIManager) ListVPCs(fields map[string]interface{}, enum core.InstanceLifecycleStateEnum) ([]VPC, error)
- type VPC
- type VPCStateEnum
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWSManager ¶
type AWSManager struct { Auth *authentication.AWSAuth // Stores AWS authentication and session configurations. Ec2Svc *ec2.EC2 // AWS EC2 Service client for managing VPCs. }
AWSManager provides functionality for managing AWS VPCs and their lifecycle states. It abstracts AWS SDK interactions, enabling listing, creating, deleting, and retrieving VPCs.
func (*AWSManager) CreateVPC ¶
func (m *AWSManager) CreateVPC(name, cidr string) (VPC, error)
CreateVPC creates a new VPC with the specified name and CIDR block. Parameters:
- name: The name of the VPC to create.
- cidr: The CIDR block for the new VPC.
Returns:
- A `VPC` object representing the created VPC (placeholder).
- An error if the operation fails.
func (*AWSManager) DeleteVPC ¶
func (m *AWSManager) DeleteVPC(id string) error
DeleteVPC deletes a VPC with the specified ID. Parameters:
- id: The ID of the VPC to delete.
Returns:
- An error if the operation fails (placeholder implementation).
func (*AWSManager) GetVPC ¶
func (m *AWSManager) GetVPC(id string) (VPC, error)
GetVPC retrieves the details of a VPC with the specified ID. Parameters:
- id: The ID of the VPC to retrieve.
Returns:
- A `VPC` object representing the retrieved VPC (placeholder).
- An error if the operation fails.
func (*AWSManager) ListAllVPCs ¶
func (m *AWSManager) ListAllVPCs(fields map[string]interface{}) ([]VPC, error)
ListAllVPCs retrieves a list of all VPCs, regardless of lifecycle state. Parameters:
- fields: A map (`map[string]interface{}`) containing optional filters for the request.
Returns:
- A slice of `VPC` objects.
- An error if the operation fails.
func (*AWSManager) ListCreatingVPCs ¶
func (m *AWSManager) ListCreatingVPCs(fields map[string]interface{}) ([]VPC, error)
ListCreatingVPCs retrieves a list of VPCs with instances in the "pending" (creating) state. Parameters:
- fields: A map (`map[string]interface{}`) containing optional filters for the request.
Returns:
- A slice of `VPC` objects.
- An error if the operation fails.
func (*AWSManager) ListDeletedVPCs ¶
func (m *AWSManager) ListDeletedVPCs(fields map[string]interface{}) ([]VPC, error)
ListDeletedVPCs retrieves a list of VPCs with instances in the "terminated" (deleted) state. Parameters:
- fields: A map (`map[string]interface{}`) containing optional filters for the request.
Returns:
- A slice of `VPC` objects.
- An error if the operation fails.
func (*AWSManager) ListDeletingVPCs ¶
func (m *AWSManager) ListDeletingVPCs(fields map[string]interface{}) ([]VPC, error)
ListDeletingVPCs retrieves a list of VPCs with instances in the "pending" (deleting) state. Parameters:
- fields: A map (`map[string]interface{}`) containing optional filters for the request.
Returns:
- A slice of `VPC` objects.
- An error if the operation fails.
func (*AWSManager) ListRunningVPCs ¶
func (m *AWSManager) ListRunningVPCs(fields map[string]interface{}) ([]VPC, error)
ListRunningVPCs retrieves a list of VPCs with instances in the "running" state. Parameters:
- fields: A map (`map[string]interface{}`) containing optional filters for the request.
Returns:
- A slice of `VPC` objects.
- An error if the operation fails.
func (*AWSManager) ListStartingVPCs ¶
func (m *AWSManager) ListStartingVPCs(fields map[string]interface{}) ([]VPC, error)
ListStartingVPCs retrieves a list of VPCs with instances in the "pending" (starting) state. Parameters:
- fields: A map (`map[string]interface{}`) containing optional filters for the request.
Returns:
- A slice of `VPC` objects.
- An error if the operation fails.
func (*AWSManager) ListStoppedVPCs ¶
func (m *AWSManager) ListStoppedVPCs(fields map[string]interface{}) ([]VPC, error)
ListStoppedVPCs retrieves a list of VPCs with instances in the "stopped" state. Parameters:
- fields: A map (`map[string]interface{}`) containing optional filters for the request.
Returns:
- A slice of `VPC` objects.
- An error if the operation fails.
func (*AWSManager) ListStoppingVPCs ¶
func (m *AWSManager) ListStoppingVPCs(fields map[string]interface{}) ([]VPC, error)
ListStoppingVPCs retrieves a list of VPCs with instances in the "stopping" state. Parameters:
- fields: A map (`map[string]interface{}`) containing optional filters for the request.
Returns:
- A slice of `VPC` objects.
- An error if the operation fails.
func (*AWSManager) ListVPCs ¶
func (m *AWSManager) ListVPCs(fields map[string]interface{}, instanceStateCode string) ([]VPC, error)
ListVPCs retrieves a list of VPCs filtered by lifecycle state and additional custom parameters. Parameters:
- fields: A map (`map[string]interface{}`) containing optional filters for the request.
- instanceStateCode: A string representing the lifecycle state of instances (e.g., "running", "stopped").
Returns:
- A slice of `VPC` objects that match the inputs.
- An error if the operation fails.
type Manager ¶
type Manager interface { ListRunningVPCs(map[string]interface{}) ([]VPC, error) // Lists VPCs in "Running" state. ListStartingVPCs(map[string]interface{}) ([]VPC, error) // Lists VPCs in "Starting" state. ListStoppingVPCs(map[string]interface{}) ([]VPC, error) // Lists VPCs in "Stopping" state. ListStoppedVPCs(map[string]interface{}) ([]VPC, error) // Lists VPCs in "Stopped" state. ListCreatingVPCs(map[string]interface{}) ([]VPC, error) // Lists VPCs in "Creating" state. ListDeletingVPCs(map[string]interface{}) ([]VPC, error) // Lists VPCs in "Deleting" state. ListDeletedVPCs(map[string]interface{}) ([]VPC, error) // Lists VPCs in "Deleted" state. ListAllVPCs(map[string]interface{}) ([]VPC, error) // Lists VPCs across all states. CreateVPC(name, cidr string) (VPC, error) // Creates a new VPC. DeleteVPC(id string) error // Deletes a VPC by ID. GetVPC(id string) (VPC, error) // Retrieves a specific VPC by ID. }
Manager is a generic interface for managing VPCs across cloud providers. It includes methods for listing, creating, and deleting VPCs in various states.
func NewVPCManager ¶
func NewVPCManager(authConfig *authentication.AuthConfig) (Manager, error)
NewVPCManager is a factory function that returns a Manager implementation based on the cloud provider.
type OCIManager ¶
type OCIManager struct { Auth *authentication.OCIAuth // OCI authentication details. Client *core.ComputeClient // OCI Compute Client for interacting with OCI services. }
OCIManager manages VPC-related operations in Oracle Cloud Infrastructure (OCI). It interacts with the OCI SDK for tasks like listing, creating, and deleting VPCs.
func (*OCIManager) DeleteVPC ¶
func (m *OCIManager) DeleteVPC(id string) error
func (*OCIManager) ListAllVPCs ¶
func (m *OCIManager) ListAllVPCs(fields map[string]interface{}) ([]VPC, error)
func (*OCIManager) ListCreatingVPCs ¶
func (m *OCIManager) ListCreatingVPCs(fields map[string]interface{}) ([]VPC, error)
func (*OCIManager) ListDeletedVPCs ¶
func (m *OCIManager) ListDeletedVPCs(fields map[string]interface{}) ([]VPC, error)
func (*OCIManager) ListDeletingVPCs ¶
func (m *OCIManager) ListDeletingVPCs(fields map[string]interface{}) ([]VPC, error)
func (*OCIManager) ListRunningVPCs ¶
func (m *OCIManager) ListRunningVPCs(fields map[string]interface{}) ([]VPC, error)
func (*OCIManager) ListStartingVPCs ¶
func (m *OCIManager) ListStartingVPCs(fields map[string]interface{}) ([]VPC, error)
func (*OCIManager) ListStoppedVPCs ¶
func (m *OCIManager) ListStoppedVPCs(fields map[string]interface{}) ([]VPC, error)
func (*OCIManager) ListStoppingVPCs ¶
func (m *OCIManager) ListStoppingVPCs(fields map[string]interface{}) ([]VPC, error)
func (*OCIManager) ListVPCs ¶
func (m *OCIManager) ListVPCs(fields map[string]interface{}, enum core.InstanceLifecycleStateEnum) ([]VPC, error)
ListVPCs filters VPCs based on a lifecycle state and additional fields. Parameters: - fields: A generic map where keys (e.g., "oci_compartment_id") provide filtering options. - enum: The lifecycle state to filter VPCs (e.g., Running, Stopped). Returns: A list of filtered VPCs or an error if the request fails.
type VPC ¶
type VPC struct { ID string `json:"id"` // Unique identifier for the VPC. Name string `json:"name"` // Display name of the VPC. Region string `json:"region"` // Region where the VPC resides. Provider string `json:"provider"` // Cloud provider (e.g., "oci", "aws", etc.). Description string `json:"description"` // Detailed description of the VPC (e.g., shape or configuration). CidrBlock string `json:"cidr_block"` // CIDR block associated with the VPC. PublicIP string `json:"public_ip"` // CIDR block associated with the VPC. PrivateIP string `json:"private_ip"` // CIDR block associated with the VPC. State VPCStateEnum `json:"state"` // Current state of the VPC (e.g., "available", "creating", "deleting"). CPUCount int64 `json:"cpu_count"` // Number of physical CPUs (if applicable). VirtualCPUCount int64 `json:"virtual_cpu_count"` // Number of virtual CPUs. CPUDescription string `json:"cpu_description"` // Description of the CPU type. GPUCount int64 `json:"gpu_count"` // Number of GPUs (if applicable). GPUDescription string `json:"gpu_description"` // Description of the GPU type. MemoryGB int64 `json:"memory_gb"` // Total memory in GB. // ProviderSpecific holds provider-specific details about the VPC. // For OCI, use the OCIInstance; for other providers, use respective implementations. ProviderSpecific interface{} `json:"providerSpecific"` }
VPC is a generic and extensible representation of a Virtual Private Cloud (VPC) instance. It allows uniform representation of VPCs across different cloud providers.
func AWSInstanceToVPC ¶
AWSInstanceToVPC converts an AWS EC2 Instance object into a generic VPC structure. This function maps AWS-specific instance properties, such as CPU, memory, and networking, into a unified VPC structure usable within the application logic. Parameters:
- instance: A pointer to an AWS EC2 instance object.
Returns:
- A VPC object populated with details from the AWS EC2 instance.
func OCIInstanceToVPC ¶
OCIInstanceToVPC converts an OCI Instance object into a generic VPC structure. It extracts fields like CPU, GPU, memory, and other details from the instance shape configuration.
type VPCStateEnum ¶
type VPCStateEnum string
VPCStateEnum defines the possible states for a Virtual Private Cloud (VPC) lifecycle.
const ( // VPCStateAvailable The VPC is currently available and active. VPCStateAvailable VPCStateEnum = "AVAILABLE" VPCStateUnavailable VPCStateEnum = "UNAVAILABLE" // VPCStateCreating The VPC is being created. VPCStateCreating VPCStateEnum = "CREATING" // VPCStateModifying The VPC is actively being updated or modified. VPCStateModifying VPCStateEnum = "MODIFYING" // VPCStateDeleting The VPC is in the process of being deleted. VPCStateDeleting VPCStateEnum = "DELETING" // VPCStateFailed The VPC has failed creation or encountered an error during modification. VPCStateFailed VPCStateEnum = "FAILED" // VPCStateDeleted The VPC has been successfully deleted and is no longer present. VPCStateDeleted VPCStateEnum = "DELETED" )
Constants representing the various states of a VPC.